hansalscripts/laravel-payments
最新稳定版本:1.0.1
Composer 安装命令:
composer require hansalscripts/laravel-payments
包简介
Payment helper for Paypal, Paymob, Kashier, Hyperpay and Fawry
README 文档
README
Payment Helper of Payment Gateways ( PayPal - Paymob - Fawry - Thawani - WeAccept - Kashier - Hyperpay - Tap - Opay - Paytabs - Vodafone Cash - Orange Money - Meza Wallet - Etisalat Cash)
Supported gateways
- PayPal
- PayMob
- WeAccept
- Kashier
- Fawry
- HyperPay
- Thawani
- Tap
- Opay
- Paytabs
- Binance
- PerfectMoney
- NowPayments
- Payeer
- Telr
- Clickpay
- Coinpayments
- BigPay
- Enot
- PAYCEC
- PayPal Credit Cards
- Payrexx
- Creptomus
- E Wallets (Vodafone Cash - Orange Money - Meza Wallet - Etisalat Cash)
Installation
composer require hansalscripts/laravel-payments
Publish Vendor Files
php artisan vendor:publish --tag="laravel-payments"
laravel-payments.php file
<?php return [ #PAYMOB 'PAYMOB_API_KEY' => env('PAYMOB_API_KEY'), 'PAYMOB_INTEGRATION_ID' => env('PAYMOB_INTEGRATION_ID'), 'PAYMOB_IFRAME_ID' => env('PAYMOB_IFRAME_ID'), 'PAYMOB_HMAC' => env('PAYMOB_HMAC'), 'PAYMOB_CURRENCY'=> env('PAYMOB_CURRENCY',"EGP"), ..... ];
Web.php MUST Have Route with name “verify-payment”
Route::get('/payments/verify/{payment?}',[FrontController::class,'payment_verify'])->name('verify-payment');
How To Use
use HansalScripts\Payments\Classes\PaymobPayment; $payment = new PaymobPayment(); //pay function $payment->pay( $amount, $user_id = null, $user_first_name = null, $user_last_name = null, $user_email = null, $user_phone = null, $source = null ); //or use $payment->setUserId($id) ->setUserFirstName($first_name) ->setUserLastName($last_name) ->setUserEmail($email) ->setUserPhone($phone) ->setCurrency($currency) ->setAmount($amount) ->pay(); //pay function response [ 'payment_id'=>"", // refrence code that should stored in your orders table 'redirect_url'=>"", // redirect url available for some payment gateways 'html'=>"" // rendered html available for some payment gateways ] //verify function $payment->verify($request); //outputs [ 'success'=>true,//or false 'payment_id'=>"PID", 'message'=>"Done Successfully",//message for client 'process_data'=>""//payment response ]
Factory Pattern Use
you can pass only method name without payment key word like (Fawry,Paymob,Opay ...etc) and the factory will return the payment instance for you , use it as you want ;)
$payment = new \HansalScripts\Payments\Factories\PaymentFactory(); $payment=$payment->get(string $paymentName)->pay( $amount, $user_id = null, $user_first_name = null, $user_last_name = null, $user_email = null, $user_phone = null, $source = null );;
Some Test Cards
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-20