bert-w / coinpayments-api
CoinPayments API 的 PHP 实现
v1.0.1
2022-09-13 22:16 UTC
Requires
- php: ^7.2|^8.0
- guzzlehttp/guzzle: ^6.0|^7.0
This package is auto-updated.
Last update: 2024-09-14 02:38:16 UTC
README
CoinPayments API 的 PHP 实现。
安装说明
composer require bert-w/coinpayments-api
快速入门
查看 CoinPayments API 文档 以获取 CoinPayments API 的文档。
代码示例
检索基本商家信息
$publicKey = 'your_public_api_key';
$privateKey = 'your_private_api_key';
$client = new BertW\CoinPaymentsApi\Client($publicKey, $privateKey);
$response = $client->getBasicInfo();
print_r($response);
// Array
// (
// [error] => ok
// [result] => Array
// (
// [username] => MerchantUsername
// [merchant_id] => abcd32abcd32abcd32abcd32abcd32ab
// [email] => merchantemail@example.com
// [public_name] =>
// [time_joined] => 1518095700
// )
//
// )
快速 API 参考
创建交易非常简单
$client->createTransaction([
'amount' => 0.452811,
'currency1' => 'USD',
'currency2' => 'BTC',
// optional parameters here...
具有超过 4 个参数的 API 请求使用类似上面的关联数组语法(所有具有 array $options
的函数)。简单的 API 调用,如 getDepositAddress
,可以简单地使用 $client->getDepositAddress($currency)
来调用。
函数列表
public function getBasicInfo();
public function rates($short = null, $accepted = null);
public function balances($all = 0);
public function getDepositAddress($currency);
public function createTransaction(array $options);
public function getCallbackAddress($currency, $ipn_url = null);
public function getTxInfoMulti($txid);
public function getTxInfo($txid, $full = null);
public function getTxIds($limit = null, $start = null, $newer = null, $all = null);
public function createTransfer(array $options);
public function createWithdrawal(array $options);
public function createMassWithdrawal(array $options);
public function convert(array $options);
public function getWithdrawalHistory($limit = null, $start = null, $newer = null);
public function getWithdrawalInfo($id);
public function getConversionInfo($id);
public function getPbnInfo($pbntag);
public function getPbnList();
public function updatePbnTag(array $options);
public function claimPbnTag($tagid, $name);