PHP code example of otnansirk / laravel-dana

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

    

otnansirk / laravel-dana example snippets


'providers' => [
    // ...
    Otnansirk\Dana\DanaCoreServiceProvider::class,
];

$orderData = [
    [
    "order" => [
        "orderTitle" => "Dummy product",
        "orderAmount" => [
            "currency" => "IDR",
            "value" => "100"
        ],
        "merchantTransId" => "201505080001",
        "merchantTransType" => "dummy transaction type",
        "orderMemo" => "Memo",
        "goods" => [
            [
                "merchantGoodsId" => "24525635625623",
                "description" => "dummy description",
                "category" => "dummy category",
                "price" => [
                    "currency" => "IDR",
                    "value" => "100"
                ],
                "unit" => "Kg",
                "quantity" => "3.2",
                "merchantShippingId" => "564314314574327545",
                "snapshotUrl" => "[http://snap.url.com]",
                "extendInfo" => [
                    "key" => "value",
                ]
            ]
        ]
    ],
    "merchantId" => "216820000000006553000",
    "subMerchantId" => "12345678",
    "productCode" => "51051000100000000001"
];

DANAPay::createOrder($orderData);

$acquirementId = "20240125111212800110166050101920928";
DANAPay::queryOrder($acquirementId);


$terminalType = "WEB";
$redirectUrl  = "https://your-app-url.com/oauth/callback";
DANAPay::generateOauthUrl($terminalType, $redirectUrl);

$authToken = "your-auth-token";
DANAPay::getToken($authToken);

$accessToken = "your_user_profile_access_token";
DANAPay::profile($accessToken);

DANAPay::unBindAllAccount();

$status = true;
DANAPay::responseFinishNotifyCallback($status);

$payAmount = 100000;
$payMethod = 'BALANCE';
DANACalculation::calculateMDR($payAmount, $payMethod);
sh
php artisan vendor:publish --provider="Otnansirk\Dana\DanaCoreServiceProvider"