Mobile Browser (H5)
Accept WeChat Pay on your mobile website by redirecting shoppers to WeChat App. See checkout experience as below.
- The shopper chooses to pay with WeChat Pay and the shopper will be redirected to WeChat Pay App
- The shopper completes payment in WeChat Pay App
- Payment succeeds and the shopper is redirected back to the mobile browser page you designated
To use WeChat H5 payment, extra offline review process is required, please contact your account manager for detailed information
Create a PaymentIntent object with a
merchant_order_id from your backend server. Provide
return_url to specify where shoppers will be redirected to both for cancelled payment and succeeded payment scenarios . Please note that the first level domain name of the return_url and the url you use to pull up the WeChat Pay shall both be aligned with the one you submitted to WeChat in the offline review process.
To be able to display WeChat Pay as a payment option on your checkout page, you need to get available payment methods from Airwallex API.
When the PaymentIntent is created, send a
GET request with parameters
transaction_mode to API endpoint
/api/v1/pa/config/payment_method_types to query for a list of available payment method based on the information provided. The response will also contain the required fields and necessary resources of each payment method for you to display them on your page.
Response: Render payment methods in
items to show all available payment methods to the shopper at checkout page.
Alternatively, you can maintain available payment methods and corresponding resources locally on your server if you do not want to use this API endpoint. However, we highly recommend you get available payment methods dynamically from this API to avoid any trouble when payment method information or resources get updated.
When a shopper selects to pay with WeChat Pay on their mobile browser, call the following API endpoints to get a e-wallet cashier URL (next_action.url in API response), which you can redirect the shopper to WeChat App to complete payment.
- Obtain URL from Airwallex and redirect shopper to WeChat App
- Wait for notification from Airwallex
Airwallex will notify you on the payment result asynchronously via the webhook API. Please refer to webhook documentation to set up your webhook accordingly. Although subscribing to different events is optional, it is recommended to at least subscribe to the ‘payment_intent.succeeded’ which indicates that the shopper has successfully paid for the order via WeChat Pay.
- Query the PaymentIntent status
You may also query the status of a payment anytime via the PaymentIntents API
WeChat Pay also support H5 flow from App, Please do add the the domain name you registered in WeChat Pay system as the referer when you request WeChat payment via the url we returned to you. If no, you cannot pull up WeChat App successfully.
To realize the scheme redirect, you shall use app-embedded browser to pull up WeChat Pay. Also, extra offline sheet needs to be filled and please wait WeChat to deploy configuration for you. In this case, you don’t need to pass return_url when creating PaymentIntent.