PHP
Nusagate SDK Support for PHP Client
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
$api_key = 'YOUR_API_KEY';
$secret_key = 'YOUR_SECRET_KEY';
$headers = ['Authorization' => 'Basic ' . base64_encode($api_key . ':' . $secret_key)];
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);
$response = $nusagate->availableCurrency();
$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);
$invoiceId = 'INVOICE-ID';
$response = $nusagate->voidInvoice($invoiceId);
$query = [
'page' => 1,
'per_page' => 10,
'status' => 'PAID'
...
];
$response = $nusagate->getInvoices($query);
$invoiceId = 'INVOICE-ID';
$response = $nusagate->getInvoiceById($invoiceId);
$payload_transfer = [
'external_id' => "TF-ACIKIWIR-000002",
'address' => 'TAUsbjxk...',
'amount' => 50,
'currency_code' => 'TRX',
];
$response = $nusagate->createTransfer($payload_transfer);
$query = [
'page' => 1,
'per_page' => 2,
'status' => '',
'from_date' => '',
'to_date' => ''
];
$response = $nusagate->getTransfers($query);
$transferId = 'TRANSFER-ID';
$response = $nusagate->getTransferById($transferId);
Last modified 4mo ago