No momento, esta página não está disponível em português
Payment-method icon

WeChat Pay Component

Add WeChat Pay to an existing Components integration.

If you are using Android Components v5.0.0 or later:

This payment method requires no additional configuration.

Follow the Android Components integration guide and use the following module and Component names:

WeChat Pay is supported from Android Components version 3.5.0 and later. For more information, see release notes.

Our WeChat Pay Component triggers the app switch from your app to the WeChat app on the shopper's device.

Before you begin

This page explains how to add WeChat Pay to your existing Android Components integration. The Android Components integration works the same way for all payment methods. If you haven't done this integration yet, refer to our Components integration guide.

Before starting your WeChat Pay integration:

  1. Make sure that you have set up your back end implementation for making API requests.
  2. Add WeChat Pay in your test Customer Area.
  3. Create a developer account on the WeChat Open Platform.
  4. Register your mobile app with WeChat.

Start a payment with WeChat Pay

To start a payment with WeChat Pay, you need to:

  1. Specify in your /paymentMethods request:

  2. Deserialize the response from the /paymentMethods call and get the object with type: wechatpaySDK.

  3. Add the WeChat Pay module:

    a. Import the WeChat Pay module to your build.gradle file.

    implementation "com.adyen.checkout:wechatpay:<latest-version>"

    Check the latest version on GitHub.

    b. Check if WeChat is available on the shopper's device.

       // WeChatPayProvider is not an actual provider, it only checks whether WeChat Pay is available.
       val weChatPayProvider = WeChatPayProvider()
       weChatPayProvider.isAvailable(application, paymentMethod, null) { isAvailable: Boolean, paymentMethod: PaymentMethod, _ ->
           if (isAvailable) {
               // show WeChat pay as a payment option in your app

    c. If WeChat is available and the shopper chooses to pay with WeChat Pay, make a /payments request from your server.

Make a payment

  1. From your server, make a /payments request:

    The /payments response includes an action object that contains information about the app switch.

  2. Pass the action object to your client app.

Handle the app switch

  1. To switch the shopper to the WeChat app, initialize the WeChat Pay Action Component, and pass the action object.

      val weChatPayActionConfiguration = WeChatPayActionConfiguration.Builder(this, "YOUR_CLIENT_KEY")
          // When you're ready to accept live payments, change the value to one of our live environments.
      val weChatPayActionComponent = WeChatPayActionComponent.PROVIDER.get(this, application, weChatPayActionConfiguration)
      weChatPayActionComponent.handleAction(this@YourActivity, action)

    After the shopper has completed the payment, the WeChat app redirects them back to your app, and provides an Intent object containing the result of the payment.

  2. Get the result of the WeChat Pay SDK from the Activity. Pass the intent back to the WeChat Pay Action Component. Depending on your activity's launchMode, you can get this intent in either onCreate or onNewIntent.

    private fun handleIntent(intent: Intent) {
        if (WeChatPayUtils.isResultIntent(intent)) {

    The Component notifies the observer with the actionComponentData.

  3. Pass the actionComponentData to your server.

    wechatPayActionComponent.observe(this) { actionComponentData ->
      // Send a /payments/details/ call containing the `actionComponentData`

Check the payment result

When the shopper returns to your app, the Component provides the actionComponentData.

  1. Pass the actionComponentData to your server.
  2. From your server, make a /payments/details request containing the actionComponentData.

Present the payment result

Use the resultCode that you received in the /payments/details response to present the payment result to your shopper.

The resultCode values you can receive for WeChat Pay are:

resultCode Description Action to take
Authorised The payment was successful. Inform the shopper that the payment has been successful.
You will receive the funds in 2-3 days.
Error There was an error when the payment was being processed. Inform the shopper that there was an error processing their payment. The response contains a refusalReason, indicating the cause of the error.
Pending or
The payment order was successfully received. Inform the shopper that you've received their order, and are waiting for the payment to clear.
You will receive the final result of the payment in an AUTHORISATION webhook. If successful, you will receive the funds in 2 days.
Refused The payment was refused by the shopper's bank. Ask the shopper to try the payment again using a different payment method.

Test and go live

WeChat Pay currently has no test platform. If you have a personal WeChat account you can test your integration by either:

  • Canceling the transaction when you are asked to verify the payment (recommended).
  • Making live WeChat Pay payments with a low value.

You can check the status of a WeChat Pay payment in your Customer Area > Transactions > Payments.

Before you can accept live WeChat Pay payments, you need to submit a request for WeChat Pay in your live Customer Area.

See also