为了简单起见,我计划使用会话流程,但我找不到任何有关如何在不使用创建会话时提供的
sessionId
和 sessionResult
的情况下获取付款详细信息的文档。所以我正在创建一个会话
reference
然后将包含托管结帐页面的 URL (
// Adyen Go API Library v9.3.0
import (
"context"
"time"
"github.com/adyen/adyen-go-api-library/v9/src/common"
"github.com/adyen/adyen-go-api-library/v9/src/adyen"
"github.com/adyen/adyen-go-api-library/v9/src/checkout"
)
// For the live environment, additionally include your liveEndpointUrlPrefix.
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Create the request object(s)
amount := checkout.Amount{
Currency: "EUR",
Value: 1000,
}
createCheckoutSessionRequest := checkout.CreateCheckoutSessionRequest{
Reference: "YOUR_PAYMENT_REFERENCE",
Mode: common.PtrString("hosted"),
Amount: amount,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("NL"),
ThemeId: common.PtrString("AZ1234567"),
ReturnUrl: "https://your-company.com/checkout?shopperOrder=12xy..",
ExpiresAt: func() *time.Time { t, _ := time.Parse(time.RFC3339, "2023-05-18T10:15:30+01:00"); return &t }(),
}
// Make the API call
service := client.Checkout()
req := service.PaymentsApi.SessionsInput().IdempotencyKey("UUID").CreateCheckoutSessionRequest(createCheckoutSessionRequest)
res, httpRes, err := service.PaymentsApi.Sessions(context.Background(), req)
) 的
/sessions
响应传递给客户。 如何在没有通知 webhook 的情况下使用稍后的参考来获取此会话/付款的详细信息?我尝试过他们的文档(https://docs.adyen.com/online- payments/build-your-integration/sessions-flow/?programming_language=go
)和示例代码(https://github. com/adyen-examples/adyen-golang-online- payments)。
url
端点检索支付结果,您必须在路径参数中提供
/sessions/{sessionId}?sessionResult=...
,并且必须在查询参数中提供 'sessionResult',请参阅 API Explorer或请参阅 Go 库 (v10.4.0) 中的函数:
sessionId