Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program cloud development SDK documents WeChat payment and inquiry refund


May 20, 2021 WeChat Mini Program Development Document


Table of contents


CloudPay.queryRefund()

Support: Cloud function 2.0.2

Ask for a refund

Description

After submitting a refund request, check the refund status by calling the interface. R efunds are delayed, refunds paid with change are made within 20 minutes, and refunds paid by bank cards are re-checked after 3 business days. Note: If the number of partial refunds for a single payment order exceeds 20 times, please use the refund form query.

When a partial refund of an order exceeds 10, the merchant uses WeChat order number or merchant order number to adjust the refund query API to query for refunds, the default return of the first 10 and total_refund_count (total number of refund orders). M erchants need to query the same order under more than 10 refund orders, can be passed in the order number and offset to query, WeChat payment will return offset and the next 10, and so on. When a merchant incoming offset exceeds total_refund_count, the system returns an error PARAM_ERROR.

Example:

There are 36 refund orders under an order, when the merchant wants to inquire about the 25th, the incoming order number and offset 24, WeChat payment platform will return the 25th to 35th refund slip information, or the merchant can directly pass in the refund slip number to inquire about the refund

Description of the parameters

The field name The name of the variable Required Type The sample value Describe
Sub-merchant number sub_mch_id Is String(32) 1900000109 WeChat pays for the assigned sub-merchant number
Random string nonce_str Yes String(32) 5K8264ILTKCH16CQ2502SI8ZNMTM67VS Random strings, not less than 32 bits.Recommended random number generation algorithm
WeChat order number transaction_id Four choices String(28) 1217752501201407033233368018 The priority of the WeChat order number query is: refund_id> out_refund_no> Transaction_id> OUT_TRADE_NO
Merchant order number out_trade_no Four choices String(32) 1217752501201407033233368018 The order number of the merchant system is required to require 32 characters, which can only be numbers, uppercase letters _-
Merchant refund number out_refund_no Four choices String(64) 1217752501201407033233368018 The refund number inside the merchant system is unique, the merchant system is only a number, uppercase letters _-
WeChat refund list number refund_id Four choices String(32) 1217752501201407033233368018 WeChat refund list number
Offset offset no Int 15 Offset, when some of the number of refunds exceed 10 times, indicating that the result returned query results start recording from this offset

REFUND_ID, OUT_REFUND_NO, OUT_TRADE_NO, Transaction_ID four parameters must be filled with, if there is a priority: refund_id> OUT_REFUND_NO> Transaction_ID> OUT_TRADE_NO

Return value description

Field name variable name Required type Sample value describe
Return status code returnCode Yes String(16) SUCCESS SUCCESS/FAIL
Return information returnMsg Whether String(128) The signature failed The information returned, if not empty, is the cause of the error. Such as a failed signature, parameter format check error

The following fields are returned when the returnCode is SUCCESS

The field name The name of the variable Required Type The sample value Describe
Business results result_code Is String(16) SUCCESS SUCCESS/FAIL
THE SUCCESS refund request was received successfully and the result is queried through the refund inquiry interface
Error code err_code Is String(32) SYSTEMERROR The error code is detailed in Section 6
The error description err_code_des Is String(128) System error Description of the result information
The service provider's APPID appid Is String(32) wxd678efh567hg6787 The APPID of the service merchant
Merchant number mch_id Is String(32) 1230000109 WeChat pays for the assigned merchant number
APPID for small programs sub_appid Is String(32) wx8888888888888888 WeChat assigned small program ID
Sub-merchant number sub_mch_id Is String(32) 1900000109 WeChat pays for the assigned sub-merchant number
Random string nonce_str Is String(32) 5K8264ILTKCH16CQ2502SI8ZNMTM67VS Random string, not longer than 32 bits
Signature sign Is String(32) C380BEC2BFD727A4B6845133519F3AD6 Signatures, see signature algorithms for details
WeChat order number transaction_id Is String(32) 1217752501201407033233368018 WeChat order number
Merchant order number out_trade_no Is String(32) 1217752501201407033233368018 Merchant system internal order number, required within 32 characters, can only be numbers, case letters -
The order amount total_fee Is Int 100 The total amount of the order, in units, can only be integers, as detailed in the amount paid
The amount of the order to be closed settlement_total_fee Whether Int 100 When the order uses a top-up-free coupon and returns this parameter, the order amount payable is the order amount - the top-up coupon amount.
The type of currency fee_type Whether String(8) CNY Order amount currency type, is a three-letter code that complies with ISO 4217, default RMB: CNY, and a list of other values can be found in the currency type
The amount paid in cash cash_fee Is Int 100 Cash payment amount, in units, can only be integer, see payment amount
The number of refund pens refund_count Is Int 1 The number of refund pens is currently returned
Merchant refund slip number out_refund_no_$n Is String(64) 1217752501201407033233368018 Refund order number inside the merchant system, unique inside the merchant system, can only be numbers, case letters
WeChat refund slip number refund_id_$n Is String(32) 1217752501201407033233368018 WeChat refund slip number
Refund channels refund_channel_$n Whether String(16) ORIGINAL ORIGINAL - Original refund
BALANCE - Return to balance
OTHER_BALANCE - The original account is abnormally returned to another balance account
OTHER_BANKCARD - the original bank card abnormally returned to other bank cards
Total number of refunds for orders total_refund_count Whether Int 35 The total number of partial refunds that have occurred for the order, which is returned when the request parameter is passed in to offset
Request a refund amount refund_fee_$n Is Int 100 The total amount of the refund, in points, can be partially refunded
Refund amount settlement_refund_fee_$n Whether Int 100 Refund Amount - Request Refund Amount - Non-Recharge Voucher Refund Amount, Refund Amount - Request Refund Amount
The type of voucher coupon_type_$n_$m Whether String(8) CASH CASH -- Recharge voucher
NO_CASH--- a non-recharge voucher
The order is returned when the voucher is used (value: CASH, NO_CASH). $n is a sign, $m is a sign, numbered from 0, for example: coupon_type_$0 to $1
Total voucher refund amount coupon_refund_fee_$n Whether Int 100 Voucher Refund Amount - Refund Amount, Refund Amount - Voucher or Discount Refund Amount is cash, please see Voucher or Credit
Refund voucher usage quantity coupon_refund_count_$n Whether Int 1 The number of refund vouchers used, $n be tendered and numbered from 0
Refund voucher ID coupon_refund_id_$n_$m Whether String(20) 10000 Refund voucher ID, $n is the underlying, $m is the under-label, starting from 0
The amount of a single voucher refund coupon_refund_fee_$n_$m Whether Int 100 The amount paid for a single refund voucher is $n, which is $m, and numbered from 0
Refund status refund_status_$n Is String(16) SUCCESS Refund Status: SUCCESS - Refund was successful
REFUNDCLOSE - Refunds are closed.
PROCESSING - Refund processing
CHANGE - Refund exception, refund to the bank found that the user's card is invalid or frozen, resulting in the original refund bank card failure, you can go to the merchant platform (pay.weixin.qq.com) - trading center, manual processing of this refund. $n is the undersem, starting at 0.
Refund the source of the funds refund_account_$n Whether String(30) REFUND_SOURCE_RECHARGE_FUNDS REFUND_SOURCE_RECHARGE_FUNDS---/Base Account for available balances
REFUND_SOURCE_UNSETTLED_FUNDS--- refund of outstanding funds
$n is the undersem, starting at 0.
Refunds are recorded in the account refund_recv_accout_$n Is String(64) China Merchants Bank Credit Card 0403 The refund of the current refund slip is recorded by the accounting party
1) Return your bank card:
The name of the bank T he type of card (Card tail number)
2) Return the user's change:
Pay the user change

3) Refund merchant:
Merchant base account
Merchants settle bank accounts
4) Return payment user change pass:
Pay the user for change
The successful time of the refund refund_success_time_$n Whether String(20) 2016-07-25 15:26:26 The refund success time is returned when the refund status is successful. $n is the undersem, starting at 0.

Error code

Name Describe Reason Solution
SYSTEMERROR The interface returned an error The system timed out Try dropping the call API again.
REFUNDNOTEXIST The refund order query failed The order number is incorrect or the order status is incorrect Please check that the order number is incorrect and that the order status is correct, e.g. unpaid, unpaid and not refunded
INVALID_TRANSACTIONID The transaction_id The request parameters were not filled in in accordance with the guidelines The request parameter is incorrect, checking for the existence of the original transaction number or initiating a payment transaction interface to return the failure
PARAM_ERROR The argument is wrong The request parameters were not filled in in accordance with the guidelines The request parameter is wrong, please check the parameter and call the refund request
APPID_NOT_EXIST The APPID does not exist The APPID is missing from the parameter Please check that the APPID is correct
MCHID_NOT_EXIST MCHID does not exist MCHID is missing from the parameter Please check that the MCHID is correct
REQUIRE_POST_METHOD Please use the post method The post pass parameter is not used Please check that the request parameters are submitted via the post method
SIGNERROR The signature is wrong The parameter signature result is incorrect Check that both the signature parameters and methods meet the requirements of the signature algorithm
XML_FORMAT_ERROR The XML is in the wrong format The XML is in the wrong format Check that the XML parameters are in the correct format