Application scenarios of enterprise payment: Public accounts make payments to users who have followed them, such as processing refunds, financial settlements, etc. This article mainly shares with you the example code of developing WeChat payment enterprise payment in PHP, hoping to help everyone.
1. The certificate needs to be the certificate from your own merchant (note: the certificate path must be an absolute path. If you use a relative path, the following error will be reported.
unable to use client certificate (no key found or wrong pass phrase?)
2. Just fill in your own appid, secret and key
Let’s talk about the implementation first. Idea:
1. First get the openid, the specific method is as follows
2. Fill in the required parameters, generate a signature, etc., the specific method is as follows
#Parameter reference: Enterprise payment API documentation1. Get CODE (index.php page)##.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
* API 参数
* @var array
* ‘mch_appid’ # 公众号APPID
* ‘mchid’ # 商户号
* ‘device_info’ # 设备号
* ‘nonce_str’ # 随机字符串
* ‘partner_trade_no’ # 商户订单号
* ‘openid’ # 收款用户openid
* ‘check_name’ # 校验用户姓名选项 针对实名认证的用户
* ‘re_user_name’ # 收款用户姓名
* ‘amount’ # 付款金额
* ‘desc’ # 企业付款描述信息
* ‘spbill_create_ip’ # Ip地址
* ‘sign’ # 签名
*/
Copy after login
1 2 3 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
1 |
|
Detailed explanation of the PHP backend interface of App WeChat payment
Research and sharing on WeChat payment interface
Use PHP to implement APP Example analysis of WeChat payment
The above is the detailed content of PHP development WeChat payment enterprise payment example code. For more information, please follow other related articles on the PHP Chinese website!