senthil/forgingblock-php

ForgingBlock PHP API library

v1.0 2021-11-28 15:21 UTC

This package is auto-updated.

Last update: 2024-04-28 23:31:03 UTC


README

The official PHP library for the ForgingBlock API.

PHP versions

PHP version 5.4 and above are supported.

Documentation

For more details visit ForgingBlock API docs.

Installation

Install with composer:

composer require forgingblock/forgingblock-php

Usage

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();

Notifications

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();