Quickstart
This quickstart guides you through the integration process of Cashier Payment using Alipay+ APIs.
If you use the JAR file provided by Alipay+, add the dependency to your project.
To configure requests, obtain the following information first:
- Log in to Alipay+ Dashboard. Go to Developers > Quickstart, find Integration resources, and get the following details:
-
- Gateway domain name
- Client ID
- API keys: You need to generate keys yourself. For more information about how to generate or replace keys, see API key configuration.
- API path: Get the path for a specific API in Alipay APIs.
Then configure the obtained gateway domain name, Client ID, API keys, and API path to your API request.
Note: If you use the JAR file provided by Alipay+, you can use the codes directly without additional processing. If you prefer to sign a request and verify the signature by yourself, see Sign a request and verify the signature.
Create a checkout page on your client to display the goods ID, order information, available payment methods, the payment button, and other payment information.
Add payment methods on your checkout page:
- Name: Refer to Payment methods to check the correct payment method names.
- Logo: Use Brand asset to obtain payment method logos.
Note: For Alipay+ payment methods, you must display the Alipay+ Partner logo as in the picture.
When initiating a pay request, you need to pass in the following URLs:
- paymentRedirectUrl: Your payment result page URL. Alipay+ redirects the buyer to this URL after the payment is completed. Pass in the required redirect URL types for different client-side terminals:
-
- Web: Pass in a PC website redirect URL.
- WAP: Pass in a web URL redirect URL.
- App: Pass in a deep link URL.
- paymentNotifyUrl: Alipay+ sends the payment and capture results to this URL after the payment and capture reaches a final status. Specify paymentNotifyUrl as an HTTPS URL and make sure that the URL can receive notifications.
After the buyer clicks the payment button, initiate the pay request using the alipayPayRequest object created in the Configure requests step.
Refer to samples in the code editor according to the following different payment types:
- Non-card payment: includes payments of the following payment method categories:
-
- Alipay+
- Wallet
- Online banking
- Bank transfer
- Mobile banking app
- Card Payment (hosted payment page mode): In this mode, Alipay+ provides a page for collecting card payment information. If the buyer chooses to save the card on the page, Alipay+ stores the buyer's card information and generates a corresponding card token (cardToken). You can use the card token for future payments.
- Card Payment (server-to-server mode): This mode requires that you are PCI-qualified.
Additionally, for card payments, when sending a pay request, you can also choose whether to use value-added features according to your business needs.
For specific payment requirements of different payment methods, see the pay API.
When receiving the pay response from Alipay+, handle the payment result according to the value of result.resultStatus:
- result.resultStatus=
S
: indicates that the payment was successful. Display the buyer the payment success result. - result.resultStatus=
F
: indicates that the payment failed. Display the buyer the payment failure result. - result.resultStatus=
U
: indicates that the payment is in process. Redirect the buyer to the URL returned by Alipay+.
Handle the redirect URL
When the value of result.resultStatus is U
, at least one of the following URLs is returned:
- normalUrl: The URL of an HTTPS address, used to redirect the buyer to the website page of the payment method on the same browser page of your website. Note that this URL may include a button to invoke the payment method App.
- schemeUrl: The scheme URL that is used to open a payment method app.
- applinkUrl: The Android App Link or iOS Universal Link that is used for redirection in the payment process.
Handle the URLs based on different terminal types (Web, WAP, and App) and operating systems (iOS and Android).
Alipay+ sends you an asynchronous notification when the payment reaches a final status of success or failure. Make sure that paymentNotifyUrl that you provide through the pay API can receive notifications.
When you receive the payment result notification, follow the steps below to handle it:
- Verify the notification.
- Update your order status.
- Send a notification response to Alipay+ following the fixed format shown in the code editor. You do not need to sign the response.
Alipay+ automatically captures funds for you after the buyer completes the card authorization payment. When the capture reaches a final status of success or failure, Alipay+ sends an asynchronous notification to you. Make sure that paymentNotifyUrl that you provide through the pay API can receive notifications.
When you receive the capture result notification, follow the steps below to handle it:
- Verify the notification.
- Update your order status.
- Send a notification response to Alipay+ following the fixed format shown in the code editor. You do not need to sign the response.