PHP code example of laraditz / gkash

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

    

laraditz / gkash example snippets


// Create a payment

// Using service container
$payment = app('gkash')->refNo('ABC1234')->amount(100)->returnUrl('https://returnurl.com')->createPayment();

// Using facade
$payment =  \Gkash::refNo('ABC1234')->amount(100)->returnUrl('https://returnurl.com')->createPayment();


[
    "code" => "5Xpj9IPN",
    "currency_code" => "MYR",
    "amount" => 100,
    "payment_url" => "http://myapp.com/gkash/pay/5Xpj9IPN"
]

[
  "amount" => "1.00",
  "code" => "5Xpj9IPN",
  "currency" => "MYR",
  "id" => "98043afa-d795-43b1-a6da-af735ba43db0",
  "merchant_id" => "MXXX-X-XXXXX",
  "payment_type" => "TnG ECOMM",
  "ref_no" => "ABC14393647840",
  "signature" => "0bfe2724c9c29dcd5c086a1f45f28ce0b702dd86dddef8eb40d46001ce76dff76a8f18b9f993f6cbb104206041866f239c4239878f62c043b4252a0c00a3a374",
  "status" => 3,
  "status_text" => "Success",
  "vendor_ref_no" => "MXXX-PO-XXXXXX",
]
bash
php artisan vendor:publish --provider="Laraditz\Gkash\GkashServiceProvider" --tag="config"
bash
php artisan migrate