engwaqas / paymentgateway
一个用于管理多个支付网关的laravel包
Requires
- php: ^7.3
- anandsiddharth/laravel-paytm-wallet: ^2.0.0
- billowapp/payfast: ^0.4.0
- kingflamez/laravelrave: ^v4.2.0
- laravel/framework: ^8.0
- mercadopago/dx-php: ^2.4.4
- midtrans/midtrans-php: ^2.5
- mollie/laravel-mollie: ^2.0
- razorpay/razorpay: 2.*
- srmklive/paypal: ~3.0
- stripe/stripe-php: ^7.103
- tzsk/payu: ^5.2
- unicodeveloper/laravel-paystack: 1.0.*
Requires (Dev)
- orchestra/testbench: ^6.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-24 18:30:53 UTC
README
有关此包的通用信息。
laravel 8x 安装
配置您的composer.json文件以安装此包
将以下代码添加到您的composer.json
文件中
"repositories": [ { "type": "vcs", "url": "https://github.com/engwaqas/paymentgateway.git" } ],
在您的命令提示符或终端中运行以下命令以安装此包
composer require engwaqas/paymentgateway
有关此包的安装过程信息。
支持的支付网关列表
- Paytm
- PayPal
- Stripe
- Midtrans
- Razorpay
- Mollie
- FlutterwaveRave
- Paystack
- Payfast
- Cashfree
- Instamojo
- Mercado pago
- PayU (即将推出)
- Billiplz (即将推出)
- PerfectMoney (即将推出)
- payumoney (即将推出)
- Paytr (即将推出)
- Authorized.net (即将推出)
- Pagseguro (即将推出)
带有参数的支付请求功能
以下是一个用于向客户收费的Controller
方法的示例,此方法适用于此包中所有可用的支付网关
public function payment(Request $request) { return XgPaymentGateway::payfast()->charge_customer([ //payfast is an example you can added all of payment gateawy name in lowercase 'amount' => 10, // amount you want to charge from customer 'title' => 'this is test title', // payment title 'description' => 'this is test description', // payment description 'ipn_url' => route('stripe.ipn'), //you will get payment response in this route 'order_id' => 5, // your order number 'track' => 'asdfasdfsdf', // a random number to keep track of your payment 'cancel_url' => route('payment.failed'), //payment gateway will redirect here if the payment is failed 'success_url' => route('payment.success'), // payment gateway will redirect here after success 'email' => 'dvrobin4@gmail.com', // user email 'name' => 'sharifur rhamna', // user name 'payment_type' => 'order', // which kind of payment your are receving from customer ]); }
支付IPN功能
以下是一个用于IPN响应的Controller
方法的示例,此方法适用于此包中所有可用的支付网关
public function payfast_ipn() { dd(XgPaymentGateway::payfast()->ipn_response()); }
Paytm
以下是Paytm的测试凭据
PAYTM_ENVIRONMENT=local // local|production PAYTM_MERCHANT_ID=Digita57697814558795 PAYTM_MERCHANT_KEY="dv0XtmsPYpewNag&" PAYTM_MERCHANT_WEBSITE="WEBSTAGING" PAYTM_CHANNEL="" PAYTM_INDUSTRY_TYPE=""
Paytm ipn路由示例
Route::post('/paytm-ipn', [\App\Http\Controllers\PaymentLogController::class,'paytm_ipn'] )->name('payment.paytm.ipn');
您必须排除paytm ipn路由从csrf令牌验证,转到app/Http/Middleware
中的VerifyCsrfToken
中间件,将您的路由路径添加到$except
数组中
namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ 'paytm-ipn' ]; }
PayPal
以下是Paypal的测试凭据
PAYPAL_MODE=sandbox PAYPAL_SANDBOX_CLIENT_ID='AUP7AuZMwJbkee-2OmsSZrU-ID1XUJYE-YB-2JOrxeKV-q9ZJZYmsr-UoKuJn4kwyCv5ak26lrZyb-gb' PAYPAL_SANDBOX_CLIENT_SECRET='EEIxCuVnbgING9EyzcF2q-gpacLneVbngQtJ1mbx-42Lbq-6Uf6PEjgzF7HEayNsI4IFmB9_CZkECc3y' PAYPAL_SANDBOX_APP_ID="641651651958" PAYPAL_LIVE_CLIENT_ID="" PAYPAL_LIVE_CLIENT_SECRET="" PAYPAL_LIVE_APP_ID="" PAYPAL_PAYMENT_ACTION="" PAYPAL_CURRENCY="USD" PAYPAL_NOTIFY_URL="http://gateway.test/paypal/ipn" PAYPAL_LOCALE="en_GB" PAYPAL_VALIDATE_SSL="false"
Paypal ipn路由示例
Route::get('/paypal-ipn', [\App\Http\Controllers\PaymentLogController::class,'paypal_ipn'] )->name('payment.paypal.ipn');
Stripe
以下是Stripe的测试凭据
STRIPE_PUBLIC_KEY=pk_test_51GwS1SEmGOuJLTMsIeYKFtfAT3o3Fc6IOC7wyFmmxA2FIFQ3ZigJ2z1s4ZOweKQKlhaQr1blTH9y6HR2PMjtq1Rx00vqE8LO0x STRIPE_SECRET_KEY=sk_test_51GwS1SEmGOuJLTMs2vhSliTwAGkOt4fKJMBrxzTXeCJoLrRu8HFf4I0C5QuyE3l3bQHBJm3c0qFmeVjd0V9nFb6Z00VrWDJ9Uw
Stripe ipn路由示例
Route::get('/stripe-ipn', [\App\Http\Controllers\PaymentLogController::class,'stripe_ipn'] )->name('payment.stripe.ipn');
Midtrans
以下是Midtrans的测试凭据
MIDTRANS_MERCHANT_ID="G770543580" MIDTRANS_SERVER_KEY="SB-Mid-server-9z5jztsHyYxEdSs7DgkNg2on" MIDTRANS_CLIENT_KEY="SB-Mid-client-iDuy-jKdZHkLjL_I" MIDTRANS_ENVAIRONTMENT="false"
Midtrans ipn路由示例
Route::get('/midtrans-ipn', [\App\Http\Controllers\PaymentLogController::class,'midtrans_ipn'] )->name('payment.midtrans.ipn');
Midtrans 测试卡
VISA Description
4811 1111 1111 1114 3DS Enabled
4911 1111 1111 1113 3DS Enabled. Transaction Denied by Bank
4411 1111 1111 1118 3DS Disabled
4511 1111 1111 1117 3DS Disabled. Challenged by Fraud Detection
4611 1111 1111 1116 3DS Disabled. Denied by Fraud Detection
4711 1111 1111 1115 3DS Disabled. Transaction Denied by Bank
MASTERCARD Description
5211 1111 1111 1117 3DS Enabled
5111 1111 1111 1118 3DS Enabled. Transaction Denied by Bank
5410 1111 1111 1116 3DS Disabled
5510 1111 1111 1115 3DS Disabled. Challenged by Fraud Detection
5411 1111 1111 1115 3DS Disabled. Denied by Fraud Detection
5511 1111 1111 1114 3DS Disabled. Transaction Denied by Bank
Razorpay
以下是Razorpay的测试凭据
RAZORPAY_API_KEY="rzp_test_SXk7LZqsBPpAkj" RAZORPAY_API_SECRET="Nenvq0aYArtYBDOGgmMH7JNv"
Razorpay ipn路由示例
Route::post('/razorpay-ipn', [\App\Http\Controllers\PaymentLogController::class,'razorpay_ipn'] )->name('payment.razorpay.ipn');
Mollie
以下是Mollie的测试凭据
MOLLIE_KEY=test_fVk76gNbAp6ryrtRjfAVvzjxSHxC2v
Mollie ipn路由示例
Route::get('/mollie-ipn', [\App\Http\Controllers\PaymentLogController::class,'mollie_ipn'] )->name('payment.razorpay.ipn');
FlutterwaveRave
以下是Flutterwave的测试凭据
FLW_PUBLIC_KEY=FLWPUBK_TEST-86cce2ec43c63e09a517290a8347fcab-X FLW_SECRET_KEY=FLWSECK_TEST-d37a42d8917db84f1b2f47c125252d0a-X FLW_SECRET_HASH="fundorex"
FlutterwaveRave ipn路由示例
Route::get('/flutterwave-ipn', [\App\Http\Controllers\PaymentLogController::class,'flutterwave_ipn'] )->name('payment.flutterwave.ipn');
Paystack
以下是Paystack的测试凭据
PAYSTACK_PUBLIC_KEY=pk_test_a7e58f850adce9a73750e61668d4f492f67abcd9 PAYSTACK_SECRET_KEY=sk_test_2a458001d806c878aba51955b962b3c8ed78f04b PAYSTACK_PAYMENT_URL=https://api.paystack.co MERCHANT_EMAIL=sopnilsohan03@gmail.com
Paystack ipn路由示例
Route::get('/paystack-ipn', [\App\Http\Controllers\PaymentLogController::class,'paystack_ipn'] )->name('payment.paystack.ipn');
注意:paystack不支持多个ipn路由,它只支持在paystack仪表板中添加的一个webhook。您可以使用$arg['payment_type']数据来检查哪种类型的支付已处理
Payfast
以下是Payfast的测试凭据
PF_MERCHANT_ID=10024000 PF_MERCHANT_KEY=77jcu5v4ufdod PAYFAST_PASSPHRASE=testpayfastsohan PF_MERCHANT_ENV=true PF_ITN_URL="https://fundorex.test/donation-payfast"
Payfast ipn路由示例
Route::post('/payfast-ipn', [\App\Http\Controllers\PaymentLogController::class,'payfast_ipn'] )->name('payment.payfast.ipn');
您必须排除Payfast ipn路由从csrf令牌验证,转到app/Http/Middleware
中的VerifyCsrfToken
中间件,将您的路由路径添加到$except
数组中
namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ 'payfast-ipn' ]; }
Cashfree
以下是Cashfree的测试凭据
CASHFREE_TEST_MODE=true CASHFREE_APP_ID="94527832f47d6e74fa6ca5e3c72549" CASHFREE_SECRET_KEY="ec6a3222018c676e95436b2e26e89c1ec6be2830"
Cashfree ipn路由示例
Route::post('/cashfree-ipn', [\App\Http\Controllers\PaymentLogController::class,'cashfree_ipn'] )->name('payment.cashfree.ipn');
您必须排除Cashfree ipn路由从csrf令牌验证,转到app/Http/Middleware
中的VerifyCsrfToken
中间件,将您的路由路径添加到$except
数组中
namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ 'cashfree-ipn' ]; }
Instamojo
以下是Instamojo的测试凭据
INSTAMOJO_CLIENT_ID=test_nhpJ3RvWObd3uryoIYF0gjKby5NB5xu6S9Z INSTAMOJO_CLIENT_SECRET=test_iZusG4P35maQVPTfqutbCc6UEbba3iesbCbrYM7zOtDaJUdbPz76QOnBcDgblC53YBEgsymqn2sx3NVEPbl3b5coA3uLqV1ikxKquOeXSWr8Ruy7eaKUMX1yBbm INSTAMOJO_USERNAME="" INSTAMOJO_PASSWORD="" INSTAMOJO_TEST_MODE="true"
Instamojo Pago仅适用于INR货币
Instamojo ipn路由示例
Route::get('/instamojo-ipn', [\App\Http\Controllers\PaymentLogController::class,'instamojo_ipn'] )->name('payment.instamojo.ipn');
Instamojo 测试凭据
mobile number 919090213229
For payments use the following card details:
Number: 4242 4242 4242 4242
Date: Any valid future date
CVV: 111
Name: abc
3D-secure password: 1221
Mercadopago
以下是Mercadopago的测试凭据
MERCADO_PAGO_CLIENT_ID=TEST-0a3cc78a-57bf-4556-9dbe-2afa06347769 MERCADO_PAGO_CLIENT_SECRET=TEST-4644184554273630-070813-7d817e2ca1576e75884001d0755f8a7a-786499991 MERCADO_PAGO_TEST_MODE=true
Mercado Pago仅适用于BRL货币
ipn路由示例
Route::get('/mercadopago-ipn', [\App\Http\Controllers\PaymentLogController::class,'mercadopago_ipn'] )->name('payment.mercadopago.ipn');
Mercadopago测试凭证
For payments use the following card details:
Number: 5031 4332 1540 6351
Date: 11/25
CVV: 123
Name: abc
此包的货币转换
您必须添加此货币值才能使所有支付网关正常工作,请确保您已从管理员面板更新此比率
IDR_EXCHANGE_RATE="14365.30" INR_EXCHANGE_RATE="74.85" NGN_EXCHANGE_RATE="409.91" ZAR_EXCHANGE_RATE="15.86" BRL_EXCHANGE_RATE="5.70" SITE_GLOBAL_CURRENCY=USD
使用此包
关于使用此包的信息
贡献
关于贡献此包的信息。