Nusagate Docs
Search
K
Comment on page

PHP

Nusagate SDK Support for PHP Client

Requirement

Installation

Use at least PHP version 7.2.5 and need to Install Composer first before install the SDK's. After composer installed run this command on top of your project :
composer require nusagate/nusagate-php

Authentication

$api_key = 'YOUR_API_KEY';
$secret_key = 'YOUR_SECRET_KEY';
$headers = ['Authorization' => 'Basic ' . base64_encode($api_key . ':' . $secret_key)];

Using SDK

If you're using software development kit you don't need to be worry about the auth & client request
use Nusagate\Nusagate;
$is_production = true;
$api_key = 'YOUR_API_KEY';
$secret_key = 'YOUR_SECRET_KEY';
$nusagate = new Nusagate($is_production, $api_key, $secret_key);

Get Available Currency

$response = $nusagate->availableCurrency();

Create Invoice

$payload = [
'externalId' => 'NSGT-122313102',
'description' => 'invoice example description',
'price' => '1000000',
'dueDate' => '2022-09-10',
'payCurrency' => 'TRX',
'email' => '[email protected]',
'phoneNumber' => '6294389422312',
];
$response = $nusagate->createInvoice($payload);

Void Invoice

$invoiceId = 'INVOICE-ID';
$response = $nusagate->voidInvoice($invoiceId);

Get List Invoice

$query = [
'page' => 1,
'per_page' => 10,
'status' => 'PAID'
...
];
$response = $nusagate->getInvoices($query);

Get Detail Invoice

$invoiceId = 'INVOICE-ID';
$response = $nusagate->getInvoiceById($invoiceId);

Create Transfer

SDK for Create Transfer
$payload_transfer = [
'external_id' => "TF-ACIKIWIR-000002",
'address' => 'TAUsbjxk...',
'amount' => 50,
'currency_code' => 'TRX',
];
$response = $nusagate->createTransfer($payload_transfer);

Get List Transfer

SDK for Manage Transfer
$query = [
'page' => 1,
'per_page' => 2,
'status' => '',
'from_date' => '',
'to_date' => ''
];
$response = $nusagate->getTransfers($query);

Get Detail Transfer

SDK for Manage Transfer
$transferId = 'TRANSFER-ID';
$response = $nusagate->getTransferById($transferId);