Current location - Quotes Website - Personality signature - Obtaining prepay_id _ ID _ ID through WeChat unified payment interface occasionally gives an error: INVALID_REQUEST.
Obtaining prepay_id _ ID _ ID through WeChat unified payment interface occasionally gives an error: INVALID_REQUEST.
Obtaining prepay_id _ ID _ ID through WeChat unified order payment interface occasionally gives an error: INVALID_REQUEST is caused by a wrong setting, and the solution is as follows:

1. After a merchant applies to develop an APP application on the WeChat open platform, the WeChat open platform will generate the unique identifier APPID of the APP. Open the project in Xcode and set the URL scheme in the project properties to APPID.

2. WeChat lib library and header file are introduced into the merchant APP project. Before calling the API, you need to register your APPID with WeChat. The code is as follows.

3. The merchant server generates a payment order. First, the unified ordering API is called to generate the prepayment form. After obtaining the prepayment _ ID, the parameters are signed again and transmitted to the APP to initiate payment.

4. According to the example of WeChat SDK, implement the onResp function in the class. After the payment is completed, the WeChat APP will return to the merchant APP and call back the onResp function. Developers need to receive notification in this function and judge the error code returned. If the payment is successful, query the payment result in the background, and then display the actual payment result of the user.

5.enter-(void)on esp:(base resp *)resp {

? if([respisKindOfClass:[PayRespclass]]){

? pay resp * response =(pay resp *)resp; Switch (response. Errorcode) {casewxSuccess://The server queries the payment notice or the result returned by the API, and then prompts that NSlog is successful (@ "Payment is successful"); Break; Default: nslog (@ "Payment failed, retcode=%d", resp.errcode); Have a rest.