descom / payment-gateway
Payment Gateway for Laravel App
Installs: 5 732
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
Requires
- php: ^8.3
- laravel/framework: ^11.0
- league/omnipay: ^3.2
Requires (Dev)
- descom/omnipay-offline-dummy: ^1.2.6
- descom/omnipay-redsys: ^1.4
- friendsofphp/php-cs-fixer: ^3.4
- larastan/larastan: ^2.9
- orchestra/testbench: ^9.0
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^9.5|^10.0|^10.5
Suggests
- descom/omnipay-offline-dummy: Required to use demo the offline gateway
- descom/omnipay-redsys: Required to payment with Redsys
- dev-master
- v3.x-dev
- 3.7.0
- 3.6.0
- 3.5.1
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.0
- v2.x-dev
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.0
- v1.x-dev
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-laravel_11_tests
- dev-cesargb-patch-1
- dev-bank_transfer
- dev-transaction_id
- dev-laravel10
- dev-fix
- dev-drop
- dev-transaction_reference
- dev-variable_url
This package is auto-updated.
Last update: 2024-11-02 14:18:07 UTC
README
DPG is a package to Laravel that allows you to integrate the Payment Gateway into your application. This package use Omnipay to integrate the payment gateway.
Installation
composer require descom/payment-gateway
You can install any module to Omnipay
, sample:
composer require descom/omnipay-offline-dummy
Usage
Create a Payment Method
<?php use Descom\Payment\Payment; use Omnipay\OfflineDummy\Gateway as OfflineDummyGateway; Payment::for(new OfflineDummyGateway()) ->name('Method Name') ->config([ 'return_url' => 'http:/www.localhost/checkout/success', 'cancel_url' => 'http:/www.localhost/checkout/cancel', 'request' => [ 'notify_url' => 'http:/api.localhost/payment/paymentdemo/notify', 'return_url' => 'http:/api.localhost/payment/{parameterId}/redirect', ], ])) ->transformer() // Optional, you can use your own transformer with interface Descom\Payment\Transformers\Transformer ->create('paymentdemo');
Access a Payment Method
<?php use Descom\Payment\Payment; $payment = Payment::find('paymentdemo');
Create Transaction
<?php use Descom\Payment\Payment; use Descom\Payment\Transaction; $payment = Payment::find('paymentdemo'); $transaction = Transaction::for($payment)->create([ 'amount' => '10.00', 'merchant_id' => 'order_1', ]);
You optionally can add a relation of a external model:
<?php use Descom\Payment\Payment; use Descom\Payment\Transaction; $payment = Payment::find('paymentdemo'); $transaction = Transaction::for($payment) ->model(Order::find(1)) ->create([ 'amount' => '10.00', 'merchant_id' => 'order_1', ]);
## Capture Notification Create Listener to events: - `Descom\Payment\Events\TransactionPaid` - `Descom\Payment\Events\TransactionDenied`