GLODIPAY 结账 API 规范
版本 2.0.0
目录
使用测试环境。不产生实际费用。
| 无 3DS | 4111 1111 1111 1111 | 01/30 | 029 | — |
| 无 3DS | 5555 5555 5555 4444 | 01/30 | 029 | — |
| 3DS 付款 | 4012 8888 8888 1881 | 01/30 | 029 | 成功:123456 / 失败:111111 |
| 3DS 付款 | 5111 1111 1111 1118 | 01/30 | 029 | 成功:123456 / 失败:111111 |
| 3DS 付款 | 4141 4141 4141 4141 | 12/30 | 123 | 成功:123456 / 失败:111111 |
介绍
本文档描述了 GLODIPAY Checkout API v2,它允许商户创建一个托管付款会话,并在一个统一的结账页面中支持信用卡/借记卡、移动银行、二维码、钱包和加密货币。
主要功能:
- 多 PSP: 单个结账会话可以同时展示来自多个支付服务提供商的付款方式。买家可以在托管页面上看到所有可用选项 —— 商户端无需额外配置。
- 连接模式: 在浏览器重定向 (
DIRECT_POST) 或带有付款链接的 API 响应 (API) 之间进行选择。 - 自动过期: 会话在 24 小时后自动过期(可通过
expiresAt配置)。
接口地址 (Endpoints)
| 测试环境 | 将另行提供 |
| 生产环境 | 从商户后台的 API Keys 页面获取 |
签名 (Signature)
所有发送给 GLODIPAY 的请求必须包含 signature 字段。所有来自 GLODIPAY 的响应和 IPN Payload 也包含 signature 字段以验证真实性。
签名使用 RSA with MD5 (md5WithRSAEncryption)。
生成签名 (商户 -> GLODIPAY)
使用您的 商户私钥(可从商户后台获取)。
步骤:
- 将除
signature以外的所有请求参数收集为扁平的键值对象。 - 仅按 自然升序 对 顶层键 进行排序(PHP 中的
SORT_NATURAL/ JavaScript 中带有{ numeric: true }的localeCompare)。不要对嵌套对象(如fees、paymentMethodDetails)内部的键进行排序。 - 递归修整所有字符串值的空格。
- 序列化为 JSON 字符串。
- 使用
openssl_sign(..., 'md5WithRSAEncryption')进行签名。 - 对二进制输出进行 Base64 编码。
验证签名 (GLODIPAY -> 商户)
使用 GLODIPAY 公钥(可在门户网站获取)。
步骤:
- 从 Payload 中移除
signature。 - 仅按自然升序对 顶层键 进行排序。不要对嵌套对象内部的键进行排序。
- 递归修整所有字符串值的空格。
- 序列化为 JSON 字符串。
- 使用
openssl_verify(..., base64_decode($signature), $publicKey, 'md5WithRSAEncryption')进行验证。 - 返回值
1= 有效。
注意 (Node.js):在排序/序列化之前将所有数字值转换为字符串。转义 JSON 字符串中的正斜杠:.replace(///g, '\/')。
POST PAYMENT
创建结账会话并重定向(或返回链接)到托管付款页面。
接口地址: POST /v2/checkout
请求方法: POST
Content-Type: application/x-www-form-urlencoded
请求参数
| merchantId | String(1,50) | M | 商户 ID |
| orderRef | String(1,250) | M | 每个商户唯一的交易参考号 |
| amount | Float | M | 发票金额。最小值:1。最多 2 位小数 |
| currency | String(3) | M | ISO 4217 货币代码。例如:USD |
| cancelUrl | String(1,300) | M | 取消时重定向买家的 URL。必须为 https。 |
| callbackUrl | String(1,300) | M | 付款成功后重定向买家的 URL。必须为 https。 |
| notificationUrl | String(1,300) | M | 您的服务器接收 IPN Webhook 的接口。必须为 https。 |
| errorUrl | String(1,300) | M | 出错时重定向买家的 URL。必须为 https。 |
| orderDescription | String(max:3000) | M | 在结账屏幕上显示的简短描述 |
| metadata | JSON | O | 附加到会话的键值对。在 IPN 和查询响应中返回 |
| transactionDocuments | JSON | O | 交易的辅助文档 |
| paymentMethod | String | M | 要显示的付款方式。请参阅 paymentMethod 取值 |
| paymentFilter | JSON | O | 要从会话中排除的付款方式类型值的数组 |
| paymentSorter | JSON | O | 控制显示顺序的有序数组。有效值:card, paypal, ibanking_push, local_bank_transfer, wire_transfer, wallet, skrill, alipay, wechat, googlepay, applepay, crypto, apm |
| feeBySeller | Number(0-100) | O | 商户支付的手续费百分比。0 = 买家支付 100%。最多 2 位小数 |
| billingFirstName | String(max:255) | O | 账单名字 |
| billingLastName | String(max:255) | O | 账单姓氏 |
| billingStreet1 | String(max:255) | O | 账单街道 1 |
| billingStreet2 | String(max:255) | O | 账单街道 2 |
| billingCity | String(max:255) | O | 账单城市 |
| billingEmail | String(max:255) | O | 买家电子邮件 |
| billingState | String(2,255) | O | 账单州/省 |
| billingCountry | String | O | ISO 3166-1 alpha-2 国家代码 |
| billingPostalCode | String(max:25) | O | 邮政编码 |
| billingPhoneCountryCode | String(max:10) | O | 电话国家代码。例如:美国为 1,印度为 91 |
| billingPhoneNumber | String(max:20) | O | 电话号码 |
| brandName | String(1,255) | O | 覆盖在托管结账屏幕上显示的品牌名称 |
| colorMode | String(1,255) | O | 最多 3 种颜色,用 --- 分隔。接受颜色名称、HEX 或 RGBA。例如:#2e7d32---#e8f5e9---#81c784 |
| logoSource | String(1,255) | O | 覆盖在托管结账屏幕上显示的 Logo |
| customerIp | String | O | 客户的 IP 地址 |
| websiteUrl | String(max:300) | O | 商户网站 URL |
| signature | String(max:750) | M | RSA-MD5 签名。请参阅“签名”部分 |
| connectionMode | String | O | DIRECT_POST 或 API |
| expiresAt | String | O | ISO 8601 格式的会话过期时间。例如:2025-09-14T14:03:42.102862Z。默认:24 小时 |
M = 必填,O = 可选
paymentMethod 取值
| ALL | 所有可用的付款方式 |
| APM | 除银行卡外的所有付款方式 |
| card | 信用卡 / 借记卡 |
| googlepay | Google Pay |
| applepay | Apple Pay |
| paypal | PayPal |
| ibanking_push | 即时在线银行转账 |
| local_bank_transfer | 国内银行转账 |
| wire_transfer | 直接电子汇款 |
| wallet | 数字钱包 |
| alipay | 支付宝 |
| 微信支付 | |
| skrill | Skrill |
| crypto | 加密货币 |
paymentFilter
要从会话中排除的付款方式类型值的 JSON 数组。
["googlepay", "applepay"]
请求示例
{
"merchantId": "1100000123",
"orderRef": "ORDER-001",
"amount": 100.00,
"currency": "USD",
"paymentMethod": "card",
"callbackUrl": "https://yoursite.com/callback",
"notificationUrl": "https://yoursite.com/webhook",
"cancelUrl": "https://yoursite.com/cancel",
"errorUrl": "https://yoursite.com/error",
"orderDescription": "Test order",
"billingFirstName": "John",
"billingLastName": "Doe",
"billingStreet1": "123 Main St",
"billingStreet2": "",
"billingCity": "New York",
"billingEmail": "john@example.com",
"billingState": "NY",
"billingCountry": "US",
"billingPostalCode": "10001",
"billingPhoneCountryCode": "1",
"billingPhoneNumber": "5551234567",
"brandName": " Client Form Simulate",
"colorMode": " rgba(224,230,5,1)---rgba(166,233,15,1)---rgba(105,193,28,1)",
"logoSource": "",
"customerIp": "1.2.3.4",
"connectionMode": "DIRECT_POST",
"signature": "base64-encoded-signature"
}
响应 -- connectionMode: API
Content-Type: application/json
| status | String | created |
| transactionId | String (ULID) | GLODIPAY 交易 ID |
| paymentLink | String | 已签名的 URL —— 将买家重定向到此 URL 以完成付款 |
| message | String | 人类可读的消息 |
成功示例:
{
"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 响应。