Laravel wrapper for Midtrans payment gateway.
- Sign Up for the Midtrans Account
You can install the package via composer:
composer require ibnuhalimm/laravel-midtrans
Optionally, you can publish the config file of this package with this command:
php artisan vendor:publish --tag="laravel-midtrans-config"
Put some environment variable to .env
file:
MIDTRANS_SERVER_KEY=
MIDTRANS_CLIENT_KEY=
MIDTRANS_MODE=
You can directly use the Midtrans
Facade (the alias or class itself):
- Payment
use Ibnuhalimm\LaravelMidtrans\Facades\Midtrans; $transactionData = [ 'transaction_details' => [ 'order_id' => 'INV-0012', 'gross_amount' => 20000, ] ]; Midtrans::getSnapToken($transactionData);
- After Payment
use Ibnuhalimm\LaravelMidtrans\Facades\Midtrans; $id = '9b5192c4-4da4-3b6d-945b-4bf5f853cb56'; Midtrans::transaction($id)->getDetails();
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.