---
title: "WeChat Pay Drop-in integration"
description: "Add WeChat Pay to an existing Drop-in integration."
url: "https://docs.adyen.com/payment-methods/wechat-pay/wechat-pay-in-app-payments/android-drop-in"
source_url: "https://docs.adyen.com/payment-methods/wechat-pay/wechat-pay-in-app-payments/android-drop-in.md"
canonical: "https://docs.adyen.com/payment-methods/wechat-pay/wechat-pay-in-app-payments/android-drop-in"
last_modified: "2019-07-04T10:57:00+02:00"
language: "en"
---

# WeChat Pay Drop-in integration

Add WeChat Pay to an existing Drop-in integration.

[View source](/payment-methods/wechat-pay/wechat-pay-in-app-payments/android-drop-in.md)

This page explains how to add to your existing Android Drop-in integration.

**If you are using Android Drop-in v5.0.0 or later:**

This payment method requires no additional configuration.

Follow the [Drop-in integration guide](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Drop-in).

WeChat Pay is supported from Android Drop-in version **3.5.0** and later. For more information, see [release notes](/online-payments/release-notes).

Our [Android Drop-in](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Drop-in) renders WeChat Pay in your payment form, and triggers the app switch from your app to the WeChat app on the shopper's device.

## Requirements

| Requirement          | Description                                                                                                                                                                 |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Integration type** | Make sure that you have built an Advanced flow [Android Drop-in integration](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Drop-in). |
| **Setup steps**      | Before you begin, [add in your Customer Area](/payment-methods/add-payment-methods).                                                                                        |

## Preparation

1. [Create a developer account](/payment-methods/wechat-pay/wechat-pay-in-app-payments/enable-wechat-pay#create-developer-account) on the WeChat Open Platform.
2. [Register your mobile app](/payment-methods/wechat-pay/wechat-pay-in-app-payments/enable-wechat-pay#register-mobile-app) with WeChat.

## Show WeChat Pay in your payment form

Drop-in uses the `countryCode` and the `amount.currency` from your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request to show the available payment methods to your shopper.

To show WeChat Pay in your payment form, specify in your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request:

* [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods): Any supported country/region. For example, **CN**.
* [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount): Any supported currency. For example, **CNY**.

WeChat Pay is only shown in the payment form if WeChat app is available in the shopper's device.

## Make a payment

When the shopper proceeds to pay, Drop-in returns the `paymentComponentData.paymentMethod`.

1. Pass the `paymentComponentData.paymentMethod` to your server.

2. From your server, make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request, specifying:

   * `paymentMethod`: The `paymentComponentData.paymentMethod` from your client app.

   #### curl

   ```bash
   curl https://checkout-test.adyen.com/v72/payments \
   -H 'x-api-key: ADYEN_API_KEY' \
   -H 'content-type: application/json' \
   -d '{
     "merchantAccount":"ADYEN_MERCHANT_ACCOUNT",
     "reference":"YOUR_ORDER_NUMBER",
     "amount":{
       "currency":"CNY",
       "value":1000
     },
     "paymentMethod":{
       "type":"wechatpaySDK"
     },
     "returnUrl":"https://your-company.example.com/checkout?shopperOrder=12xy.."
   }'
   ```

   #### Java

   ```java
   // Adyen Java API Library v27.0.0
   import com.adyen.Client;
   import com.adyen.enums.Environment;
   import com.adyen.model.checkout.*;
   import java.time.OffsetDateTime;
   import java.util.*;
   import com.adyen.model.RequestOptions;
   import com.adyen.service.checkout.*;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   Client client = new Client("ADYEN_API_KEY", Environment.TEST);

   // Create the request object(s)
   Amount amount = new Amount()
     .currency("CNY")
     .value(1000L);

   PaymentDetails paymentDetails = new PaymentDetails()
     .type(PaymentDetails.TypeEnum.WECHATPAYSDK);

   PaymentRequest paymentRequest = new PaymentRequest()
     .reference("YOUR_ORDER_NUMBER")
     .amount(amount)
     .merchantAccount("ADYEN_MERCHANT_ACCOUNT")
     .paymentMethod(new CheckoutPaymentMethod(paymentDetails))
     .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..");

   // Send the request
   PaymentsApi service = new PaymentsApi(client);
   PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
   ```

   #### PHP

   ```php
   // Adyen PHP API Library v19.0.0
   use Adyen\Client;
   use Adyen\Environment;
   use Adyen\Model\Checkout\Amount;
   use Adyen\Model\Checkout\CheckoutPaymentMethod;
   use Adyen\Model\Checkout\PaymentRequest;
   use Adyen\Service\Checkout\PaymentsApi;

   $client = new Client();
   $client->setXApiKey("ADYEN_API_KEY");
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   $client->setEnvironment(Environment::TEST);


   // Create the request object(s)
   $amount = new Amount();
   $amount
     ->setCurrency("CNY")
     ->setValue(1000);

   $checkoutPaymentMethod = new CheckoutPaymentMethod();
   $checkoutPaymentMethod
     ->setType("wechatpaySDK");

   $paymentRequest = new PaymentRequest();
   $paymentRequest
     ->setReference("YOUR_ORDER_NUMBER")
     ->setAmount($amount)
     ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT")
     ->setPaymentMethod($checkoutPaymentMethod)
     ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..");

   $requestOptions['idempotencyKey'] = 'UUID';

   // Send the request
   $service = new PaymentsApi($client);
   $response = $service->payments($paymentRequest, $requestOptions);
   ```

   #### C\#

   ```cs
   // Adyen .net API Library v17.0.0
   using Adyen;
   using Environment = Adyen.Model.Environment;
   using Adyen.Model;
   using Adyen.Model.Checkout;
   using Adyen.Service.Checkout;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   var config = new Config()
   {
       XApiKey = "ADYEN_API_KEY",
       Environment = Environment.Test
   };
   var client = new Client(config);

   // Create the request object(s)
   Amount amount = new Amount
   {
     Currency = "CNY",
     Value = 1000
   };

   PaymentDetails paymentDetails = new PaymentDetails
   {
     Type = PaymentDetails.TypeEnum.WechatpaySDK
   };

   PaymentRequest paymentRequest = new PaymentRequest
   {
     Reference = "YOUR_ORDER_NUMBER",
     Amount = amount,
     MerchantAccount = "ADYEN_MERCHANT_ACCOUNT",
     PaymentMethod = new CheckoutPaymentMethod(paymentDetails),
     ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy.."
   };

   // Send the request
   var service = new PaymentsService(client);
   var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
   ```

   #### NodeJS (JavaScript)

   ```js
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   const { Client, CheckoutAPI } = require('@adyen/api-library');
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const paymentRequest = {
     merchantAccount: "ADYEN_MERCHANT_ACCOUNT",
     reference: "YOUR_ORDER_NUMBER",
     amount: {
       currency: "CNY",
       value: 1000
     },
     paymentMethod: {
       type: "wechatpaySDK"
     },
     returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy.."
   }

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

   #### Go

   ```go
   // Adyen Go API Library v10.4.0
   import (
     "context"
     "github.com/adyen/adyen-go-api-library/v9/src/common"
     "github.com/adyen/adyen-go-api-library/v9/src/adyen"
     "github.com/adyen/adyen-go-api-library/v9/src/checkout"
   )
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   client := adyen.NewClient(&common.Config{
     ApiKey:      "ADYEN_API_KEY",
     Environment: common.TestEnv,
   })

   // Create the request object(s)
   amount := checkout.Amount{
     Currency: "CNY",
     Value: 1000,
   }

   paymentDetails := checkout.PaymentDetails{
     Type: common.PtrString("wechatpaySDK"),
   }

   paymentRequest := checkout.PaymentRequest{
     Reference: "YOUR_ORDER_NUMBER",
     Amount: amount,
     MerchantAccount: "ADYEN_MERCHANT_ACCOUNT",
     PaymentMethod: checkout.PaymentDetailsAsCheckoutPaymentMethod(&paymentDetails),
     ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..",
   }

   // Send the request
   service := client.Checkout()
   req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
   res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
   ```

   #### Python

   ```py
   # Adyen Python API Library v12.5.1
   import Adyen

   adyen = Adyen.Adyen()
   adyen.client.xapikey = "ADYEN_API_KEY"
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.client.platform = "test" # The environment to use library in.

   # Create the request object(s)
   json_request = {
     "merchantAccount": "ADYEN_MERCHANT_ACCOUNT",
     "reference": "YOUR_ORDER_NUMBER",
     "amount": {
       "currency": "CNY",
       "value": 1000
     },
     "paymentMethod": {
       "type": "wechatpaySDK"
     },
     "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy.."
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
   ```

   #### Ruby

   ```rb
   # Adyen Ruby API Library v9.5.1
   require "adyen-ruby-api-library"

   adyen = Adyen::Client.new
   adyen.api_key = 'ADYEN_API_KEY'
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.env = :test # Set to "live" for live environment

   # Create the request object(s)
   request_body = {
     :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT',
     :reference => 'YOUR_ORDER_NUMBER',
     :amount => {
       :currency => 'CNY',
       :value => 1000
     },
     :paymentMethod => {
       :type => 'wechatpaySDK'
     },
     :returnUrl => 'https://your-company.example.com/checkout?shopperOrder=12xy..'
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
   ```

   #### NodeJS (TypeScript)

   ```ts
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   import { Client, CheckoutAPI, Types } from "@adyen/api-library";
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const amount: Types.checkout.Amount = {
     currency: "CNY",
     value: 1000
   };

   const paymentDetails: Types.checkout.PaymentDetails = {
     type: Types.checkout.PaymentDetails.TypeEnum.WechatpaySDK
   };

   const paymentRequest: Types.checkout.PaymentRequest = {
     reference: "YOUR_ORDER_NUMBER",
     amount: amount,
     merchantAccount: "ADYEN_MERCHANT_ACCOUNT",
     paymentMethod: paymentDetails,
     returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy.."
   };

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

   The [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response includes an `action` object that contains information about the app switch.

3. Pass the `action` object to your client app.

   **/payments response**

   ```json
   {
       "resultCode": "Pending",
       "action": {
           "paymentMethodType": "wechatpaySDK",
           "type": "sdk",
           "sdkData": {
               "appid": "wx3aed7fe146f6a57a",
               "noncestr": "cPY0e83ny4hWyf5O",
               "packageValue": "Sign=WXPay",
               "partnerid": "205287714",
               "prepayid": "wx015678064827111da2e4f0b11005864100",
               "sign": "169FD3F1E193446D90C45573EBDD4020",
               "timestamp": "1573033086"
           }
       },
       "details": [
           {
               "key": "resultCode",
               "type": "text"
           }
       ],
       ...
   }
   ```

## Check the payment result

Drop-in uses the `action` object to launch the WeChat app, where the shopper completes the payment, and is then redirected back to your app.

To check the payment result, [make a `/payments/details` request](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Drop-in#send-additional-payment-details).

## Present the payment result

Use the `resultCode` that you received in the [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/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 **Received** | The payment order was successfully received.             | Inform the shopper that you have received their order, and are waiting for the payment to clear. You will receive the final result of the payment in an [AUTHORISATION webhook](/development-resources/webhooks/webhook-types). 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](https://ca-live.adyen.com/) > **Transactions** > **Payments**.

Before you can accept live WeChat Pay payments, you need to submit a request for WeChat Pay in your [live Customer Area](https://ca-live.adyen.com/).

## See also

* [WeChat Open Platform](https://open.weixin.qq.com/)
* [WeChat for Android](https://play.google.com/store/apps/details?id=com.tencent.mm)
* [Android Drop-in integration guide](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Drop-in)
* [Webhooks](/development-resources/webhooks)
* [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)
