WeChat Mini Programs sandbox environment payment error

currently doing project refactoring, I have never done payment business before.

recently, I am doing the work related to WeChat Pay. There was an online version before, but there is no sandbox environment for payment, so I am now working on WeChat Pay"s sandbox environment.

the business scenario is as follows:
call the sandbox payment API to get the prepaid data from the server, and then scan the code by Mini Program to check whether the payment is successful.

normal online payment, no problem. But there is a problem when switching to the sandbox environment

error is:

{errMsg:"requestPayment:fail",err_code:2,err_desc:"JSAPI: total_fee"}

sandbox environment I tested several areas where I thought there would be problems:

1. Sandbox key

according to the document payment acceptance , signature algorithm , I got the sandbox key and replaced the key used by the online business. And replace all payment interfaces with sandbox interfaces

2. Test case amount

at first, I suspected that the amount was not set correctly (I tried that the amount was 1.01 yuan to generate a prepaid return). Then I went to the official website to check the test case they required, and then replaced it with 3.01 according to the first use case of by the way, hack Wechat: your documents are really lame!


it seems that only 1.00,1.01 amounts can be traded in the sandbox


have you solved the


amount, it seems that I have found it too.


the sandbox does not use the API KEY set by itself to sign, etc., but to request Wechat's test API KEY separately

https://pay.weixin.qq.com/wik.

be sure to pay attention to this.

Menu