Alipay APP payment, the most complete walkthrough, you will see, here is the actual operation of every step to write down, and watch the video is no difference, and I this is a series, welcome to pay attention to, like the best.
The blogger here all is a word, and the operation of a record, and pro test, do not understand all can start
Alipay Payment docking (back-end JAVA, Nodejs)
There is app payment below
First apply for app payment
To apply for the application
Login alipay open platform, and then choose “Webpage & Mobile Application” from the navigation.
Then apply all the way down, just follow the instructions, there will be no screenshots here.
This is a really important point, see this picture, click on other, there’s an app to pay, click On Add. (Default is not this permission)
This problem has been bothering me for two days
To generate the signature
Click on sign up and download their tool.
As shown in figure
Click to generate the private key. (This is not Java, if it is Java, click Java)
Then save the private key, remember to save, or click again before the missing.
Then click to get the SCR file.
(If it is not Java, you can also click copy public key, because CSR generates certificate, this certificate is Javasdk native support, non-Java implementation)
Upload a public key or CSR
Then upload the public key, or SCR, in the alipay application.
As shown in figure
Once you set the mode, you cannot change it
Then the setting is completed, at this time if it is a public key, click copy [Alipay public key], is a certificate click download Alipay certificate, other need to download according to download, can also download later. We don’t need it at the moment.
I use certificates
Download the alipay | public key certificate
As shown in figure
Then you can start coding
Download the corresponding SDK and pass in the parameters.
By the way, above you may see the gateway and the callback. The gateway is the callback for the result of the successful payment, and the callback is the message that Ali sends you for the exception and other information.
Oh, remember to write Alipay. Trade.app.pay, this is app payment, make no mistake.
That’s it. If the app doesn’t work, download and verify it yourself, because it may be the app’s fault
Openclub.alipay.com/club/histor… Download app check here, if you can, that is the problem of app.
I am here on a current can download apk address alipaybbs.oss-cn-hangzhou.aliyuncs.com/1807/thread…
One other thing, it’s possible, is that it’s generated with a domain name in front of it and a question mark after it, so make sure that everything in front of the question mark is eliminated.
— Press me this can, if you can’t look again, reflect on yourself —
If you do not have the permission, you can apply for app payment in alipay merchants.
Perform the following steps: Create an application > Manage an application > Add a Function > Online application
Remember is the merchant pays treasure, with above open pay treasure is different.
Here the application needs to upload the business license, APP download address and test account. If it is not online, upload the document, which supports the World problem, and there should be at least three screenshots in the document, such as (home page, main business interface, payment interface) the payment interface should explain the range of amount, such as a single order less than 1W yuan. (Uploading personal interface and so on will definitely be rejected)
APP, Flutter Alipay payment
Here I’m using a plugin that someone else has integrated
sy_flutter_alipay
Install
Git reference to Dependencies. If you don’t have a local reference, git reference to dependencies
sy_flutter_alipay:
git:
url: https://github.com/lishuhao/sy_flutter_alipay
Copy the code
Add urlScheme (IOS)
Then add your own urlScheme if you don’t have one.
UrlScheme is a request protocol, just like HTTP, that is known by native speakers, but not by native speakers.
How to add?
Open Xcode, if there is no import, click import, the file imported is ios/Runner, then click Runner on the left, then the right side appears, click Info on tabs, find the URL Type, and then you see the urlScheme, and then Type it in.
As shown in figure
If you really don’t want to use Xcode, go to ios/Runner/info.plist and add the following two sentences
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>So this is just setting up your own urlScheme</string>
</array>
</dict>
</array>
Copy the code
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Copy the code
USE
import 'package:sy_flutter_alipay/sy_flutter_alipay.dart'; . var result = await SyFlutterAlipay.pay( payInfo, urlScheme:'Your ios urlScheme'// urlScheme isSandbox:true// Whether the environment is sandbox, android only);print(result);
Copy the code
Done, but there may be problems in the emulator, then use the real machine, install the connection does not need to say, insert USB, directly run, if it is IOS real machine run, search, or see my next article, how to IOS real machine run, space is limited, goodbye
–END–