Process Payments via REST API for WooCommerce.

Alipay Payments with Stripe Sources

Use Stripe Sources to accept payments using Alipay, the most popular payment method in China.

Before you can use Alipay, you must activate it in the Stripe Dashboard. Your use of Alipay must be in accordance with Stripe’s Alipay Terms of Service. To create reusable Alipay sources, Contact Stripe.

Before you Start

Please make sure you have followed Getting Started and know the basics.

Also, check it out our Demo Shop, place an test order,

It will help your understanding of the WorkFlow.

Installation & Setup

For installation, install & activate WooCommerce Stripe Payment Gateway and WC REST Payment - Stripe Gateway from you wp-admin Dashboard.

You can enable or disable it in your wp-admin Dashboard.

  1. Visit WooCommerce > Settings
  2. Click Payments tab
  3. Toggle the switch in Enabled column
  4. Click Save Changes
  5. Click Set Up and follow the instructions.

For help setting up and configuring, please refer to the user guide

Stripe Alipay Workflow

Stripe users can use Sources—a single integration path for creating payments using any supported method—to accept Alipay payments from customers in China. For more information, please see: Alipay Payments with Sources.

Here’s how Stripe Alipay works WooCommerce and WC REST Payment.

  1. Create a Source object
  2. (Done by Customer) The customer complete authorization
  3. (Done Automatically) Charge the Source
  4. (Done Automatically) Confirm that the charge has succeeded

Let’s dive in!

Step 1: Create a Authorization URL for Source

If you have already created Source object using

Please skip to Step 2.

Otherwise, you need to created Source object using REST API.

URL HTTP payment_method
/wp-json/wc/v2/process_payment POST stripe_alipay


POST: /wp-json/wc/v2/process_payment

  "order_id": 65,
  "payment_method": "stripe_alipay",
  "stripe_source": "src_xxxxxxxxxxxxx"
Parameter Description
order_id ID of an existing WooCommerce Order Object, without the #.
payment_method Each WooCommerce Payment Gateway has a unique ID. You can find the corresponding payment_method above.
stripe_source Optional, If your have already obtained Source Object, pass it with stripe_source. This will trigger WC REST Payment to process the payment immediately, instead of returning a Source Authentication URL.


If the request was successful.

You will receive a response similar to the following.

    "code": 200,
    "message": "Payment Successful.",
    "data": {
        "result": "success",
        "redirect": "https://hooks.stripe.com/redirect/authenticate/src_1ECFVpKmJqjdvKCnXXXxxXXX?client_secret=src_client_secret_Efahl1iQhrBCXXXXXXXXXXXX"

If ‘stripe_source’ was set in the request body, The redirect contains the url to Order Confirmation page.

If ‘stripe_source’ was NOT set in the request body, The redirect contains the url to Alipay Authorization page.

If the request failed.

You will receive a response similar to the following.

    "code": 403,
    "message": "Order status is 'processing', meaning it had already received a successful payment. Duplicate payments to the order is not allowed. The allow status it is either 'pending' or 'failed'. ",
    "data": {
        "status": 400

The message contains the error message and how to fix it.

Step 2: Redirect the customer to complete Authorization

Redirect your customer to the url returned above in redirect. Customer will provide authorization on Alipay’s page (Don’t worry, they know how).

Step 3: Charge the Source

Upon authorization (or cancellation), the customer will be redirected back.

WC REST Payment will automatically charge the source.

Step 4: Confirm that the charge has succeeded

If the charge is successful,

  • Your customer will be automatically redirected a ‘Order Confirmation’ page.
  • Your WooCommerce Order status will be updated from pending to processing.

If the charge is unsuccessful,

  • Your customer will see the error on the checkout page
  • You will see the error on the WooCommerce -> Status -> Log,


That’s it! Easy right? Here’s a quick summary.

  1. Send a REST API POST Request to /wp-json/wc/v2/process_payment
  2. Include a JSON Body with order_id and process_payment as ‘stripe_alipay’
  3. Redirect your customer to Alipay for Authorization
  4. All done! The rest happens automatically!

Next Step

There’re a lot more Gateways that WC REST Payment supports!

Check out more WC REST Payment Gateways here!