In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "what is the principle behind the Android aggregate collection code", so the editor summarizes the following content for you, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what is the principle behind the Android aggregation collection code" article.
First of all, let's introduce Wechat Native pay, quoting the explanation on Wechat's official website:
Native payment is a mode in which the merchant system generates the payment QR code according to the WeChat Pay agreement, and the user uses Wechat to "scan" to complete the payment. This model is suitable for PC website payment, physical store item or order payment, media advertising payment and so on.
To put it simply, the merchant calls the API WeChat Pay at the backend, and Wechat returns the link to the prepaid transaction in the following format:
Weixin://wxpay/bizpayurl?sr=123456
The merchant then converts it into a QR code and provides it to the customer to pay using Wechat scan code.
This payment method can be used in PC shopping scenarios, such as League of Legends's official website to purchase game props:
Since Wechat Native payment can eventually be changed into a QR code to complete the payment, can the aggregate collection code use Wechat Native payment?
The answer is yes, but not suitable, the product experience is not very good.
It is best to use WeChat Pay's other payment product JSAPI to pay.
As for the reason, don't worry, you'll understand it later.
JSAPI payment, also known as official account payment, the noun explanation quotes the official website introduction:
JSAPI payment is that the user opens the merchant's H5 page in Wechat. On the H5 page, the merchant calls up the WeChat Pay module to complete the payment by calling the JSAPI interface provided by WeChat Pay.
The specific business process is as follows:
In daily life, many application scenarios use this method of payment, such as buying courses on the official geek time account.
Compared with Wechat Native, this kind of payment method is more troublesome, and it also needs to use the Wechat official account to log in and authorize the function to obtain the user's openid.
In addition, when we call the Wechat JSAPI backend API and get the relevant parameters returned by Wechat, we also need to use the JSSDK of Wechat to arouse WeChat Pay.
Core principle of aggregate collection code
After understanding the underlying payment methods required for aggregate payment, let's take a look at the core principles of aggregate collection codes.
The business process of aggregate collection code is as follows:
In the first step, after users scan the code using Wechat / Alipay APP, a cashier page will be opened.
This cashier page can be adaptive, and different APP displays different styles. For example, Alipay opens the cashier to display Alipay's logo, and Wechat opens to show Wechat's logo.
In the second step, the user enters the amount at the cashier, and clicking on pay will evoke the payment pop-up window of APP.
All right, observing this process, we can find that after scanning the code, the background application needs to identify whether the current APP is Wechat or Alipay.
So how to determine which APP is currently in use?
In fact, the principle is very simple. If you open a link in Alipay / Wechat, you will actually use a built-in browser to initiate a HTTP request, and the request header of HTTP will carry User-Agent (UA), which is used to identify the application type, operating system, software developer and version number of the user agent software.
The browser in Wechat / Alipay initiates a HTTP request with the following User-Agent:
Alipay UCBrowser/11.5.0.939 UCBS/2.10.1.6 Mobile Safari/537.36 AliApp (AP/10.0.15.051805) AlipayClient/10.0.15.051805 Language/zh-Hans Wechat MQQBrowser/6.2 TBS 043220 Safari/537.36 MicroMessenger/6.5.8.1060 NetType/4G Language/zh_CN
It should be noted here that different models of mobile phones, different versions of APP,User-Agent may not be the same, in fact, we just need to judge whether it contains some keywords, for example, as long as User-Agent contains MicroMessenger is Wechat, including AlipayClient is Alipay.
Here is an example of using the Java code:
String userAgent = request.getHeader ("user-agent"); if (Objects.equals (userAgent, "AlipayClient")) {/ / Alipay} else if (Objects.equals (userAgent, "MicroMessenger")) {/ / Wechat}
After this problem is solved, the later process is very simple, as long as you call Wechat / Alipay's JSAPI payment interface, get the relevant parameters, and then call up the payment.
To be exact, the official name of JSAPI payment on Alipay is Alipay Life account.
Explain the above question here, why can't aggregate collection codes use Wechat Native to pay?
This is mainly because the return of Wechat Native payment API is a Wechat custom schema protocol, which can only be opened through Wechat code scanning to evoke payment.
How to aggregate the collection code to use Wechat Native to pay, after the cashier submits the amount, you need to transfer the Wechat return transaction link to a two-dimensional display on the page, and then the user uses the built-in QR code recognition function of Wechat to evoke the payment.
In this way, it will affect the product experience and reduce the success rate of payment.
Alipay also has a payment interface similar to Wechat Native-pay face-to-face, scan the code and return the payment link after a successful call.
Then here you can ask a small question, whether the aggregate collection code can use Alipay face-to-face payment interface?
The answer is yes, and the experience is better than Wechat Native payment.
This is because the Alipay return link is a standard HTTP connection, as follows:
Https://qr.alipay.com/xxxx
As long as this link is opened in Alipay, you can evoke payment.
So if the aggregate collection code uses Alipay face-to-face payment interface, after the cashier's amount is submitted, when you get the payment link returned by Alipay, as long as you use HTTP 302 to jump to the payment link in the application, you can evoke Alipay.
Voiceover: I always thought that Alipay, like Wechat, could not be used.
In this way, in fact, there are two ways to use the payment method at the bottom of the aggregate collection code:
Wechat JSAPI payment / Alipay Life payment
Wechat JSAPI payment / Alipay face-to-face payment
So how do you choose that? Personally, it is recommended to use the first scheme. Wechat and Alipay all use JSAPI.
Mainly because as long as the 302 jump evokes Alipay, it will close our cashier page, so that the whole WeChat Pay and Alipay payment process is not the same.
Second, when the user pays successfully, JSAPI payment can also be redirected to a success page, where we can show the results, or coquettish a little bit, post some advertisements, or drain other official accounts.
However, if you use the payment code to pay face-to-face, after the payment is completed, the page will be closed, and there will be no way to complete the payment page jump.
Aggregate collection code core process
After introducing the principle, the following mainly introduces the business process of the mainstream aggregate collection codes in the market. In fact, aggregate collection codes can be divided into three categories:
Static aggregate collection code
Dynamic aggregate collection code
UnionPay static QR code
The static aggregate collection code is similar to the following, which requires the user to enter the amount actively and can be used indefinitely.
On the other hand, the dynamic aggregate collection code can only be used once, and the amount is specified by the merchant, and users can pay the specified amount as long as they scan the code.
This kind of application scenario, for example, bilibili buys big members:
UnionPay static QR code is actually similar in function to static aggregate collection code, but it has more functions to support UnionPay payment.
In addition to this, the main difference is that UnionPay's static QR code is UnionPay's QR code, and the corresponding address behind it is UnionPay's address, similar to the following:
Https://qr.95516.com/00010000/xxx static aggregate collection code process
The main payment process of static aggregate collection code can be divided into two steps: the first step is login authorization.
The login authorization here generally uses Wechat and Alipay anonymous login authorization function, so that ordinary users are actually unaware of this process.
Voiceover: if you are a programmer, you may feel that this process has gone through many jumps.
In the second step, after the user enters the amount at the cashier, the corresponding order will be created inside the app, and then the JSAPI payment of Wechat / Alipay will be called.
In addition, if Alipay uses face-to-face sweep code payment, then there is no need for the first step to login authorization, you can jump to the cashier to initiate payment.
Dynamic aggregation of collection code flow
In fact, the dynamic aggregate collection code is generally similar to the static collection code, except that the corresponding order has been created inside the dynamic code, and the follow-up process is similar to the static aggregation collection code.
UnionPay static QR code flow
If you use Wechat or Alipay to scan the code to open the UnionPay QR code, it will open our own cashier page, and the follow-up process is actually exactly the same as the static aggregate cashier code.
But if you use the APP of pay UnionPay to scan the code, such as the mobile phones of major banks such as APP, Meituan, JD.com, etc., you will pay the page separately in these APP, and then complete the payment.
The function of our UnionPay QR code will report a jump address in the backstage of UnionPay, such as
Https://www.heihei.com
When the user uses Wechat / Alipay to access the UnionPay QR code, the UnionPay background recognizes the access request User-Agent, and then the background splices the redirect address according to the rules.
The stitching rules are as follows:
Https://www.heihei.com?qrCode=URLENCODE(https://qr.95516.com/00010000/xxx)
The above is the content of this article on "what is the principle behind the Android aggregate collection code". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 229
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.