Apple Pay(Optional)
Apple Pay 采用两步调用:
- 先创建订单并获取
applePayParams - 用户完成 Apple Pay 授权后,再提交 token 完成支付
创建 Apple Pay 订单
Endpoint
POST {BASE_URL}/api/v2.0/payments/apple-pay/preOrder
创建 Apple Pay 订单,并返回客户端拉起 Apple Pay 所需的支付参数。
Apple Pay PreOrder Request Body
{
"paymentRequestId": "string",
"merchantIdentifier": "merchant.com.example.applepay",
"order": {
"orderAmount": {
"value": "1",
"currency": "CAD"
},
"description": "Apple Pay 测试订单",
"notifyUrl": "https://www.example.com/notify"
}
}
Apple Pay PreOrder Response
{
"paymentRequestId": "string",
"paymentId": "string",
"paymentCreateTime": "2019-08-24T14:15:22Z",
"paymentExpireTime": "2019-08-24T14:45:22Z",
"applePayParams": {
"orderId": "string",
"merchantIdentifier": "merchant.com.example.applepay",
"countryCode": "CA",
"currencyCode": "CAD",
"label": "Demo Merchant",
"amount": "0.01",
"supportedNetworks": ["visa", "masterCard", "amex"],
"merchantCapabilities": ["supports3DS", "supportsCredit", "supportsDebit"]
},
"result": {
"resultCode": "PAYMENT_IN_PROCESS",
"resultMessage": "string",
"resultStatus": "U"
}
}
提交 Apple Pay Token
Endpoint
POST {BASE_URL}/api/v2.0/payments/apple-pay/pay
用户完成 Apple Pay 授权后,提交 Apple Pay token 发起支付。
Apple Pay Pay Request Body
{
"paymentId": "string",
"customerId": "string",
"token": {
"transactionIdentifier": "string",
"paymentMethod": {
"displayName": "Visa 1234",
"network": "Visa",
"type": "debit"
},
"paymentData": {
"version": "EC_v1",
"data": "string",
"signature": "string",
"header": {
"publicKeyHash": "string",
"ephemeralPublicKey": "string",
"transactionId": "string"
}
}
}
}
Apple Pay Pay Response
{
"paymentRequestId": "string",
"paymentId": "string",
"paymentStatus": "SUCCESS",
"paymentTime": "2019-08-24T14:16:22Z",
"transactionId": "string",
"result": {
"resultCode": "SUCCESS",
"resultMessage": "string",
"resultStatus": "S"
}
}