anonwallet/anonwallet-php

AnonWallet匿名加密货币支付网关的官方PHP SDK

dev-master 2022-08-02 07:37 UTC

This package is auto-updated.

Last update: 2024-09-30 01:21:40 UTC


README

AnonWallet.Net匿名加密货币支付网关的官方PHP SDK

安装指南

您可以使用composer在项目中安装anonwallet插件,方法如下:

composer require anonwallet/anonwallet-php

用法

在任何需要使用此库的地方包含包的命名空间

include_once './vendor/autoload.php';
use AnonWallet\AnonWallet;

$api_key = 'Your merchant API Key';

$obj = new AnonWallet($api_key);

获取特定代币的余额


$currency = 'BTC'; //If currency parameter is not specified, default currency is BTC

$balance = $obj->balance($currency);

获取所有代币的余额

$balances = $obj->balances();

生成回调地址

$currency = 'BTC'; //If currency parameter is not specified, default currency is BTC
$forward_address = '1Btcdemoforwardaddress'; // If forward address is specified, the funds are automatically send to this address after the transaction is confirmed
$ipn_url = 'Yourdomain.com/handle_payment'; // If IPN url is specified, notifications of payment status changes is sent to this domain
$label = 'John Doe'; //Specify label for your internal system tracking

$address = $obj->callback_address($currency, $forward_address, $ipn_url, $label);

创建新的发票

$currency = 'BTC'; //If currency parameter is not specified, default currency is BTC
$amount = '0.01'; //Numeric double amount required to be received on the invoice
$forward_address = '1Btcdemoforwardaddress'; // If forward address is specified, the funds are automatically send to this address after the transaction is confirmed
$ipn_url = 'Yourdomain.com/handle_payment'; //If IPN url is specified, notifications of payment status changes is sent to this domain
$invoice_id = '112'; // Your internal system tracking invoice id
$hosted_invoice = true; // true or false, if boolean true is specified, the invoice will have a hosted payment page on AnonWallet gateway
$product_title = 'My product title';
$product_description = 'My product description';
$success_url = 'Yourdomain.com/success'; //URL where the buyer will redirect when it cancel the hosted invoice
$cancel_url = 'Yourdomain.com/cancel'; //URL where the buyer will redirect when it cancel the hosted invoice
$buyer_email = 'buyer@email.com' //Specify the buyer email

$invoice = $obj->create_invoice($currency, $amount, $forward_address, $ipn_url, $invoice_id, $hosted_invoice, $product_title, $product_description, $success_url, $cancel_url, $buyer_email);

创建新的提款请求

$currency = 'BTC'; //If currency parameter is not specified, default currency is BTC
$amount = '0.01'; // Numeric double amount to be send from your account
$address = '1Btcdemowithdrawaladdress'; //The receiver address
$ipn_url = 'Yourdomain.com/handle_withdraw'; // URL where 

$withdraw = $obj->create_withdrawal($currency, $amount, $address, $ipn_url);

您可以在我们的API文档中找到更多参考(https://anonwallet.readme.io