Accept WeChat Pay with a server-side-only integration

Build your own payment form to add WeChat Pay to your checkout page


WeChat Pay doesn’t require any input from the customer on the merchant website. The customer will specify the required payment information on the WeChat Pay platform.

Before you begin

Step 1: Create a Payment Type resource
server side

When creating the payment type WeChat Pay, you need to send a request to the Unzer API. The response will contain an id, later referred to as typeId. You need this typeId to perform the transaction.

POST https://api.unzer.com/v1/types/wechatpay

Body: {}
$unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

$wechatpay = new UnzerSDK\Resources\PaymentTypes\Wechatpay();
$wechatpay = $unzer->createPaymentType($wechatpay);
Wechatpay wechatpay = new Wechatpay();
Unzer unzer = new Unzer(new HttpClientBasedRestCommunication(), "s-priv-xxxxxxxxxx");
wechatpay = unzer.createPaymentType(wechatpay);

The response will look similar to the following example:

    "id": "s-wcp-otvqlpgqsh7u",
    "method": "wechatpay",
    "recurring": false,
    "geoLocation": {
        "clientIp": "",
        "countryCode": "DE"

For a full description of WeChat Pay payment type creation check API reference.

Next steps

The next steps are the same as for the UI components integration. See Accept WeChat Pay with UI Components from Step 2 onwards.