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: upload_vp_file
This API is used to upload media files (such as images and vouchers).
1. Call Method
HTTPS Call
POST https://api.weixin.qq.com/xpay/upload_vp_file?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 |
|---|---|---|---|
| env | number | Yes | 0 - Production environment, 1 - Sandbox environment (only used for signature verification; query results always reflect the production environment). |
| base64_img | string | Yes | Base64-encoded image content. If using this field, the image size cannot exceed 1 MB. For images larger than 1 MB, use the `img_url` field. |
| img_url | string | Yes | Image URL. It must be directly downloadable and must not return status codes such as 302. The maximum allowed image size is 2 MB (prefer using `img_url`). |
| file_name | string | Yes | Image name. |
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| errcode | number | Error code. |
| errmsg | string | Error message. |
| file_id | string | Returned file ID. |
4. Notes
Payment Signature
Payment Signature
The signature parameter is pay_sig, appended after the query parameters.
For example, if the API endpoint is: https://api.weixin.qq.com/xpay/query_user_balance?access_token=xxxx
After adding the signature, it becomes: 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 | OpenID error. |
| 268490002 | Request parameter field error. For details, check `errmsg`. |
| 268490003 | Signature error. |
| 268490004 | Duplicate operation (Returned by interfaces related to gifting, token payment, and ad fund recharge, indicating that the previous operation was successful). |
| 268490005 | The order has already been refunded via the `cancel_currency_pay` API and does not support further refunds. |
| 268490006 | Insufficient token balance for refund/payment operation. |
| 268490007 | The image or text contains sensitive content and is prohibited from use. |
| 268490008 | Token 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 it to complete before running it again. |
| 268490013 | Refunds are prohibited for orders in verified status. |
| 268490014 | Refund operation in progress. Please retry with the same parameters later. |
| 268490015 | Rate limit. |
| 268490016 | The `left_fee` field for the refund does not match the actual value. Please verify using the `query_order` API. |
| 268490018 | Ad fund recharge account industry ID mismatch. |
| 268490019 | Ad fund recharge account ID is already bound to another appid. |
| 268490020 | Ad fund recharge account entity name is incorrect. |
| 268490021 | Account onboarding is not complete. |
| 268490022 | Invalid ad fund recharge account. |
| 268490023 | Insufficient ad fund balance. |
| 268490024 | Ad fund 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.