If your service is developed in PHP, the features we provide are available through the SDK. The Gluwa SDK for PHP is a library with powerful features that enable PHP developers to easily make requests to the Gluwa APIs.
Download the PHP Package below and upload it to your server. The SDK requires PHP 5.6 or greater.
$ composer require gluwa/gluwa-php
Create and initialize a
Gluwa object. Then, enter the
WebookSecret generated from the Gluwa Dashboard, and an Ethereum wallet to manage your funds. You can use credentials from sandbox dashboard and a Rinkeby wallet if you want to test in the sandbox environment.
require_once('../___library/Gluwa/autoload.php');$GluwaPro = new \Gluwa\Gluwa(['__DEV__' => false, // "true" if you want to use the sandbox mode.'APIKey' => '','APISecret' => '','WebhookSecret' => '','MasterEthereumPrivateKey' => '','MasterEthereumAddress' => '',]);
Now you are ready to use the Gluwa API.
$Response = $Gluwa->postTransaction(['Currency' => 'USDG','Amount' => '1.78','Target' => '', // Required - Target Address'MerchantOrderID' => '', // optional'Note' => '', // optional'Expiry' => 1800, // optional]);
$Response = $Gluwa->getPaymentQRCode(['Currency' => 'USDG','Amount' => '1','Note' => '', // optional'MerchantOrderID' => '', // optional'Expiry' => 1800, // optional]);
$Response = $Gluwa->getListTransactionHistory(['Currency' => 'USDG','Limit' => '100', // optional'Status' => 'Confirmed', // optional'Offset' => '0', // optional]);
$Response = $Gluwa->getListTransactionDetail(['Currency' => 'USDG','TxnHash' => '',]);
$Response = $Gluwa->getAddresses(['Currency' => 'USDG',]);
When user completes transfer via the QR code, the Gluwa API sends a webhook to your webhook endpoint. Verify that the values actually sent by the Gluwa server are correct.
Payload and Signature of webhook can be obtained as follows:
$Headers = getallheaders();$Signature = $Headers['X-REQUEST-SIGNATURE'];$Payload = file_get_contents("php://input");
Verify the requested Signature and Payload as follows:
$Response2 = $Gluwa->validateWebhook(['Payload' => $Payload,'Signature' => $Signature,]);
This will return