Those years of stepped pit micro-channel pay

Because of the needs of the project requires the introduction of micro-channel and Alipay function, make their own micro-channel pay, pit encountered in recording it here

APPæ¯ä»æ¶åºå¾

The introduction of micro-channel java code, configure the appropriate configuration, use the App to make payments found to step 10 when the micro-channel payment system always return -1 ·, then consult the documentation micro letter gives the following situations only reason, just want to say Nyima can you be more specific point

Then start verifying the reason may occur:

1, signature error

By executing Step 4 and Step 5 micro-channel returns the corresponding parameter information is not an exception occurs, and then by calling the micro-channel internal inspection tools to verify signed by then also tested without problems through the official online experience signing tools https: //pay.weixin. qq.com/wiki/doc/api/jsapi.php?chapter=20_1 , actually, and then view the Key AppSecret  set to the same, and then the official also said not to use the same value, so the change key, setting key approach.

(Micro-channel pay: https://pay.weixin.qq.com/index.php/core/cert/api_cert )

Signatures are verified through signature it shows no problem by the above two ways;

2, verify appid

First to see the WeChat open platform application specific appid

(Micro-channel public platform: https://open.weixin.qq.com/cgi-bin/applist?t=manage/list&page=0&num=20&openapptype=1&lang=zh_CN&token=99835785766ab3e93bbacd15f3484093d4abc605 )

Click to see more APPID, and then to the micro-channel pay

A, to see whether the opening of the corresponding payment function

B, see bind off AppId (APP must be bound to the payment service)

After confirming again found no problem AppId

3, other exception (parameter error) 

Since the implementation of Step 10 is abnormal, so the guess is incorrect parameters passed to the front

A, back to the front end of the signature sign is not regenerated

Examination revealed parameters to the front end also comprises a sign, and when performing micro-channel request step 4 requests the parameters for the micro channel response also contains a sign, and no re-generates a signature sign but mistaken same sign directly to front-end caused the error

 B, timestamp error parameter value

No conversion error caused by seconds level, java get the current time in seconds the way.

Date nowTime = new Date();
long misTime = nowTime.getTime();

 B, pay the normal call Andrews, ios call has been paid -1

The obtained (misTime / 1000) Processing

-1 finalize the signature reason, incorrect reasons: returned to the front end of the signature sign is not regenerated, but direct use of micro-channel return signature sign

 

Published 21 original articles · won praise 8 · Views 400,000 +

Guess you like

Origin blog.csdn.net/qq_31150503/article/details/89530855