Alipay Wallet

Follow the standard PaymentsOS integration procedure, and then apply the relevant extra specifications in this section to integrate with Alipay.

API Version

Minimum required API version: 1.2.0

Requests

The following table lists all supported requests for ewallet-based transactions.

Use the bodybuilder to create a sample request body for each request type.

RequestPartial/MultipleModeNotes
Charge Both partial and multiple are supportedAsynchronousInstallments are not supported.
Refund Both partial and multiple are supportedSynchronousThe refund must be initiated within a certain time period after the payment, which is specified in your contract with Alipay. Usually, a 365-day period is specified.

Setup Procedures

The following table lists the setup procedures that are specific to this provider.

ConfigurationRequired/Optional
In the PaymentsOS Control Center, configure the following credentials:
  • client_id: Your Client ID defined on the Alipay Developer Center
  • merchant_id: The merchantID provided by Alipay.
  • private_key: The private key that PaymentsOS will use to encrypt the API requests on your behalf. You must generate a pair of asymmetric public and private keys using the RSA2 method. You then specify the private key in this field and submit the asymmetric public key on the Alipay Developer Center.
  • public_key: The public key that PaymentsOS will use to verify the API response from Alipay. This public key is provided by Alipay. Copy it from the Alipay Public Key field on the Alipay Developer Center.
Required

Integration Procedures

The following sections list the integration procedures that are specific to this provider.

Implementing the Payment Flow

As part of the payment flow, you must redirect customers to the Alipay page on which they can complete the transaction. The following image shows the high-level flow for integrating with Alipay.

Alipay Integration Flow

The steps in the flow are as follows:

  1. The customer clicks Pay.

  2. You implement a redirection flow (steps 2-6). This involves invoking the Create a Payment request followed by the Create Charge request, and redirecting customers to the Alipay page on which they can complete the transaction (we provide you with the Alipay site URL in the redirection object of the charge response data.)

  3. The customer completes the payment on the Alipay site; PaymentsOS notifies you when the status of the transaction changes and redirects the customer to your merchant_site_url on which you can display a payment completed message (steps 7-10).

Testing

You can use the credentials below for testing.

merchant_id: SANDBOX_merchant

client_id: SANDBOX_5Y68442YTN4E02502

public_key:

MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwrMqlUTW9Nb54VSr4X/9BkHA30z/rd4f2ClSWcFj8Ap8LkVgDYKmYRV+nrKZEE0jzxTR6iqgABzo3TDYarbXid6eR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