Documents: pay.weixin.qq.com/wiki/doc/ap… In our project of wechat SDK, laravel-wechat(Easywechat) is used.

The sandbox environment is already configured. In the configuration file, set sandbox to True.

However, a very strange problem occurred during debugging: the sandbox payment amount (XXX) is invalid. Please check the relevant operations such as case placing and acceptance, and return FAIL all the time. On the Internet to find a long answer, finally clear, the following notes:

Reason for error: In the wechat sandbox environment, there is an "acceptance test case "(at the bottom of the document link above), which is quoted below:" Please select the corresponding acceptance test case according to the function you need to open: Payment code payment acceptance case Native Payment acceptance Case JSAPI Payment Acceptance Case Free coupon acceptance case "We need to look at different use cases according to our own functions. Each use case has a specific "order amount" (note: the amount is fixed), we can only test according to this amount!! In the code, we can specifically for 'sandbox environment by the following configuration to specify the order amount: the if (config (' wechat. Default. Payment. The sandbox)) {$unified_order [' total_fee] = 1.01; }Copy the code

That’s funny, it’s pretty bad…