Appearance
直接支付订阅
请求地址:POST
/api/subscription
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
transactionId | String(128) | 必填 | 商户交易唯一 ID,一般用于防止1笔订单的重复提交 |
orderId | String(128) | 必填 | 商户订单 ID,可以多次请求重复但只能存在一笔成功交易 |
currency | String(3) | 必填 | 币种 (举例:CNY/USD) |
amount | Number(12,3) | 必填 | 交易金额 |
transactionIp | String(128) | 必填 | 持卡人交易 IP |
appId | Number(20) | 必填 | 系统->网站APP菜单->APP ID |
domain | String(128) | 选填 | 系统->网站APP菜单->主域名 |
callbackUrl | String(255) | 必填 | 3D/Checkout 回调 URL(一般用于处理面显示逻辑,比如跳转到原有的商品页面) |
notificationUrl | String(255) | 必填 | 异步通知 URL,此参数不为空,交易完成会往此地址发送通知(常用于处理订单状态) |
productInfos | Array | 必填 | 商品信息(ProductInfo详情) |
card | Object | 必填 | 卡信息(Card详情) |
extension | Object | 必填 | 订阅重要参数,请查看订阅详情 |
billingAddress | Object | 必填 | 注意:国家字段必填 账单信息(BillingAddress详情) |
shippingAddress | Object | 选填 | 邮寄信息(ShippingAddress详情) |
secure | Boolean | 选填 | 是否请求3D交易,true为走3D交易 |
browser | Object | 选填 | 3D交易必填,请求浏览器参数(Browser详情) |
请求实例
json
{
"transactionId": "123456",
"currency": "USD",
"amount": "8.88",
"appId": "123456",
"callbackUrl": "https://domain/callback",
"notificationUrl": "https://domain/notification",
"transactionIp": "127.0.0.1",
"productInfos": [
{
"productName": "Stonebriar Unscented Tea Light Candles with 6-7 Hour Burn Time - White, Pack of 100",
"currency": "USD",
"price": "8.88",
"sku": "123-456-789",
"quantity": 1,
"productLink": "https://domain/123-456-789"
}
],
"card": {
"expiredYear": "23",
"expiredMonth": "12",
"cardNumber": "4200000000000000",
"cardholder": "san zhang",
"cvv": "123"
},
"billingAddress": {
"firstName": "Gross",
"lastName": "Schmidt",
"country": "CA",
"email": "kael@gmail.com",
"city": "Longueuil",
"address": "3226 rue Saint-Charles",
"phone": "450-928-5752",
"state": "Quebec",
"zipCode": "J4H 1M3"
},
"shippingAddress": {
"firstName": "Gross",
"lastName": "Schmidt",
"country": "CA",
"email": "kael@gmail.com",
"city": "Longueuil",
"address": "3226 rue Saint-Charles",
"phone": "450-928-5752",
"state": "Quebec",
"zipCode": "J4H 1M3"
},
"browser": {
"userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.24 Safari/537.36 Edg/83.0.478.18",
"referer": "https://www.domain.com"
},
"extension": {
"subscriptionCycle": "WEEK",
"subscriptionPeriod": 3
}
}返回实例
请求成功
json
{
"code": 100,
"isTest": true,
"appId": 123456,
"uniqueId": "1669548151356891137",
"billDescription": "*Description",
"message": "successful transaction",
"timestamp": 1686886273516,
"transactionAmount": "8.88",
"transactionAt": "2023-06-16 11:31:12",
"transactionCardNumber": "420000******0000",
"transactionCurrency": "USD",
"transactionId": "123456",
"transactionMessage": "Approved"
}请求成功后,使用redirectUrl跳转3D
json
{
"code": 301,
"isTest": true,
"appId": 123456,
"uniqueId": "1669548151356891137",
"billDescription": "*Description",
"message": "order processing",
"timestamp": 1686886273516,
"transactionAmount": "8.88",
"transactionAt": "2023-06-16 11:31:12",
"transactionCardNumber": "420000******0000",
"transactionCurrency": "USD",
"transactionId": "123456",
"transactionMessage": "Redirect",
"redirectUrl": "https://domain/redirect/a6354c630cba488caa56a0113bb0ef34"
}请求失败
json
{
"code": 101,
"isTest": true,
"appId": 123456,
"uniqueId": "1669548151356891137",
"billDescription": "*Description",
"message": "transaction failed",
"timestamp": 1686886273516,
"transactionAmount": "8.88",
"transactionAt": "2023-06-16 11:31:12",
"transactionCardNumber": "420000******0000",
"transactionCurrency": "USD",
"transactionId": "123456",
"transactionMessage": "Do not honor"
}