Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of the process of Fast docking with personal WeChat Pay Interface of payjq

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces an example analysis of the process of quickly docking payjq personal WeChat Pay interface, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

Recently in the understanding of personal payment interface, hoping to solve the problem of my payment on Wechat. Find a lot of platforms to compare again and again, feel that payjq is more professional. Support Alipay and Wechat at the same time, as my Alipay has not been opened (need to have a certain amount of traffic to be opened), this article focuses on the docking of Wechat cashier mode. Take notes.

Cashier mode docking is actually very simple. Officially, there are development kits that can be used directly, or it is relatively easy to develop on your own.

I. the method of individual implementation through code

Configure merchant number and communication key

$mchid ='*'; / / PAYJQ merchant ID $key ='*'; / / communication key

Construct an order

/ / construct order parameters $data = ['mchid' = > $mchid,' body' = >'I am a test order title', 'total_fee' = > 1,' out_trade_no' = > 'payjq_jspay_demo_'. Time (),]

Signature algorithm

/ / get the signature function sign ($data, $key) {array_filter ($data); ksort ($data); return strtoupper (md5 (http_build_query ($data)). '& key='. $key));}

Order data countersign

/ / add data signature $data ['sign'] = sign ($data, $key)

Browser jump

/ / browser jumps to the cashier $url = 'https://payjq.cn/api/cashier?'. Http_build_query ($data); header ('Location:'. $url)

All the steps have been completed. Payment can be initiated normally.

What needs to be reminded is that the last step of the browser jump must be initiated through the browser and cannot be initiated after the back-end code has obtained it.

Second, the processing of asynchronous notification

For example, my domain name is http://www.xxx.com, and the url that receives asynchronous notifications is http://www.xxx.com/payjq/notify.php. Just add the following fields when constructing the order.

/ / construct order parameters $data = ['mchid' = > $mchid,' body' = >'I am a test order title', 'total_fee' = > 1,' out_trade_no' = > 'payjq_jspay_demo_'. Time (), 'notify_url' = >' http://www.xxx.com/payjq/notify.php',]

In this way, after the user payment is completed, my server can receive asynchronous notifications. After testing, the arrival time of asynchronous notification is generally received within 1 second, and the delay is not felt. It's just that when I poll at the front end, the frequency of polling every three seconds is relatively low.

Thank you for reading this article carefully. I hope the article "sample Analysis of the process of quickly docking payjq personal WeChat Pay Interface" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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: 0

*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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report