Alipay local debugging asynchronous callback Java

Original intention:
      To solve the problem that Alipay cannot be debugged locally, because Alipay has restrictions when signing merchants, and Alipay's payment results must be tested on the signed domain name. If you directly return to the merchant, you do not need to debug on the server, but the asynchronous notification of Alipay must be debugged on the public network, so every time you need to make a war package and put it on the server for debugging, the problem page is not easy to find, not easy solve. So I thought about whether I can debug Alipay's asynchronous notification method locally.


Text:

1. The effect achieved

     can be locally modulated by Alipay's onCallBack asynchronous callback method

2. The tool that needs to be used is

    the intranet penetration tool: natapp.
    A server needs to have nginx installed.

3. How to use


1. Create an account at https://natapp.cn/ and enter my background.

2. Purchase the free channel


 

3. Configure the port of the tunnel, because you want to test the Alipay callback, the default is 80.



4. Click to buy for free, enter this page, and remember authtoken


 

5. Download Mac OS X 64-bit, and extract the downloaded compressed package to a local path without Chinese.
    http://download.natapp.cn/assets/downloads/clients/2_2_0/natapp_darwin_amd64_2_2_0.zip

6. Open the terminal and authorize the decompressed software. Enter this command and press Enter
   chmod a+x [color=red]Your directory[/color]/natapp


 

7. Run this software in the terminal and enter this command, the red part is the authtoken in the fourth item above, press Enter.



8. The following interface appears, indicating success, and copy the address in the red box. Do not close the terminal.


 



3. For the domain name signed by Alipay, a subdomain name is allocated and pointed to the server ip.
  For example: alipay.xxx.com. Next, you need to configure this address to nginx.


Fourth, configure nginx on the server side
  1. Install nginx on the linux server. Please ask Baidu for the specific installation method.

  2. Configure the nginx configuration file nginx/conf/nginx.conf. The blue box is the entire configuration, paste the address copied in the second.8 above into the red box, and restart nginx.
 

 


5. The pre-domain name of notify_url (asynchronous notification url) in the onPay method in the local project (that is, the method for Alipay to generate payment html) needs to be determined as the subdomain name of the third step above.


 



6. Before calling the test.
  1. Configure the merchant number that needs to be passed to Alipay for payment.
  2. You can access it with the subdomain name assigned in the third step.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326189816&siteId=291194637