PHP code example of ibnuhalimm / laravel-midtrans

1. Go to this page and download the library: Download ibnuhalimm/laravel-midtrans library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ibnuhalimm / laravel-midtrans example snippets


    use Ibnuhalimm\LaravelMidtrans\Facades\Midtrans;

    $transactionData = [
        'transaction_details' => [
            'order_id' => 'INV-0012',
            'gross_amount' => 20000,
        ]
    ];

    Midtrans::getSnapToken($transactionData);
    

    use Ibnuhalimm\LaravelMidtrans\Facades\Midtrans;

    $id = '9b5192c4-4da4-3b6d-945b-4bf5f853cb56';
    Midtrans::transaction($id)->getDetails();
    
bash
php artisan vendor:publish --tag="laravel-midtrans-config"