forgingblock/forgingblock-php

ForgingBlock Crypto Payment Gateway PHP API library

dev-master 2021-12-01 06:51 UTC

This package is not auto-updated.

Last update: 2024-05-16 16:56:41 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();