Create
URL: /v1/payments/create
Use this interface to get a payment token from Alipay. Merchants can pass the payment token to Alipay Checkout SDK to submit a payment of the user.
Sample
1. The merchant submits a create request to Alipay.
{
"order": {
"orderAmount": {
"currency": "USD",
"value": "100"
},
"orderDescription": "Mi Band 3 Wrist Strap Metal Screwless Stainless Steel For Xiaomi Mi Band 3",
"referenceOrderId": "102775745075669",
"shipping": {
"shippingAddress": {
"address1": "400 El Camino Real",
"address2": "suit 107",
"city": "San Mateo",
"region": "US",
"state": "California",
"zipCode": "95014"
}
}
},
"paymentAmount": {
"currency": "USD",
"value": "100"
},
"paymentNotifyUrl": "https://www.merchant.com/payNotify",
"paymentRedirectUrl": "https://www.merchant.com/paymentResult.htm?orderId=pay_1089760038715669_102775745075669",
"paymentRequestId": "pay_test_1106_0002",
"productCode": "CASHIER_PAYMENT"
}
2. Alipay returns the payment processing result to Merchant.
{
"paymentAmount": {
"currency": "PHP",
"value": "100"
},
"paymentRequestId": "pay_test_1106_0002",
"paymentToken": "pay_test_1106_0002_YozRk12DfcvB77aisxhHGKwBT0HOo74m9ZyX",
"result": {
"resultCode": "SUCCESS",
"resultMessage": "success.",
"resultStatus": "S"
}
}
Structure
Request parameters
No. | Field | Description |
1 | productCode | MANDATORY ProductCodeType The payment product that the merchant can use, based on the contract between the merchant and Alipay. |
2 | paymentRequestId | MANDATORY String (64) The unique ID that is assigned by a merchant to identify a payment request. Special characters are not supported. |
3 | order | MANDATORY Order The parameter is also used for risk control, supervision, reporting, and the user payment result display, and so on. |
4 | paymentAmount | MANDATORY Amount |
5 | paymentRedirectUrl | MANDATORY URL (2048) The URL that the user is redirected to after the payment is completed |
6 | paymentNotifyUrl | MANDATORY URL (2048) The URL that is used to receive the payment result notification |
Response parameters
No. | Field | Description |
1 | result | MANDATORY Result The request result, which contains information related to the request result, such as status and error codes. |
2 | paymentRequestId | OPTIONAL String (64) The unique ID that is assigned by a merchant to identify a payment request. Special characters are not supported. |
3 | paymentId | OPTIONAL String (64) The unique ID that is assigned by Alipay to identify a payment. If this field is not returned, use the Payment Result Inquiry or Payment Result Notification interface to get the payment ID. |
4 | clientPaymentToken | OPTIONAL String The client side token, which is used to complete a payment by Alipay SDK on the web page. For example, pay_test_1106_0002_YozRk12DfcvB77aisxhHGKwBT0HOo74m9ZyX. Note: When the result status of this interface calling is success, this field is returned. Otherwise, this field is not returned. |
5 | paymentAmount | MANDATORY Amount |
6 | redirectActionForm | OPTIONAL RedirectActionForm Provides information about the redirection action. |
Result
Result code
This section helps you identify and resolve problems. See the following table for details: