Alipay
Start accepting payments using Alipay, a favorite payment method in China.
Alipay provides a method to make purchases online through quick and easy bank transfers that are not only secure but guaranteed.
To start accepting Alipay payments, please contact your customer success manager.
Process an Alipay payment
Alipay payments follow a two-step process:
Step 1: Request an Alipay payment
The request
Use the details below to set up your request.
Endpoints
Live
Sandbox
Header parameters
Header | Value |
---|---|
|
|
|
|
Body parameters
The table below describes the minimum recommended fields. You can find the full list, as well as complete request and response examples, in our API reference.
Field name | Description |
---|---|
| Details about the payment source. |
| The type of payment source. Set this to |
| The payment amount. Omitting the amount or providing 0 will perform a card verification. |
| The three-letter ISO currency code.\ Currently, we only support USD. |
Request example
{
"source": {
"type": "alipay"
},
"amount": 2000,
"currency": "USD"
}
If a customer ID or email is not provided in the request, then we automatically create a customer profile and return the customer
id
in the response.
The response
If a payment id is returned, then your request was successful.
Response example
{
"id": "pay_wu2hdjkzookuji3i2xai2ienlm",
"status": "Pending",
"customer": {
"id": "cus_j4o4tigv4vaebednks3gafrwk4"
},
"_links": {
"self": {
"href": "https://sandbox.checkout.com/api2/payments/pay_wu2hdjkzookuji3i2xai2ienlm"
},
"redirect": {
"href": "https://sandbox.checkout.com/LP.Core/api/payment/108674"
}
}
}
Step 2: Redirect the customer
Redirect your customer to the redirect
link’s href in the response to Step 1. The redirect transfers the customer to their bank's website where they are required to enter their authorization details; if successful, the payment can be approved.
Once completed, the customer is transferred to your predefined success or failure URL. Confirmation of an Alipay payment is communicated only through webhooks. When you receive a payment_captured
webhook notification, the transaction has been completed successfully. Until the payment_captured
webhook is received (response code 10000
), all payments are labeled as Pending.
Get details about an Alipay payment
You can retrieve details about an existing Alipay payment.
The request
Use the details below to set up your request.
Endpoints
Live
Sandbox
Header and path parameters
Header | Value |
---|---|
|
|
Path | Value |
---|---|
| The payment ID found in the response of the initial payment. |
The response
Response example
{
"id": "pay_wu2hdjkzookuji3i2xai2ienlm",
"requested_on": "2018-11-22T15:02:13Z",
"source": {
"type": "alipay"
},
"amount": 1,
"currency": "USD",
"payment_type": "Regular",
"status": "Pending",
"risk": {
"flagged": false
},
"customer": {
"id": "cus_j4o4tigv4vaebednks3gafrwk4"
},
"_links": {
"self": {
"href": "https://api.sandbox.checkout.com/payments/pay_wu2hdjkzookuji3i2xai2ienlm"
}
}
}
Refund an Alipay payment
Alipay supports both partial and full refunds. You can refund a payment through the Hub or using the refund API.
Cancel an Alipay payment
If the customer cancels or fails to complete the transaction at any point after the payment is created, it will automatically be voided, and we'll send you a payment_voided
webhook.
Testing Alipay
To start testing, you'll need to:
- create a test account, and
- contact your customer success manager or integrations engineer to activate Alipay payments in the sandbox environment.
Step 1: Create an Alipay transaction as above, following the redirect link in the response to Alipay's website.
Step 2: Click the button on the right and log in with the following details:
     -   Username: [email protected]
     -   Password: 111111

Click on the image to zoom.
Step 3: Solve the captcha and then click the blue button at the bottom of the form to continue.

Click on the image to zoom.
Step 4: Enter 111111 into the box and then click the blue button to complete the payment.

Click on the image to zoom.
Step 5: You should then be redirected to your predefined success URL.
Can we help?
Thanks for using Checkout.com. If you need any help or support, then message our support team at [email protected].
Updated 5 months ago