PHP code example of myomyintaung512 / php-dinger-prebuilt

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


use myomyintaung512\DingerPrebuilt\DingerPrebuilt;

// Initialize with custom config (optional)
$config = [
    'clientId' => 'your-client-id',
    'merchantKey' => 'your-merchant-key',
    'publicKey' => 'your-public-key',
    'projectName' => 'your-project-name',
    'merchantName' => 'your-merchant-name',
    'hashKey' => 'your-hash-key',
    'baseUrl' => 'https://prebuilt.dinger.asia' // optional
];

$dinger = new DingerPrebuilt($config);

// Prepare items
$items = [
    [
        'name' => 'Product 1',
        'amount' => '1000',
        'quantity' => '1'
    ]
];

// Generate payment URL
$paymentUrl = $dinger->createPayment(
    $items,
    'Customer Name',
    '1000',
    'ORDER123'
);

// Redirect to payment URL
header("Location: " . $paymentUrl);

bash
composer