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
Shoppers select WeChat as payment option in the interface you provide to them.
Create the order object. Use WE_CHAT_PAY as the type of the
PaymentDetailsobject, and includeReturnURLandCancelURL.Use the placeOrder method to send the data to 2Checkout.
Once you place the order, 2Checkout logs it into the system. At this point in time, the status of the order is PENDING.
2Checkout returns an Order object as the output of the placeOrder method.
Use the
PaymentMethodobject 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=1abc7fd72d008428After being redirected to WeChat Pay, shoppers need to scan the QR code provided, using the WeChat smartphone app.
After customers enter their payment password, WeChat notifies 2Checkout if the payment is approved, and the status of the order becomes COMPLETE.
Shoppers are redirected to the
RedirectURLfrom the Order information object. In case the payment fails, shoppers are redirected to theCancelURL.
Request parameters
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
Object
Object containing order information.
Last updated
Was this helpful?