PHP code example of gluwa / gluwa-php

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

    

gluwa / gluwa-php example snippets



// Specify your vendor path.
 sandbox mode, change below to values ​​obtained from Gluwa Dashboard's sandbox mode.
$Configuration_DEV = false; // "true" if you want to use the sandbox mode

$Configuration_APIKey = '{Your API Key}';
$Configuration_APISecret = '{Your API Secret}';
$Configuration_WebhookSecret = '{Your Webhook Secret}';
$Configuration_MasterEthereumPrivateKey = '{Your Ethereum Private Key}';
$Configuration_MasterEthereumAddress = '{Your Ethereum Address}';

$Gluwa = new Gluwa\Gluwa([
    '__DEV__' => $Configuration_DEV,
    'APIKey' => $Configuration_APIKey,
    'APISecret' => $Configuration_APISecret,
    'WebhookSecret' => $Configuration_WebhookSecret,
    'MasterEthereumPrivateKey' => $Configuration_MasterEthereumPrivateKey,
    'MasterEthereumAddress' => $Configuration_MasterEthereumAddress,
]);

$PostTransaction_Currency = '{USDG or sUSDCG or KRWG or sNGNG}';
$PostTransaction_Amount = '{Sending Amount}';
$PostTransaction_Target = '{Receiver\'s Address}';
$PostTransaction_MerchantOrderID = '{Merchant\'s Order ID. Optional}';
$PostTransaction_Note = '{Custom Note. Optional}';
$PostTransaction_Expiry = {Expiry of the Transfer Request. Optional};

$Response = $Gluwa->postTransaction([
    'Currency' => $PostTransaction_Currency,
    'Amount' => $PostTransaction_Amount,
    'Target' => $PostTransaction_Target,
    'MerchantOrderID' => $PostTransaction_MerchantOrderID, // optional
    'Note' => $PostTransaction_Note, // optional
    'Expiry' => $PostTransaction_Expiry, // optional
]);

$Response = $Gluwa->getPaymentQRCode([
    'Currency' => 'USDG', // USDG or sUSDCG or KRWG or sNGNG
    'Amount' => '1',
    'Note' => '', // optional
    'MerchantOrderID' => '', // optional
    'Expiry' => 1800, // optional
]);

$Response = $Gluwa->getListTransactionHistory([
    'Currency' => 'USDG', // USDG or sUSDCG or KRWG or sNGNG
    'Limit' => '100', // optional
    'Status' => 'Confirmed', // optional
    'Offset' => '0', // optional
]);

$Response = $Gluwa->getListTransactionDetail([
    'Currency' => 'USDG', // USDG or sUSDCG or KRWG or sNGNG
    'TxnHash' => '',
]);

$Response = $Gluwa->getAddresses([
    'Currency' => 'USDG', // USDG or sUSDCG or KRWG or sNGNG
]);

$Headers = getallheaders();
$Signature = $Headers['X-REQUEST-SIGNATURE'];
$Payload = file_get_contents("php://input");

$Response2 = $Gluwa->validateWebhook([
    'Payload' => $Payload,
    'Signature' => $Signature,
]);
bash
$ composer