Detailed steps for developing Java payment interface for Alipay

Detailed steps for developing Java payment interface for Alipay

The official documentation on connecting to the Alipay payment interface has been written very clearly, but there are many novices like me who are confused when connecting to the Alipay payment interface for the first time, so I wrote this article here to give some ideas to my classmates like me.

first step

(You need to operate in Alipay first, and then run the code after getting the information we need to develop)

Enter Ant Financial, we need to create an application first. Do you see the application button in the picture below?

Click Apply (as shown below)

Create an application (creating an application requires review) and provide information for review. We don’t need to worry about it at this time. It can be used after passing the review.

But we can't just sit there while he's reviewing it, we'll do a test and write the code first, and then after the review and communication we'll replace the reviewed information.

Step 2

(Use the sandbox environment for development)

Have you seen the APPID? This is very important. We need to use it when paying. It will also be in the currently reviewed information. This sandbox is for our testing and is almost the same as the official one, except that different APPIDs and Alipay gateways are switched. (Here I want to complain about WeChat Pay. To be honest, the documentation of WeChat Pay is too bad and there are too many pitfalls. I will also integrate WeChat Pay later.) Another good thing about Alipay is the robot next to it. This is very good. If you don’t know how to do it, just call it (a small tip: use the robot, call the question a few times, and the human will come out, otherwise the human will not come out.)

In this interface, you need to set the application public key

Click to open the settings application public key (no need to set other settings) click to set application public key

OK, this is where you enter the public key. To generate a key, please click here to view the method for generating a secret key (see the picture below, download the key generation tool)

After downloading, open it according to the instructions (remember to open it according to the instructions)

Click Generate Key (note here: do not verify the signature of the key you generated, because the verification will fail). We can directly copy the generated public key and put it in.

There is no need to verify the accuracy of the public key here, just click Save.

Step 3

Import the jar package of alipay (jar package is in)

https://docs.open.alipay.com/54/104506/ This is the payment demo which contains a jar package. Just import it.

Step 4

Writing Code

Create an AppPayConfig class and put in the corresponding values ​​as shown below

Writing action classes

Ok, now Alipay has been connected. Of course, there is an asynchronous callback address above. This interface is also required, so I won’t post it here. I don’t know if you can understand it. If it is still unclear, you can call me. Thank you all for reading.

This concludes this article on the detailed steps of developing the Java-to-Alipay payment interface. For more information about the Java-to-Alipay payment interface, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to test Alipay payment interface in Java sandbox environment
  • Java backend implements Alipay payment interface and Alipay order query interface (front end is APP)
  • Detailed explanation of Java integrated Alipay payment interface (JSP+Alipay 20160912)

<<:  CSS3 mouse hover transition zoom effect

>>:  Example code for inputting the license plate number and province abbreviation in html

Recommend

HTML Grammar Encyclopedia_HTML Language Grammar Encyclopedia (Must Read)

Volume Label, Property Name, Description 002 <...

Detailed explanation of MYSQL database table structure optimization method

This article uses an example to illustrate the me...

Detailed explanation of the initialization mechanism in bash

Bash Initialization Files Interactive login shell...

Specific use of CSS front-end page rendering optimization attribute will-change

Preface When scroll events such as scroll and res...

Detailed explanation of the principles of Vue's responsive system

Table of contents The basic principles of Vue'...

Detailed explanation of common for loop in JavaScript statements

There are many loop statements in JavaScript, inc...

In-depth explanation of various binary object relationships in JavaScript

Table of contents Preface Relationships between v...

Detailed explanation of Vue element plus multi-language switching

Table of contents Preface How to switch between m...

How to use ES6 class inheritance to achieve a gorgeous ball effect

Table of contents introduce Implementation steps ...

Setting the engine MyISAM/InnoDB when creating a data table in MySQL

When I configured mysql, I set the default storag...

Summary of Common Mistakes in Web Design

In the process of designing a web page, designers...

MySQL big data query optimization experience sharing (recommended)

Serious MySQL optimization! If the amount of MySQ...