9
9
[ ![ Software License] [ ico-license ]] ( LICENSE.md )
10
10
[ ![ Latest Version on Packagist] [ ico-version ]] [ link-packagist ]
11
11
[ ![ Total Downloads on Packagist] [ ico-download ]] [ link-packagist ]
12
- [ ![ StyleCI] ( https://github.styleci.io/repos/169948762 /shield?branch=master )] ( https://github.styleci.io/repos/169948762 )
13
- [ ![ Maintainability] ( https://api.codeclimate.com/v1/badges/e6a80b17298cb4fcb56d /maintainability )] ( https://codeclimate.com/github/shetabit/multipay/maintainability )
12
+ [ ![ StyleCI] ( https://github.styleci.io/repos/268039684 /shield?branch=master )] ( https://github.styleci.io/repos/268039684 )
13
+ [ ![ Maintainability] ( https://api.codeclimate.com/v1/badges/3aa790c544c9f2132b16 /maintainability )] ( https://codeclimate.com/github/shetabit/multipay/maintainability )
14
14
[ ![ Quality Score] [ ico-code-quality ]] [ link-code-quality ]
15
15
16
16
这是一个用于整合支付网关的PHP包。这个包依赖 ` PHP 7.2+ ` .
17
17
18
18
[ 捐赠我] ( https://yekpay.me/mahdikhanzadi ) 如果你喜欢这个包:sunglasses : :bowtie:
19
19
20
+ For ** Laravel** integration you can use [ shetabit/payment] ( https://github.com/shetabit/payment ) package.
21
+
20
22
> 此软件包可用于多个驱动程序,如果在[ 当前驱动程序列表] ( #list-of-available-drivers ) 中找不到驱动程序,则可以创建它们
21
23
22
24
- [ داکیومنت فارسی] [ link-fa ]
45
47
- [ License] ( #license )
46
48
47
49
# 可用驱动列表
48
- - [ asanpardakht] ( https://asanpardakht.ir/ ) :warning : (未测试)
50
+
51
+ - [ aqayepardakht] ( https://aqayepardakht.ir/ ) :heavy_check_mark :
52
+ - [ asanpardakht] ( https://asanpardakht.ir/ ) :heavy_check_mark :
53
+ - [ atipay] ( https://www.atipay.net/ ) :heavy_check_mark :
54
+ - [ azkiVam (Installment payment)] ( https://www.azkivam.com/ ) :heavy_check_mark :
49
55
- [ behpardakht (mellat)] ( http://www.behpardakht.com/ ) :heavy_check_mark :
56
+ - [ bitpay] ( https://bitpay.ir/ ) :heavy_check_mark :
57
+ - [ digipay] ( https://www.mydigipay.com/ ) :heavy_check_mark :
58
+ - [ etebarino (Installment payment)] ( https://etebarino.com/ ) :heavy_check_mark :
59
+ - [ fanavacard] ( https://www.fanava.com/ ) :heavy_check_mark :
60
+ - [ gooyapay] ( https://gooyapay.ir/ ) :heavy_check_mark :
50
61
- [ idpay] ( https://idpay.ir/ ) :heavy_check_mark :
51
62
- [ irankish] ( http://irankish.com/ ) :heavy_check_mark :
63
+ - [ jibit] ( https://jibit.ir/ ) :heavy_check_mark :
64
+ - [ local] ( #local-driver ) :heavy_check_mark :
65
+ - [ minipay] ( https://minipay.me/ ) :heavy_check_mark :
52
66
- [ nextpay] ( https://nextpay.ir/ ) :heavy_check_mark :
67
+ - [ omidpay] ( https://omidpayment.ir/ ) :heavy_check_mark :
53
68
- [ parsian] ( https://www.pec.ir/ ) :heavy_check_mark :
54
69
- [ pasargad] ( https://bpi.ir/ ) :heavy_check_mark :
70
+ - [ payfa] ( https://payfa.com/ ) :heavy_check_mark :
55
71
- [ payir] ( https://pay.ir/ ) :heavy_check_mark :
56
- - [ paypal] ( http://www.paypal.com/ ) (在下一个版本中很快就支持了 )
72
+ - [ paypal] ( http://www.paypal.com/ ) (will be added soon in next version )
57
73
- [ payping] ( https://www.payping.ir/ ) :heavy_check_mark :
58
74
- [ paystar] ( http://paystar.ir/ ) :heavy_check_mark :
59
75
- [ poolam] ( https://poolam.ir/ ) :heavy_check_mark :
76
+ - [ rayanpay] ( https://rayanpay.com/ ) :heavy_check_mark :
60
77
- [ sadad (melli)] ( https://sadadpsp.ir/ ) :heavy_check_mark :
61
78
- [ saman] ( https://www.sep.ir ) :heavy_check_mark :
79
+ - [ sep (saman electronic payment) Keshavarzi & Saderat] ( https://www.sep.ir ) :heavy_check_mark :
80
+ - [ sepehr (saderat)] ( https://www.sepehrpay.com/ ) :heavy_check_mark :
81
+ - [ sepordeh] ( https://sepordeh.com/ ) :heavy_check_mark :
82
+ - [ sizpay] ( https://www.sizpay.ir/ ) :heavy_check_mark :
83
+ - [ toman] ( https://tomanpay.net/ ) :heavy_check_mark :
84
+ - [ snapppay] ( https://snapppay.ir/ ) :heavy_check_mark :
85
+ - [ vandar] ( https://vandar.io/ ) :heavy_check_mark :
86
+ - [ walleta (Installment payment)] ( https://walleta.ir/ ) :heavy_check_mark :
62
87
- [ yekpay] ( https://yekpay.com/ ) :heavy_check_mark :
63
88
- [ zarinpal] ( https://www.zarinpal.com/ ) :heavy_check_mark :
64
89
- [ zibal] ( https://www.zibal.ir/ ) :heavy_check_mark :
76
101
- wepay
77
102
- payoneer
78
103
- paysimple
79
- - saderat
80
104
81
105
> 如果找不到你需要的,您可以创建你自己的驱动,阅读` 创建自定义驱动 ` 部分,可以了解更多
82
106
@@ -122,7 +146,7 @@ b. 在配置文件中,您可以将 `default`设置项设置为你希望的付
122
146
c. Instantiate the ` Payment ` class and ** pass configs to it** like the below:
123
147
124
148
``` php
125
- use Shetabit\MultipayMultipay;
149
+ use Shetabit\Multipay\Payment
126
150
127
151
// load the config file from your project
128
152
$paymentConfig = require('path/to/payment.php');
@@ -184,24 +208,30 @@ $invoice->detail('detailName1','your detail1 goes here')
184
208
``` php
185
209
// At the top of the file.
186
210
use Shetabit\Multipay\Invoice;
187
- use Shetabit\Multipay\Facade\ Payment;
211
+ use Shetabit\Multipay\Payment;
188
212
...
189
213
214
+ // load the config file from your project
215
+ $paymentConfig = require('path/to/payment.php');
216
+
217
+ $payment = new Payment($paymentConfig);
218
+
219
+
190
220
// Create new invoice.
191
221
$invoice = (new Invoice)->amount(1000);
192
222
193
223
// Purchase the given invoice.
194
- Payment:: purchase($invoice,function($driver, $transactionId) {
224
+ $payment-> purchase($invoice,function($driver, $transactionId) {
195
225
// We can store $transactionId in database.
196
226
});
197
227
198
228
// Purchase method accepts a callback function.
199
- Payment:: purchase($invoice, function($driver, $transactionId) {
229
+ $payment-> purchase($invoice, function($driver, $transactionId) {
200
230
// We can store $transactionId in database.
201
231
});
202
232
203
233
// You can specify callbackUrl
204
- Payment:: callbackUrl('http://yoursite.com/verify')->purchase(
234
+ $payment-> callbackUrl('http://yoursite.com/verify')->purchase(
205
235
$invoice,
206
236
function($driver, $transactionId) {
207
237
// We can store $transactionId in database.
@@ -216,19 +246,25 @@ Payment::callbackUrl('http://yoursite.com/verify')->purchase(
216
246
``` php
217
247
// At the top of the file.
218
248
use Shetabit\Multipay\Invoice;
219
- use Shetabit\Multipay\Facade\ Payment;
249
+ use Shetabit\Multipay\Payment;
220
250
...
221
251
252
+ // load the config file from your project
253
+ $paymentConfig = require('path/to/payment.php');
254
+
255
+ $payment = new Payment($paymentConfig);
256
+
257
+
222
258
// Create new invoice.
223
259
$invoice = (new Invoice)->amount(1000);
224
260
// Purchase and pay the given invoice.
225
261
// You should use return statement to redirect user to the bank page.
226
- return Payment:: purchase($invoice, function($driver, $transactionId) {
262
+ return $payment-> purchase($invoice, function($driver, $transactionId) {
227
263
// Store transactionId in database as we need it to verify payment in the future.
228
264
})->pay()->render();
229
265
230
266
// Do all things together in a single line.
231
- return Payment:: purchase(
267
+ return $payment-> purchase(
232
268
(new Invoice)->amount(1000),
233
269
function($driver, $transactionId) {
234
270
// 把交易ID保存到数据库.
@@ -237,7 +273,7 @@ return Payment::purchase(
237
273
})->pay()->render();
238
274
239
275
// Retrieve json format of Redirection (in this case you can handle redirection to bank gateway)
240
- return Payment:: purchase(
276
+ return $payment-> purchase(
241
277
(new Invoice)->amount(1000),
242
278
function($driver, $transactionId) {
243
279
// 把交易ID保存到数据库.
@@ -252,15 +288,21 @@ return Payment::purchase(
252
288
253
289
``` php
254
290
// At the top of the file.
255
- use Shetabit\Multipay\Facade\ Payment;
291
+ use Shetabit\Multipay\Payment;
256
292
use Shetabit\Multipay\Exceptions\InvalidPaymentException;
257
293
...
258
294
295
+ // load the config file from your project
296
+ $paymentConfig = require('path/to/payment.php');
297
+
298
+ $payment = new Payment($paymentConfig);
299
+
300
+
259
301
// 您需要验证支付机构的回传数据,以确保付款成功
260
302
// 我们需要使用交易ID来验证
261
303
// 使用交易金额来验证,也是一个很好的方法
262
304
try {
263
- $receipt = Payment:: amount(1000)->transactionId($transaction_id)->verify();
305
+ $receipt = $payment-> amount(1000)->transactionId($transaction_id)->verify();
264
306
265
307
// You can show payment referenceId to the user.
266
308
echo $receipt->getReferenceId();
@@ -283,8 +325,14 @@ try {
283
325
``` php
284
326
// At the top of the file.
285
327
use Shetabit\Multipay\Invoice;
286
- use Shetabit\Multipay\Facade\ Payment;
328
+ use Shetabit\Multipay\Payment;
287
329
...
330
+
331
+ // load the config file from your project
332
+ $paymentConfig = require('path/to/payment.php');
333
+
334
+ $payment = new Payment($paymentConfig);
335
+
288
336
289
337
// Create new invoice.
290
338
$invoice = (new Invoice)->amount(1000);
@@ -303,11 +351,17 @@ try {
303
351
``` php
304
352
// At the top of the file.
305
353
use Shetabit\Multipay\Invoice;
306
- use Shetabit\Multipay\Facade\ Payment;
354
+ use Shetabit\Multipay\Payment;
307
355
...
308
356
357
+ // load the config file from your project
358
+ $paymentConfig = require('path/to/payment.php');
359
+
360
+ $payment = new Payment($paymentConfig);
361
+
362
+
309
363
// Purchase (we set invoice to null).
310
- Payment:: callbackUrl($url)->amount(1000)->purchase(
364
+ $payment-> callbackUrl($url)->amount(1000)->purchase(
311
365
null,
312
366
function($driver, $transactionId) {
313
367
// We can store $transactionId in database.
@@ -320,14 +374,20 @@ try {
320
374
``` php
321
375
// At the top of the file.
322
376
use Shetabit\Multipay\Invoice;
323
- use Shetabit\Multipay\Facade\ Payment;
377
+ use Shetabit\Multipay\Payment;
324
378
...
325
379
380
+ // load the config file from your project
381
+ $paymentConfig = require('path/to/payment.php');
382
+
383
+ $payment = new Payment($paymentConfig);
384
+
385
+
326
386
// Create new invoice.
327
387
$invoice = (new Invoice)->amount(1000);
328
388
329
389
// Purchase the given invoice.
330
- Payment:: via('driverName')->purchase(
390
+ $payment-> via('driverName')->purchase(
331
391
$invoice,
332
392
function($driver, $transactionId) {
333
393
// We can store $transactionId in database.
@@ -340,22 +400,28 @@ try {
340
400
``` php
341
401
// At the top of the file.
342
402
use Shetabit\Multipay\Invoice;
343
- use Shetabit\Multipay\Facade\ Payment;
403
+ use Shetabit\Multipay\Payment;
344
404
...
345
405
406
+ // load the config file from your project
407
+ $paymentConfig = require('path/to/payment.php');
408
+
409
+ $payment = new Payment($paymentConfig);
410
+
411
+
346
412
// Create new invoice.
347
413
$invoice = (new Invoice)->amount(1000);
348
414
349
415
// Purchase the given invoice with custom driver configs.
350
- Payment:: config('mechandId', 'your mechand id')->purchase(
416
+ $payment-> config('mechandId', 'your mechand id')->purchase(
351
417
$invoice,
352
418
function($driver, $transactionId) {
353
419
// We can store $transactionId in database.
354
420
}
355
421
);
356
422
357
423
// Also we can change multiple configs at the same time.
358
- Payment:: config(['key1' => 'value1', 'key2' => 'value2'])->purchase(
424
+ $payment-> config(['key1' => 'value1', 'key2' => 'value2'])->purchase(
359
425
$invoice,
360
426
function($driver, $transactionId) {
361
427
// We can store $transactionId in database.
@@ -455,11 +521,11 @@ class MyDriver extends Driver
455
521
]
456
522
```
457
523
458
- ** Note:- ** 必须确保 ` map ` 数组的键与 ` drivers ` 数组的键相同。
524
+ ** Note:** 必须确保 ` map ` 数组的键与 ` drivers ` 数组的键相同。
459
525
460
- #### 事件
526
+ #### 事件:
461
527
462
- ** Notice 1: ** event listeners will be registered globaly for all payments.
528
+ ** Notice 1:** event listeners will be registered globaly for all payments.
463
529
464
530
** Notice 2:** if you want your listeners work correctly, you ** must** subcribe them before the target event dispatches.
465
531
0 commit comments