This API should be called on the server side and cannot be called directly on the client side (Mini Program, web page, APP, etc.). For details, please refer to API Call Guide.
API English Name: create_withdraw_order
This API is used to create a withdrawal order.
1. Call Method
HTTPS Call
POST https://api.weixin.qq.com/xpay/create_withdraw_order?access_token=ACCESS_TOKEN&pay_sig=PAY_SIG
Cloud Call
- This API does not support cloud call.
Third-party Call
-
This API supports third-party platforms on behalf of Merchant call.
-
The permission set ID of this API is: 157
-
After the service provider obtains one of the permission set authorizations, it can use authorizer_access_token to call on behalf of Merchant, for details please refer to Third-party Call documentation.
2. Request Parameters
Query Parameters Query String Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | string | Yes | ACCESS_TOKEN | API call credential, you can use access_token, authorizer_access_token |
| pay_sig | string | Yes | - | Payment signature |
Request Body Request Payload
| Parameter | Type | Required | Description |
|---|---|---|---|
| withdraw_no | string | Yes | Withdrawal order ID. Length must be between [8,32]. Only letters, numbers, '\_', and '-' are allowed. |
| withdraw_amount | string | Yes | Withdrawal amount in CNY (yuan). For example, use 0.01 to withdraw 1 cent. This parameter is optional; if omitted, it indicates a full balance withdrawal. |
| env | number | Yes | 0 - Production environment; 1 - Sandbox environment |
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| errcode | number | Error code |
| errmsg | string | Error message |
| withdraw_no | string | Withdrawal order ID |
| wx_withdraw_no | string | WeChat-side order ID for the withdrawal order |
4. Notes
Use Payment Signature
Payment Signature
The signature parameter is pay_sig, which should be appended to the query string.
For example, if the API endpoint is: https://api.weixin.qq.com/xpay/query_user_balance?access_token=xxxx
After adding the signature, it must be passed as: https://api.weixin.qq.com/xpay/query_user_balance?access_token=xxxx&pay_sig=xxx
5. Code Example
No code example for this API
6. Error Codes
The following is the error code list of this API, other error codes can refer to Common Error Codes; When encountering errors in calling the API, you can use the official API Diagnostic Tool to assist in locating and analyzing problems.
| Error Code | Error Description |
|---|---|
| -1 | System error |
| 268490001 | Invalid openid |
| 268490002 | Invalid request parameter field. Refer to errmsg for details. |
| 268490003 | Signature error |
| 268490004 | Duplicate operation (returned by gift, token payment, and ad credit recharge related APIs, indicating that the previous operation was successful) |
| 268490005 | The order has already been refunded via the cancel_currency_pay API; further refunds are not supported. |
| 268490006 | Insufficient token balance for refund/payment operation |
| 268490007 | Images or text contain sensitive content and are prohibited. |
| 268490008 | Token is not published; token operations are not allowed. |
| 268490009 | User session_key does not exist or has expired. Please log in again. |
| 268490011 | Data is being generated. Please call this API later to retrieve it. |
| 268490012 | Batch task is running. Please wait for completion before running again. |
| 268490013 | Refunds are prohibited for orders in verified status. |
| 268490014 | Refund operation is in progress. Please retry with the same parameters later. |
| 268490015 | Rate limit exceeded |
| 268490016 | The left_fee field in the refund request does not match the actual value. Please query and confirm via the query_order API. |
| 268490018 | Industry ID of the ad credit recharge account does not match |
| 268490019 | Ad credit recharge account ID is already bound to another appid |
| 268490020 | Invalid subject name for the ad credit recharge account |
| 268490021 | Account onboarding is incomplete |
| 268490022 | Invalid ad credit recharge account |
| 268490023 | Insufficient ad credit balance |
| 268490024 | Ad credit recharge amount must be greater than 0 |
7. Applicable Scope
The callable account types for this API are not yet clear, or are determined by the calling parameters in business. Please refer to the actual calling situation.