GooglePay 订阅支付集成
Google Pay 支持订阅支付模式,允许商户为用户设置定期自动扣费服务。
# 集成流程
# Step1 首笔支付(跳转收银台模式)
首次订阅支付需要通过跳转收银台模式完成,用于建立订阅关系并获取支付令牌。使用统一下单接口。
关键参数说明:
| 参数名称 | 参数说明 | 是否必填 |
|---|---|---|
merchantUserId | 商户用户唯一标识 | 必填 |
createToken | 是否创建支付令牌,固定值"Y" | 必填 |
bizType | 业务类型,固定值"CodeGrant" | 必填 |
完整请求示例:
{
"acquirerType": "CHECKOUT",
"accId": "2023042011040310224447",
"amount": "200",
"currency": "USD",
"requestId": "PMR-1751341863982",
"merchantTransactionId": "PMT-1751341863982",
"paymentType": "DEBIT",
"bizType": "codeGrant",
"merchantUserId": "126048960513465",
"createToken": "Y",
"notificationUrl": "https://test-acquirerpay.pingpongx.com/qa/notify",
"shopperResultUrl": "https://test-acquirerpay.pingpongx.com/qa/result.html",
"signType": "SHA256",
"sign": "C1BD5DA4963B6A8DFB3E1678835903972BDBF2EC57C90C209D08F577A7028370",
"paymentBrand": "GooglePay",
"customer": {
"firstName": "May",
"lastName": "Rally",
"email": "test@pingpongx.com"
},
"goods": [
{
"name": "商品名称mepsking1",
"description": "商品描述",
"sku": "产品SKU111",
"averageUnitPrice": "1",
"number": "10",
"imgUrl": "https://xiu.mepsking.top/material/1/16606169805015585.png"
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
完整响应示例:
{
"accId": "2023042011040310224447",
"clientId": "2023042011040310224",
"code": "001000",
"description": "Successful request",
"innerJsUrl": "https://pay-cdn.pingpongx.com/production-fra/static/pp-checkout/sandbox/pp-checkout.js?token=EU:_4yVcxYyb2iT7VF_gTIZJUrWIrUCkm_tBzCbNBSvTmHkj8Rz2lqLm71wzJHwa06z",
"merchantTransactionId": "PMT-1751341863982",
"paymentUrl": "https://sandbox-safepay.pingpongx.com?token=EU:_4yVcxYyb2iT7VF_gTIZJUrWIrUCkm_tBzCbNBSvTmHkj8Rz2lqLm71wzJHwa06z",
"sign": "E9AEDC04B92D52670C30F23D320331A3C9DD844BF2666AF55259031397B08FF4",
"signType": "SHA256",
"token": "EU:_4yVcxYyb2iT7VF_gTIZJUrWIrUCkm_tBzCbNBSvTmHkj8Rz2lqLm71wzJHwa06z"
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
订阅支付特殊参数:
| 参数名称 | 参数值 |
|---|---|
bizType | "CodeGrant" |
createToken | "Y" |
merchantUserId | "126048960513465" |
# Step2 获取支付令牌
首笔支付成功后,系统会通过交易异步通知返回支付令牌(token)。
重要提醒
- 只有首次交易状态为
SUCCESS时才能获取有效的支付令牌 - 请妥善保存令牌,用于后续自动扣费
- 令牌与
merchantUserId绑定,请确保一致性
# Step3 后续自动扣费
使用获取的令牌进行后续自动扣费,调用统一下单接口。
关键参数:
| 参数名称 | 参数说明 | 是否必填 |
|---|---|---|
bizType | 业务类型,固定值"CodeGrant" | 必填 |
merchantUserId | 与首笔支付保持一致 | 必填 |
token | 从首笔支付异步通知中获取 | 必填 |
二次扣款请求示例:
{
"acquirerType": "PAY",
"accId": "2023042011040310224447",
"amount": "200",
"currency": "USD",
"requestId": "PMR-1751342011386",
"merchantTransactionId": "PMT-1751342011386",
"paymentType": "DEBIT",
"bizType": "CodeGrant",
"merchantUserId": "126048960513465",
"tokenDetail": {
"token": "81cf697a30731d407b87b680e044a351"
},
"notificationUrl": "https://test-acquirerpay.pingpongx.com/qa/notify",
"shopperResultUrl": "https://test-acquirerpay.pingpongx.com/qa/result.html",
"signType": "SHA256",
"sign": "AEE09B1E621D1FA230CD7D098E77AFD08D8D4F34A7D667D07D4D99759D4E9074",
"paymentBrand": "GooglePay",
"customer": {
"firstName": "May",
"lastName": "Rally",
"email": "test@pingpongx.com"
},
"goods": [
{
"name": "商品名称mepsking1",
"description": "商品描述",
"sku": "产品SKU111",
"averageUnitPrice": "1",
"number": "10",
"imgUrl": "https://xiu.mepsking.top/material/1/16606169805015585.png"
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
二次扣款响应示例:
{
"accId": "2023042011040310224447",
"amount": "200.000000",
"authenticationInfo": {
"avsResult": "Unknown",
"cvvResult": "Y",
"threeDSecure": "N"
},
"cardInfo": {
"cardLevel": "",
"cardType": "CREDIT",
"firstSixDigits": "411111",
"isoCountry": "UNITED STATES",
"isoCountryA2": "US",
"issuringBank": "JPMORGAN CHASE BANK, N.A.",
"lastFourDigits": "1111",
"paymentBrand": "VISA"
},
"checkoutType": "",
"clientId": "2023042011040310224",
"code": "000000",
"currency": "USD",
"description": "Transaction succeeded",
"issuerInfo": {},
"language": "en",
"merchantTransactionId": "PMT-1751342011386",
"notificationUrl": "https://test-acquirerpay.pingpongx.com/qa/notify",
"paymentBrand": "GooglePay",
"paymentType": "DEBIT",
"relateTransactionId": "2025070150157026",
"shopperResultUrl": "https://test-acquirerpay.pingpongx.com/qa/result.html",
"sign": "AA6217D4AD67D2AAB119E6FE85E1F9D25DAE936F6A1E0DB63D0E1D1C272234E9",
"signType": "SHA256",
"status": "SUCCESS",
"token": "81cf697a30731d407b87b680e044a351",
"transactionId": "2025070110114853",
"transactionTime": "1751342013000"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
二次扣款特殊参数:
| 参数名称 | 参数值 |
|---|---|
bizType | "CodeGrant" |
merchantUserId | "126048960513465" |
token | "81cf697a30731d407b87b680e044a351" |
# 注意事项
- 令牌管理:支付令牌有效期为20年,请关注令牌状态并及时处理失效情况
- 订阅周期:合理设置订阅周期,避免过于频繁的扣费
- 用户体验:建议在订阅前明确告知用户扣费规则和取消方式
- 异常处理:做好扣费失败的处理逻辑,如重试机制、用户通知等
上次更新: 2025/07/01, 15:03:26