锻造块 / 锻造块-php
锻造块加密支付网关PHP API库
dev-master
2021-12-01 06:51 UTC
Requires
- php: >=5.6.9
- rmccue/requests: ^1.8
This package is not auto-updated.
Last update: 2024-10-03 18:38:58 UTC
README
这是 ForgingBlock API 的官方PHP库。
PHP版本
支持PHP版本5.4及以上。
文档
更多详情请访问 ForgingBlock API文档。
安装
使用 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();