PHP code example of myomyintaung512 / laravel-dinger-prebuilt

1. Go to this page and download the library: Download myomyintaung512/laravel-dinger-prebuilt 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/ */

    

myomyintaung512 / laravel-dinger-prebuilt example snippets


use myomyintaung512\LaravelDingerPrebuiltForm\DingerPrebuilt;

class PaymentController extends Controller
{
    public function checkout(DingerPrebuilt $dinger)
    {
        $items = [
            [
                'name' => 'Product 1',
                'amount' => 1000,
                'quantity' => 1
            ]
        ];

        $paymentUrl = $dinger->createPayment(
            $items,
            'Customer Name',
            1000,
            'ORDER_123'
        );

        return redirect($paymentUrl);
    }
}

use myomyintaung512\LaravelDinger\Dinger;

$dinger = new Dinger([
    'api_key' => env('DINGER_API_KEY'),
    'merchant_name' => env('DINGER_MERCHANT_NAME'),
    'merchant_id' => env('DINGER_MERCHANT_ID'),
    'production' => env('DINGER_PRODUCTION', false),
]);

$payment = $dinger->createPayment([
    'amount' => 1000,
    'order_id' => 'ORDER_123',
    'description' => 'Product purchase',
    'customer_name' => 'Mg Mg',
    'customer_phone' => '09123456789',
    'customer_email' => '[email protected]',
    'redirect_url' => 'https://your-website.com/payment/callback'
]);
bash
php artisan vendor:publish --provider="myomyintaung512\LaravelDingerPrebuilt\DingerServiceProvider"