For the complete documentation index, see llms.txt. This page is also available as Markdown.

Use WeChat Pay

Place an order for catalog products defined in your Control Panel and collect the payment using WeChat Pay.

Requirements

Only Chinese shoppers are able to purchase using WeChat Pay. Make sure the billing country code is set to CN.

Supported currencies

  • USD

  • HKD

  • CNY

Workflow

  1. Shoppers select WeChat as payment option in the interface you provide to them.

  2. Create the order object. Use WE_CHAT_PAY as the type of the PaymentDetails object, and include ReturnURL and CancelURL.

  3. Use the placeOrder method to send the data to 2Checkout.

  4. Once you place the order, 2Checkout logs it into the system. At this point in time, the status of the order is PENDING.

  5. 2Checkout returns an Order object as the output of the placeOrder method.

  6. Use the PaymentMethod object to create a redirect URL for the shoppers, concatenating the values of the Href and avng8apitoken parameters. Here's an example of the redirect URL:

    https://api.2checkout.com/4.0/scripts/we_chat_pay/authorize/?avng8apitoken=1abc7fd72d008428
  7. After being redirected to WeChat Pay, shoppers need to scan the QR code provided, using the WeChat smartphone app.

  8. After customers enter their payment password, WeChat notifies 2Checkout if the payment is approved, and the status of the order becomes COMPLETE.

  9. Shoppers are redirected to the RedirectURL from the Order information object. In case the payment fails, shoppers are redirected to the CancelURL.

Request parameters

Parameter
Type / Description

sessionID

Required (string)

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes.

Required (object)

Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. To place an order with WeChat, use WE_CHAT_PAY as the type of the PaymentDetails object and provide a ReturnURL and a CancelURL as part of the PaymentMethod object. See code sample.

Request sample

Response parameters

Parameters
Type / Description

Object

Object containing order information.

Last updated

Was this helpful?