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

Analysis of CocosCreator's new resource management system

Table of contents 1. Resources and Construction 1...

Solution to the problem of mysql service starting but not connecting

The mysql service is started, but the connection ...

Quick solution for forgetting MySQL8 password

Preface When we forget the MySQL database passwor...

CSS positioning layout (position, positioning layout skills)

1. What is positioning? The position attribute in...

js canvas implements verification code and obtains verification code function

This article example shares the specific code of ...

How to connect Django 2.2 to MySQL database

1. The error information reported when running th...

The pitfalls of deploying Angular projects in Nginx

Searching online for methods to deploy Angular pr...

Detailed explanation of querying JSON format fields in MySQL

During the work development process, a requiremen...

Linux system command notes

This article describes the linux system commands....

How to draw special graphics in CSS

1. Triangle Border settings Code: width: 300px; h...

How to build a React project with Vite

Table of contents Preface Create a Vite project R...

Introduction to generating Kubernetes certificates using OpenSSL

Kubernetes supports three types of authentication...