Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

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.

copy
{
  "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.

copy
{
    "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
Order information, such as buyer information, merchant information, order description, and order amount. 

The parameter is also used for risk control, supervision, reporting, and the user payment result display, and so on.

4

paymentAmount

MANDATORY Amount
The payment amount that merchant requests to receive in the order currency. 

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
The payment amount that merchant requests to receive in the order currency. 

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: 

No.resultCoderesultStatusresultMessage

1

SUCCESS

S

Success

2

PROCESS_FAIL

F

A general business failure occurred. Don't retry.

3

PARAM_ILLEGAL

F

Illegal parameters exist. For example, a non-numeric input, or an invalid date.

4

KEY_NOT_FOUND

F

The key is not found.

5

ACCESS_DENIED

F

Access denied

6

REQUEST_TRAFFIC_EXCEED_LIMIT

U

The request traffic exceeds the limit.

7

API_INVALID

F

API is invalid or not active.

8

CLIENT_INVALID

F

The client is invalid.

9

SIGNATURE_INVALID

F

The signature is invalid.

10

METHOD_NOT_SUPPORTED

F

The server does not implement the requested HTTP method.

11

MEDIA_TYPE_NOT_ACCEPTABLE

F

The server does not implement the media type that is acceptable to the client.

12

REPEAT_REQ_INCONSISTENT

F

Repeated requests are inconsistent.

13

UNKNOWN_EXCEPTION

U

An API calling is failed, which is caused by unknown reasons.