ibragimoff26/crypto-pay-api

为 @CryptoBot 设计的加密支付 API

1.1.0 2022-06-13 11:04 UTC

This package is auto-updated.

Last update: 2024-09-13 16:39:16 UTC


README

Crypto Pay 是一个基于 @CryptoBot 的支付系统,允许您通过 API 接受加密货币支付。这个库可以帮助您通过 Crypto Pay API 使用 Crypto Pay

安装

composer require ibragimoff26/crypto-pay-api

用法

只需创建一个 CryptoPayApi 实例即可。

$httpClient = new \Ibragimoff\CryptoPayApi\Client\HttpClient(
    'API_HOST_NAME', // https://pay.crypt.bot/ for mainnet and https://testnet-pay.crypt.bot/ for testnet
    'YOUR_API_KEY',
    new \Symfony\Component\HttpClient\CurlHttpClient()
);

$api = new \Ibragimoff\CryptoPayApi\CryptoPayApi($httpClient);

$me = $api->getMe();

$balance = $api->getBalance();

$currencies = $api->getCurrencies();

$exchangeRate = $api->getExchangeRate();

$invoices = $api->getInvoices(
    new \Ibragimoff\CryptoPayApi\Model\GetInvoices\GetInvoicesRequest(
        asset: "TON"
    )
);

$newInvoice = $api->createInvoice(
    new \Ibragimoff\CryptoPayApi\Model\CreateInvoice\CreateInvoiceRequest(
        asset: "TON",
        amount: "0.01" 
    )
);