senthil / forgingblock-php

ForgingBlock PHP API 库

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

This package is auto-updated.

Last update: 2024-09-29 00:17:33 UTC


README

这是 ForgngBlock API 的官方 PHP 库。[ForgingBlock API 文档](https://api.forgingblock.io/docs/)

PHP 版本

支持 PHP 版本 5.4 及以上。

文档

更多详情请访问 [ForgingBlock API 文档](https://api.forgingblock.io/docs/)

安装

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