ibragimoff26/crypto-pay-api

Crypto pay api for @CryptoBot

1.1.0 2022-06-13 11:04 UTC

This package is auto-updated.

Last update: 2024-03-13 15:34:26 UTC


README

Crypto Pay is a payment system based on @CryptoBot, which allows you to accept payments in cryptocurrency using the API. This library help you to work with Crypto Pay via Crypto Pay API.

Install

composer require ibragimoff26/crypto-pay-api

Usage

Just create an instance of 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" 
    )
);