Download the PHP package royryando/laravel-duitku without Composer
On this page you can find all versions of the php package royryando/laravel-duitku. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-duitku
Laravel Duitku
A simple Duitku payment gateway library for Laravel.
Requirments
- PHP ≥ 5.5
- Laravel ≥ 5.1
Installation
-
Install through composer
composer require royryando/laravel-duitku
- Add the duitku service provider in config/app.php: (Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.)
Configure
- Add required variable to
.env
Usage
Get All Available Payment Method
Ref: https://docs.duitku.com/api/id/#payment-method
Call paymentMethods function from Duitku facade with the integer parameter is amount
Duitku::paymentMethods(100000)
The return is an array of array, example:
Create Invoice
Ref: https://docs.duitku.com/api/id/#request-transaction
Create invoice or inquiry by calling createInvoice from Duitku facade with these parameter:
Order Id, amount, payment method, product name, customer name, cutomer email, expiry in minute
Duitku::createInvoice('ORDER_ID', 100000, 'M1', 'Product Name', 'John Doe', '[email protected]', 120);
The return if success:
The return if not success:
Check Invoice Status
Ref: https://docs.duitku.com/api/id/#check-transaction
Check invoice or inquiry status by calling
Duitku::checkInvoiceStatus('order ID')
The return is an array, example:
Handle Callback
Ref: https://docs.duitku.com/api/id/#callback
-
Create a new controller and extend
Royryando\Duitku\Http\Controllers\DuitkuBaseController
This controller will handle all callback requests from Duitku and store the success/failed payment function
-
Inside the controller, override
onPaymentSuccess
function. This function will triggered if receiving a successful transaction callback -
Inside the controller, override
onPaymentFailed
function. This function will triggered if receiving a failed status from callback -
Add route in your application route web.php with the function of paymentCallback
-
Exclude the callback route from CSRF verification
Edit
App\Http\Middleware\VerifyCsrfToken.php
TODO
- Add tests
- Add support for Return Callback
- Add support for Disbursement API