A period of time, because the company's business needs, the need to use Alipay mobile phone website Payment interface, because it is the first time to use this, a lot of detours in the middle, now summed up, I hope to encounter the same problem friends help.
The first step: the ant to sign in the open platform Ant Gold Clothing open platform connection, where you can use your own Alipay to login, you can also use the company's corporate account login (recommended company's corporate account login)
After login The page is as follows:
Step two: Go to the developer Center and see the menu in the picture above
Here you can choose to create applications, you can also directly use the sandbox environment test, sandbox environment and its own creation of the application of the effect is similar to the "Application test creation, just follow the tips of the page to do it", because the use of Alipay's mobile Web site payment interface is required and Alipay to sign, So I was in the test when using the sandbox environment, and the use of Alipay interface, you need to download Alipay to provide the demo, and then the demo into their own development tools, and then modify the configuration file inside. Demo link "Here is recommended to select the Service window demo, because I started in the use of Alipay interface is used in the service window interface, so I later configuration are in the service window of the demo in the change, for the service window out of the package can be directly deleted, In the development we only need to use a few of these packages on it, there will be a screenshot below.
After the download is complete, unzip and then import the project into the development tool, which can be removed except for the red box circle.
Next, we need to configure in the constants package, our own sandbox of the application environment,
The application of the public key here is to get us to Alipay where to download a public key generation tool, RSA key generation connection, according to your own computer system selection,
Download, unzip, and then generate the secret key, note: Folder directory must not have Chinese characters, otherwise the tool can not be used, this step I will not be step-by-step said. , the generated public key is configured to view the application public key as follows, and the first landing should be a realistic configuration of the public key. Click OK, then will generate Alipay public key "here must not configure the error, otherwise the program will not run up,---I am here on a number of wrong configuration, looking for a very good." 】
Next we can configure the constants in the downloaded demo.
、
In this class to configure the constants: Here is the text described alipay_public_key= "Fill is the public key of Alipay, is that you have configured your own public key generated after the payment treasure public key, on the Web page of the" app_id= "sandbox app_id" private_key= "is in While generating the public key, the generated PACKS8 's private key can be found in its own folder "public_key=" This is just configured the public key "alipay_gateway=" This must be noted. The gateway, which is to be changed to a test environment, can use the demo default gateway when using Https://openapi.alipaydev.com/gateway.do applications.
This is the completion of the half, next is the test, before the test need to have a domain name, your access address to the Internet, where I use the Natapp,natapp URL, the specific use of this method, you can own Baidu, you can also message inquiries.
The test code is as follows:
The mobile website pays the API, may refer to Alipay to provide the API document, in the Ant service open platform, may find.
Access to the address you put on the extranet, screenshot below
Choose another way
The account password here is the buyer's account and password in the sandbox.
I was on the computer Web site directly, so I need to enter the password and so on, Alipay provides a sandbox version of the phone wallet, as if only Android, you can download the test. If there is any problem, you can leave a message, mutual exchanges and progress.