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
Step 1. Initialize a payment Intent
Create a PaymentIntent object with a request_id
, amount
, currency
and 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.
Step 2. Redirect to WeChat App to complete payment
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
Request:
Response:
- 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.