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

A possible bug when MySQL executes the sum function on the window function

When using MySql's window function to collect...

How to use Dockerfile to create a mirror of the Java runtime environment

The current environment is: Centos 7.5 docker-ce ...

A Deep Dive into the MySQL InnoDB Storage Engine

Preface In MySQL, InnoDB belongs to the storage e...

How to quickly log in to MySQL database without password under Shell

background When we want to log in to the MySQL da...

Summary of MySQL InnoDB architecture

Table of contents introduction 1. Overall archite...

TABLE tags (TAGS) detailed introduction

Basic syntax of the table <table>...</tab...

js canvas realizes circular water animation

This article example shares the specific code of ...

Vue+element+oss realizes front-end fragment upload and breakpoint resume

Pure front-end implementation:切片上傳斷點續傳.斷點續傳needs ...

Detailed explanation of how to use Tomcat Native to improve Tomcat IO efficiency

Table of contents Introduction How to connect to ...

Solution to 404 error when downloading apk file from IIS server

Recently, when using IIS as a server, the apk fil...

Tips for importing csv, excel or sql files into MySQL

1. Import csv file Use the following command: 1.m...

Installation tutorial of MySQL 5.1 and 5.7 under Linux

The operating system for the following content is...

Typescript+react to achieve simple drag and drop effects on mobile and PC

This article shares the specific code of typescri...

Introduction to MySQL MHA operation status monitoring

Table of contents 1. Project Description 1.1 Back...

HTML code to add quantity badge to message button

HTML code: <a onclick="goMessage();"...