WeChat
 Specifics
 Integration scenarios
 Payment via WeChat
Step 1. Create a payment  with the
wechat
type in the
payment_method_data
object, the
qr
type in the
confirmation
object, and the
true
value in the
capture
parameter so that the status will automatically change to 
succeeded
after the payment is completed.
WeChat doesn’t support two-stage payments: if you set the
false
value in the
capture
parameter or don’t send the
capture
parameter at all, the payment won’t be processed.
Example of request for payment creation
cURL
PHP
Python
curl https://payment.yandex.net/api/v3/payments \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "amount": {
          "value": "2.00",
          "currency": "RUB"
        },
        "payment_method_data": {
          "type": "wechat"
        },
        "confirmation": {
          "type": "qr"
        },
        "capture": true,
        "description": "Order No. 72"
      }'
Step 2. In the
confirmation_data
parameter, Yandex.Checkout will provide the data for generating the QR code. Generate the QR code using any available tools.
Example of a created payment object
JSON
{
    "id": "2475f981-000f-5000-8000-1538b1392c2a",
    "status": "pending",
    "paid": false,
    "amount": {
        "value": "2.00",
        "currency": "RUB"
    },
    "confirmation": {
        "type": "qr",
        "confirmation_data": "weixin://wxpay/bizpayurl?pr=kxK2lXq"
    },
    "created_at": "2019-05-21T11:49:21.279Z",
    "description": "Order No. 72",
    "metadata": {},
    "payment_method": {
        "type": "wechat",
        "id": "2475f981-000f-5000-8000-1538b1392c2a",
        "saved": false
    },
    "recipient": {
        "account_id": "100001",
        "gateway_id": "1000001"
    },
    "refundable": false,
    "test": false
}
Step 3. Display the created QR code on the payment page so the user can scan it using the WeChat app. Once the user confirms the payment, the status of the payment object  will be changed to 
succeeded
.
Example of a created payment object
JSON
{
    "id": "2475f981-000f-5000-8000-1538b1392c2a",
    "status": "succeeded",
    "paid": true,
    "amount": {
        "value": "2.00",
        "currency": "RUB"
    },
    "captured_at": "2019-05-21T12:10:19.732Z",
    "created_at": "2019-05-21T12:10:12.509Z",
    "description": "Order No. 72",
    "metadata": {},
    "payment_method": {
        "type": "wechat",
        "id": "2475f981-000f-5000-8000-1538b1392c2a",
        "saved": false
    },
    "recipient": {
        "account_id": "100001",
        "gateway_id": "1000001"
    },
    "refundable": true,
    "refunded_amount": {
        "value": "0.00",
        "currency": "RUB"
    },
    "test": false
}
 Specifics of refunds
Payment made via WeChat can be refunded only if it was successfully completed (payment object  with the
succeeded
status) and if no more than 90 days has passed since the date of payment.
Before creating a refund, request the payment information  and check the values of the
refundable
and
refunded_amount
parameters:
  • if 
    refundable
    has the
    true
    value, the payment must be refunded via the Yandex.Checkout;
  • if 
    refundable
    has the
    false
    value and a full refund hasn’t been made (
    refunded_amount
    is smaller than
    amount
    ), the payment must be refunded by a payment order;
  • in other cases, you won’t be able to make the refund.
If you’ve already made partial refunds for this payment, the refund amount should not exceed the remaining payment amount.
 See also
Payment processDeclined paymentsPayment by 54-FZ