API Rules

Update Time:2025.02.18

There are multiple API rules need to be noticed in the development progress.

API Jugdement Logic
Request Frequency
Close Loop APIs
API Rules for Specific Scenarios

Correct request result judgment logic

After receiving information returned from a requested API, the institution/merchant needs to confirm the request result based on corresponding fields and judgment logic. Incorrect judgment will cause errors in transaction status synchronization.

WeChat Pay uses the two-layer judgment logic in its response packet, including return_code and result_code, where return_code indicates the communication result for this request and result_code indicates the business processing result for this request.

For example, when the Submit Quick Pay API is called:

  1. If both return_code and result_code return with SUCCESS, then both communication and business processing have succeeded, indicating payment success for the order.

  2. If return_code returns with SUCCESS and result_code returns with FAIL, then communication has succeeded while business processing has failed. Though in this case, the institution/merchant cannot consider business processing to have failed, because an extreme condition may exist where business processing has succeeded but a failure message has been returned. Therefore, polling is required for order query.

  3. If the return_code returns as FAIL, no result_code will return, because failed communication indicates transaction failure.

The preceding judgment logic and rules must be followed for integrating WeChat Pay APIs.

Note: For the Query Order API, besides return_code and result_code, the final order status must be determined based on the trade_state field. This means even if both return_code and result_code return with SUCCESS, it only means that the order query has been successfully processed, while the order status must be determined based on the returned information of trade_state.

 

About  WeChat  Pay

Powered By Tencent & Tenpay Copyright©

2005-2025 Tenpay All Rights Reserved.

Contact Us
Wechat Pay Global

WeChat Pay Global

Contact Us

Customer Service Tel

+86 571 95017

9:00-18:00 Monday-Friday GMT+8

Business Development

wxpayglobal@tencent.com

Developer Support

wepayTS@tencent.com

Wechat Pay Global

About Tenpay
Powered By Tencent & Tenpay Copyright© 2005-2025 Tenpay All Rights Reserved.