跳到主要内容

结账 API

Ask AI

创建一个结账会话,将您的买家重定向到 GLODIPAY 托管的付款页面,或返回一个可共享的付款链接。

接口地址 (Endpoint): POST /v2/checkout Content-Type: application/json


请求参数 (Request Parameters)

字段类型是否必填描述
merchantIdString(1–50)M商户 ID。例如:1100000123
orderRefString(1–250)M每个商户唯一的交易引用。例如:ORDER-2026-001
amountFloatM发票金额。最小值:1。最多 2 位小数。例如:100.00
currencyString(3)MISO 4217 货币代码。例如:USD
paymentMethodStringM要显示的付款方式。例如:checkout。请参阅 付款方式
callbackUrlString(1–300)M付款成功后的重定向 URL。必须是 https。例如:https://yoursite.com/return
notificationUrlString(1–300)M用于 IPN Webhook 的服务器端点。必须是 https。例如:https://yoursite.com/webhook
cancelUrlString(1–300)M取消时的重定向 URL。必须是 https。例如:https://yoursite.com/cancel
errorUrlString(1–300)M出错时的重定向 URL。必须是 https。例如:https://yoursite.com/error
connectionModeStringOAPI (默认) 或 DIRECT_POST。请参阅 连接模式
orderDescriptionString(max:3000)M结账屏幕上显示的简短描述。例如:Order #2026-001
metadataJSONOIPN 和查询响应中返回的键值对。例如:{"orderId":"12345"}
transactionDocumentsJSONO交易的辅助文档。例如:[{"type":"invoice","url":"https://yoursite.com/inv.pdf"}]
paymentFilterJSONO要从会话中排除的付款方式类型数组。例如:["card"]
paymentSorterJSONO控制显示顺序的有序数组。例如:["checkout","card"]
feeBySellerNumber(0–100)O商户支付的处理费百分比。0 = 买家支付 100%。例如:50
billingFirstNameString(max:255)O账单名字。例如:John
billingLastNameString(max:255)O账单姓氏。例如:Doe
billingEmailString(max:255)O买家电子邮件地址。例如:john.doe@example.com
billingStreet1String(max:255)O账单街道地址第 1 行。例如:123 Main St
billingStreet2String(max:255)O账单街道地址第 2 行。例如:Suite 4B
billingCityString(max:255)O账单城市。例如:New York
billingStateString(2–255)O账单州/省。例如:NY
billingCountryStringOISO 3166-1 alpha-2 国家代码。例如:US。请参阅 国家代码
billingPostalCodeString(max:25)O邮政编码。例如:10001
billingPhoneCountryCodeString(max:10)O电话国家代码。例如:1(美国)
billingPhoneNumberString(max:20)O电话号码。例如:5551234567
brandNameString(1–255)O覆盖托管结账屏幕上的品牌名称。例如:My Store
colorModeString(1–255)O最多 3 种颜色,用 --- 分隔。接受颜色名称、HEX 或 RGBA。例如:#2e7d32---#e8f5e9---#81c784
logoSourceString(1–255)O覆盖托管结账屏幕上的 Logo。例如:https://yoursite.com/logo.png
customerIpStringO客户的 IP 地址。例如:203.0.113.42
websiteUrlString(max:300)O商户网站 URL。例如:https://yoursite.com
expiresAtStringOISO 8601 格式的会话过期时间。默认值:24 小时。例如:2026-04-22T10:00:00+00:00
signatureString(max:750)MRSA-MD5 签名。请参阅 签名

M = 必填 (Mandatory),O = 可选 (Optional)


响应 (Response)

connectionMode: API

字段类型描述
statusString成功时为 created,失败时为 error
transactionIdString (ULID)GLODIPAY 交易 ID
paymentLinkString已签名的 URL —— 将买家重定向到此 URL 以完成付款
messageString人类可读的消息

成功示例:

{
"status": "created",
"transactionId": "01jza90dy6w82dfrrqvadn5vs4",
"paymentLink": "https://payment.gpayprocessing.com/v2/checkout/01jza90dy6w82dfrrqvadn5vs4?...",
"message": "Payment Link created successfully"
}

错误示例:

{
"status": "error",
"transactionId": null,
"paymentLink": null,
"message": "No active payment service providers found. Please contact support."
}

connectionMode: DIRECT_POST

买家的浏览器被直接重定向到 GLODIPAY 托管的结账页面。您的服务器不会收到 JSON 响应。


回调 URL (Callback URL)

付款后,GLODIPAY 会使用 payload 查询参数对您的 callbackUrl 执行 GET 重定向:

GET {callbackUrl}?payload={base64-encoded-json}

解码后的 payload 字段:

字段类型描述
statusString最终交易状态。请参阅 状态值
transactionIdStringGLODIPAY 交易 ID
refString商户的 orderRef
amountFloat发票金额
currencyString货币代码
signatureStringRSA-MD5 签名 —— 使用 GLODIPAY 公钥验证

在信任 status 之前,务必验证回调 payload 中的 signature。使用交易查询 (Transaction Query) 接口获取完整的付款详情。


IPN 通知

当交易达到终端状态时,GLODIPAY 会将付款结果发送到您的 notificationUrl。请参阅 IPN 通知 了解完整的 payload 和确认格式。


交易查询 (Transaction Query)

随时使用 POST /v2/checkout/query 检查交易状态。请参阅 交易查询


来源

此页面派生自 GLODIPAY_Checkout_API_Specification_v2

Bookmarks

No bookmarks yet.
Hover over a heading and click to save a section.