elise194/easy-coinpayments

Laravel的Coinpayments API包

dev-master 2020-04-06 06:42 UTC

This package is auto-updated.

Last update: 2024-09-06 17:02:05 UTC


README

Latest Stable Version License

Laravel框架的CoinPayments API包装器

安装

composer require Elise194/easy-coinpayments

安装服务提供者

$this->app->register(Elise194\EasyCoinPayments\CoinpaymentsServiceProvider::class);

.env参数

COINPAYMENTS_API_PUBLIC_KEY="your public api key"
COINPAYMENTS_API_PRIVATE_KEY="your private api key"
COINPAYMENTS_API_IPN_SECRET="your ipn secret"

迁移

运行 php artisan migrate

用法

如果您想将交易作为对象获取,请使用CoinpaymentsService

$service = new Elise194\EasyCoinPayments\Services\CoinpaymentsService();
$transaction = $service->createCoinPaymentsTransaction($amount, $currency1, $currency2, $buyerEmail);

此数据库条目将用于接收IPN回调

要获取数组形式的交易信息,请使用simple

$coinpayments = app('coinpayments');
$responseData = $coinpayments->payment()->createTransaction(
     $amount,
     $currency1,
     $currency2,
     $buyer_email,
     $options,
     $isNeedLog
);

API的其他功能被分为几个部分。

信息

这是CoinPayments文档中“信息”部分的主要命令

$coinpayments = app('coinpayments');
$coinpayments->information()->getBasicAccountInfo();
$coinpayments->information()->getExchageRates($isShort, $accepted);

支付。

获取回调地址示例

$coinpayments = app('coinpayments');
$coinpayments->payment()->getCallbackAddress($currency, $ipnUrl, $label);

所有函数的完整列表在/Actions/Payment.php中。它匹配文档中“接收支付”部分的CoinPayments方法。

钱包

示例

$coinpayments = app('coinpayments');
$coinpayments->wallet()->getCoinBalances($isNeedAll);

所有函数的完整列表在/Actions/Wallet.php中。它匹配文档中“钱包”部分的CoinPayments方法。