Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit d7406b5

Browse files
author
phx
committed
增加 Charge (支付) 的各渠道extra示例
1 parent 83dfb7e commit d7406b5

File tree

4 files changed

+280
-2
lines changed

4 files changed

+280
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ try {
101101
| `$gateway->fetchEvent()` | 查询 Event 事件 |
102102

103103
### Create Charge (创建 Charge)
104+
105+
`channelExtraFields` 参数参考 `src/Common/ChargeChannelExtras.php` 的说明
106+
104107
```php
105108
/**
106109
* @var \Omnipay\Pingpp\Message\PurchaseRequest $transaction
@@ -344,7 +347,7 @@ $response = $transferList->send();
344347

345348
### Batch Transfer (创建批量转账)
346349

347-
`recipients` 参数参考 `src/Common/Recipients.php` 的说明
350+
`recipients` 参数参考 `src/Common/BatchTransferRecipients.php` 的说明
348351

349352
```php
350353
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 下午4:12
77
*/
88

9-
$channel = 'your_channel';
9+
$channel = 'your_transfer_channel';
1010

1111
if ($channel == 'alipay') {
1212
return [

src/Common/Channels.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ abstract class Channels
9797
*/
9898
const WX_WAP = 'wx_wap';
9999

100+
/**
101+
* 微信小程序支付
102+
*/
103+
const WX_LITE = 'wx_lite';
104+
100105
/**
101106
* 易宝手机网页支付
102107
* yeepay wap payment channel

src/Common/ChargeChannelExtras.php

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: phx
5+
* Date: 2017/7/14
6+
* Time: 下午4:20
7+
*/
8+
9+
use Omnipay\Pingpp\Common\Channels;
10+
11+
$channel = 'your_charge_channel';
12+
if ($channel == Channels::ALIPAY) {
13+
return [
14+
// 可选,开放平台返回的包含账户信息的 token(授权令牌,商户在一定时间内对支付宝某些服务的访问权限)。通过授权登录后获取的 alipay_open_id ,作为该参数的 value ,登录授权账户即会为支付账户,32 位字符串。
15+
//'extern_token' => '',
16+
17+
// 可选,是否发起实名校验,T 代表发起实名校验;F 代表不发起实名校验。
18+
'rn_check' => 'T',
19+
];
20+
}
21+
22+
if ($channel == Channels::ALIPAY_PC_DIRECT) {
23+
return [
24+
// 必须,支付成功的回调地址,在本地测试不要写 localhost ,请写 127.0.0.1。URL 后面不要加自定义参数。
25+
'success_url' => 'http://example.com/success',
26+
27+
// 可选,是否开启防钓鱼网站的验证参数(如果已申请开通防钓鱼时间戳验证,则此字段必填)。
28+
'enable_anti_phishing_key' => false,
29+
30+
// 可选,客户端 IP ,用户在创建交易时,该用户当前所使用机器的IP(如果商户申请后台开通防钓鱼IP地址检查选项,此字段必填,校验用)。
31+
//'exter_invoke_ip' => '8.8.8.8',
32+
];
33+
}
34+
35+
if ($channel == Channels::ALIPAY_WAP) {
36+
return [
37+
// 必须,支付成功的回调地址,在本地测试不要写 localhost ,请写 127.0.0.1。URL 后面不要加自定义参数。
38+
'success_url' => 'http://example.com/success',
39+
40+
// 可选,支付取消的回调地址, app_pay 为true时,该字段无效,在本地测试不要写 localhost ,请写 127.0.0.1。URL 后面不要加自定义参数。
41+
'cancel_url' => 'http://example.com/cancel',
42+
43+
// 可选,2016 年 6 月 16 日之前登录 Ping++ 管理平台填写支付宝手机网站的渠道参数的旧接口商户,需要更新接口时设置此参数值为true,6月16号后接入的新接口商户不需要设置该参数。
44+
//'new_version' => true,
45+
46+
// 可选,是否使用支付宝客户端支付,该参数为true时,调用客户端支付。
47+
//'app_pay' => true,
48+
];
49+
}
50+
51+
if ($channel == Channels::APPLEPAY_UPACP) {
52+
return [];
53+
}
54+
55+
if ($channel == Channels::BFB_WAP) {
56+
return [
57+
// 必须,支付成功的回调地址,在本地测试不要写 localhost ,请写 127.0.0.1。URL 后面不要加自定义参数。
58+
'result_url' => 'http://example.com/success',
59+
60+
// 必须,是否需要登录百度钱包来进行支付。
61+
'bfb_login' => true,
62+
];
63+
}
64+
65+
if ($channel == Channels::CMB_WALLET) {
66+
return [
67+
// 必须,交易完成跳转的地址。
68+
'result_url' => 'http://example.com/success',
69+
70+
/**
71+
* 对于 p_no, seq , m_uid , mobile 这几个参数:
72+
* 1. 这几个参数是用户自定义的。
73+
* 2. 对于同一个终端用户每次请求 charge 务必使用同一套参数(确保每个参数都不变),
74+
* 任意参数变更都会导致用户重新签约,同一个用户和招行重新签约的次数有限制,超限制就会无法签约 ,导致用户无法使用。
75+
*/
76+
77+
// 必须,客户协议号,不超过 30 位的纯数字字符串。
78+
'p_no' => 'your p_no',
79+
80+
// 必须,协议开通请求流水号,不超过 20 位的纯数字字符串,请保证系统内唯一。
81+
'seq' => 'your seq',
82+
83+
// 必须,协议用户 ID,不超过 20 位的纯数字字符串。
84+
'm_uid' => 'your m_uid',
85+
86+
// 必须,协议手机号,11 位数字。
87+
'mobile' => 'your mobile',
88+
];
89+
}
90+
91+
if ($channel == Channels::FQLPAY_WAP) {
92+
return [
93+
// 必须,子商户编号,需要提交该订单商户的所属子商户编号。
94+
'c_merch_id' => 'your c_merch_id',
95+
96+
// 可选,前端回调地址,交易完成跳转的链接,不能带自定义参数。
97+
'return_url' => 'http://example.com/success',
98+
];
99+
}
100+
101+
if ($channel == Channels::JDPAY_WAP) {
102+
return [
103+
// 必须,支付完成的回调地址。
104+
'success_url' => 'http://example.com/success',
105+
106+
// 必须,支付失败页面跳转路径。
107+
'fail_url' => 'http://example.com/fail',
108+
109+
// 可选,用户交易令牌,用于识别用户信息,支付成功后会调用 success_url 返回给商户。商户可以记录这个 token 值,当用户再次支付的时候传入该 token ,用户无需再次输入银行卡信息,直接输入短信验证码进行支付。32 位字符串。
110+
//'token' => 'dsafadsfasdfadsjuyhfnhujkijunhaf',
111+
112+
// 可选,订单类型,值为0表示实物商品订单,值为 1 代表虚拟商品订单,该参数默认值为 0 。
113+
'order_type' => 0,
114+
115+
// 可选,设置是否通过手机端发起支付,值为 true 时调用手机 h5 支付页面,值为 false 时调用 PC 端支付页面,该参数默认值为 true 。
116+
'is_mobile' => true,
117+
118+
// 可选,用户账号类型,取值只能为:BIZ。传参存在问题请参考 帮助中心:https://help.pingxx.com/article/1012535/。
119+
//'user_type' => 'BIZ',
120+
121+
// 可选,商户的用户账号。传参存在问题请参考 帮助中心:https://help.pingxx.com/article/1012535/。
122+
//'user_id' => 'your user_id',
123+
];
124+
}
125+
126+
if ($channel == Channels::MMDPAY_WAP) {
127+
return [
128+
// 必须,手机号。
129+
'phone' => 'your phone',
130+
131+
// 必须,身份证号。
132+
'id_no' => 'your id_no',
133+
134+
// 必须,真实姓名。
135+
'name' => 'your name',
136+
];
137+
}
138+
139+
if ($channel == Channels::QGBC_WAP) {
140+
return [
141+
// 必须,手机号码。
142+
'phone' => 'your phone',
143+
144+
// 可选,交易完成跳转的地址。
145+
'return_url' => 'http://example.com/success',
146+
147+
// 可选,分期参数,0 代表不分期,1 代表分 3 期,2 代表分 6 期,3 代表分 9 期,4 代表分 12 期。
148+
'term' => 0,
149+
150+
// 可选,账户激活中状态跳转链接。
151+
'activate_url' => 'http://example.com/activate_url',
152+
153+
// 可选,是否显示量化派页面顶部 header,即是否显示 H5 顶部标题栏,默认为 true 时显示。
154+
'has_header' => true,
155+
];
156+
}
157+
158+
if ($channel == Channels::QPAY) {
159+
return [
160+
// 必须,客户端设备类型,取值范围: "ios" ,"android"。
161+
'device' => 'ios',
162+
];
163+
}
164+
165+
if ($channel == Channels::UPACP) {
166+
return [
167+
];
168+
}
169+
170+
if ($channel == Channels::UPACP_PC) {
171+
return [
172+
// 必须,支付成功的回调地址,在本地测试不要写 localhost ,请写 127.0.0.1。URL 后面不要加自定义参数。
173+
'result_url' => 'http://example.com/success',
174+
];
175+
}
176+
177+
if ($channel == Channels::UPACP_WAP) {
178+
return [
179+
// 必须,支付成功的回调地址,在本地测试不要写 localhost ,请写 127.0.0.1。URL 后面不要加自定义参数。
180+
'result_url' => 'http://example.com/success',
181+
];
182+
}
183+
184+
if ($channel == Channels::WX) {
185+
return [
186+
// 可选,指定支付方式,指定不能使用信用卡支付可设置为 no_credit 。
187+
'limit_pay' => 'no_credit',
188+
189+
// 可选,商品标记,代金券或立减优惠功能的参数。
190+
//'goods_tag' => 'your goods_tag',
191+
];
192+
}
193+
194+
if ($channel == Channels::WX_LITE) {
195+
return [
196+
// 可选,指定支付方式,指定不能使用信用卡支付可设置为 no_credit 。
197+
'limit_pay' => 'no_credit',
198+
199+
// 可选,商品标记,代金券或立减优惠功能的参数。
200+
//'goods_tag' => 'your goods_tag',
201+
202+
// 必须,用户在商户 appid 下的唯一标识。
203+
'open_id' => 'openidxxxxxxxxxxxx',
204+
];
205+
}
206+
207+
if ($channel == Channels::WX_PUB) {
208+
return [
209+
// 可选,指定支付方式,指定不能使用信用卡支付可设置为 no_credit 。
210+
'limit_pay' => 'no_credit',
211+
212+
// 可选,商品标记,代金券或立减优惠功能的参数。
213+
//'goods_tag' => 'your goods_tag',
214+
215+
// 必须,用户在商户 appid 下的唯一标识。
216+
'open_id' => 'openidxxxxxxxxxxxx',
217+
];
218+
}
219+
220+
if ($channel == Channels::WX_PUB_QR) {
221+
return [
222+
// 可选,指定支付方式,指定不能使用信用卡支付可设置为 no_credit 。
223+
'limit_pay' => 'no_credit',
224+
225+
// 可选,商品标记,代金券或立减优惠功能的参数。
226+
//'goods_tag' => 'your goods_tag',
227+
228+
// 必须,商品 ID,1-32 位字符串。此 id 为二维码中包含的商品 ID,商户可自定义。
229+
'product_id' => 'your product id',
230+
];
231+
}
232+
233+
if ($channel == Channels::WX_WAP) {
234+
return [
235+
// 可选,支付完成的回调地址。
236+
'result_url' => 'http://example.com/success',
237+
238+
// 可选,商品标记,代金券或立减优惠功能的参数。
239+
//'goods_tag' => 'your goods_tag',
240+
];
241+
}
242+
243+
if ($channel == Channels::YEEPAY_WAP) {
244+
return [
245+
// 必须,商品类别码,商品类别码参考链接 :https://www.pingxx.com/api#%E6%98%93%E5%AE%9D%E6%94%AF%E4%BB%98%E5%95%86%E5%93%81%E7%B1%BB%E5%9E%8B%E7%A0%81 。
246+
'product_category' => '1',
247+
248+
// 必须,用户标识,商户生成的用户账号唯一标识,最长 50 位字符串。
249+
'identity_id' => 'your identity_id',
250+
251+
// 必须,用户标识类型,用户标识类型参考链接:https://www.pingxx.com/api#%E6%98%93%E5%AE%9D%E6%94%AF%E4%BB%98%E7%94%A8%E6%88%B7%E6%A0%87%E8%AF%86%E7%B1%BB%E5%9E%8B%E7%A0%81 。
252+
'identity_type' => 1,
253+
254+
// 必须,终端类型,对应取值 0:IMEI, 1:MAC, 2:UUID, 3:other。
255+
'terminal_type' => 1,
256+
257+
// 必须,终端 ID。
258+
'terminal_id' => 'your terminal_id',
259+
260+
// 必须,用户使用的移动终端的 UserAgent 信息。
261+
'user_ua' => 'your user_ua',
262+
263+
// 必须,前台通知地址。
264+
'result_url' => 'http://example.com/success',
265+
];
266+
}
267+
268+
269+
270+

0 commit comments

Comments
 (0)