The official PHP library for the ForgingBlock API.
PHP version 5.4 and above are supported.
For more details visit ForgingBlock API docs.
Install with composer
:
composer require forgingblock/forgingblock-php
use Forgingblock\ApiClient;
//$payment_mode are test or live
$forgingblock = new ApiClient($payment_mode);
$forgingblock->SetValue('trade', $trade);
$forgingblock->SetValue('token', $token);
$forgingblock->SetValue('amount', round($amount, 2));
$forgingblock->SetValue('currency',$currency_code);
$forgingblock->SetValue('link', $returnURL);
$forgingblock->SetValue('notification', $notifyURL);
$forgingblock->SetValue('order', $order_id);
$forgingblock->CreateInvoice();
$InvoiceURL = $forgingblock->GetInvoiceURL();
if ($InvoiceURL) header('Location: '.$InvoiceURL);
else echo $forgingblock->GetError();
use Forgingblock\ApiClient;
$forgingblock = new ApiClient($payment_mode);
$forgingblock->SetValue('trade', $trade);
$forgingblock->SetValue('token', $token);
$forgingblock->SetValue('invoice', $invoice_id);
$forgingblock->CheckInvoiceStatus();
$payment_status = $forgingblock->GetInvoiceStatus();