Skip to content

Latest commit

 

History

History
261 lines (175 loc) · 25.3 KB

README.md

File metadata and controls

261 lines (175 loc) · 25.3 KB

CryptAPI

CryptAPI's PHP Library

Official PHP library of CryptAPI

Table of Contents

  1. Requirements
  2. Installation
  3. API and utils
  4. Help

Requirements:

PHP >= 7.2
ext-curl

Installation

composer require cryptapi/php-cryptapi

on GitHubon Composer

API and utils

Generating a new address

<?php
require 'vendor/autoload.php'; // Where your vendor directory is

$ca = new CryptAPI\CryptAPI($coin, $my_address, $callback_url, $parameters, $cryptapi_params, $api_key);

$payment_address = $ca->get_address();

Where:

$coin is the coin you wish to use, from CryptAPI's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...) $my_address is your own crypto address, where your funds will be sent to $callback_url is the URL that will be called upon payment $parameters is any parameter you wish to send to identify the payment, such as ['order_id' => 1234] $cryptapi_params parameters that will be passed to CryptAPI (check which extra parameters are available here: https://docs.cryptapi.io/#operation/create) $payment_address is the newly generated address, that you will show your users $api_key is the API Key provided by BlockBee, since this library is also compatible with BlockBee API.

With get_address() you will be creating the request in our API using this endpoint: https://docs.cryptapi.io/#operation/create.

Response sample:

0x0E945b1554c8029A6B9bE1F7A24ae75d2F44d8DB

Getting notified when the user pays

The URL you provided earlier will be called when a user pays, for easier processing of the request we've added the process_callback helper

<?php

require 'vendor/autoload.php'; // Where your vendor directory is

$payment_data = CryptAPI\CryptAPI::process_callback($_GET);

The $payment_data will be an array with the following keys:

address_in - the address generated by our service, where the funds were received

address_out - your address, where funds were sent

txid_in - the received TXID

txid_out - the sent TXID or null, in the case of a pending TX

confirmations - number of confirmations, or 0 in case of pending TX

value - the value that your customer paid

value_coin - the value that your customer paid, in the main coin denomination (e.g BTC)

value_forwarded - the value we forwarded to you, after our fee

value_forwarded_coin - the value we forwarded to you, after our fee, in the main coin denomination (e.g BTC)

coin - the coin the payment was made in (e.g: 'btc', 'eth', 'erc20_usdt', ...)

pending - whether the transaction is pending, if false means it's confirmed

plus, any values set on $params when requesting the address, like the order ID.

 

From here you just need to check if the value matches your order's value.

Checking the logs of a request

<?php

require 'vendor/autoload.php'; // Where your vendor directory is

$ca = new CryptAPI\CryptAPI($coin, $my_address, $callback_url, $parameters);
$data = $ca->check_logs();

All the data returned in the response can be checked here: https://docs.cryptapi.io/#operation/logs

Response sample:

object(stdClass) {
  ["status"]=>string(7) "success"
  ["callback_url"]=>string(37) "https://example.com?payment_id=123112"
  ["address_in"]=>string(42) "0x0E945b1554c8029A6B9bE1F7A24ae75d2F44d8DB"
  ["address_out"]=>string(42) "0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d"
  ["notify_pending"]=>bool(true)
  ["notify_confirmations"]=>int(1)
  ["priority"]=>string(7) "default"
  ["callbacks"]=>array(0) {
  }
}

Generating a QR code

<?php
require 'vendor/autoload.php'; // Where your vendor directory is

$ca = new CryptAPI\CryptAPI($coin, $my_address, $callback_url, $parameters, $cryptapi_params);
$payment_address = $ca->get_address();

$qrcode = $ca->get_qrcode($value, $size);

For object creation, same parameters as before. You must first call get_address as this method requires the payment address to have been created.

Where:

$value Value to request the user, in the main coin (BTC, ETH, etc). Optional, pass false to not add a value to the QR.

$size Size of the QR Code image in pixels. Optional, pass false to use the default size of 512.

Response is an object with qr_code (base64 encoded image data) and payment_uri (the value encoded in the QR), see https://docs.cryptapi.io/#operation/qrcode for more information.

Response sample:

object(stdClass) {
  ["status"]=>string(7) "success"
  ["qr_code"]=>string(18700) "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAA2j0lEQVR4nO3deZgdRb038F9VdZ91tkz2hISELJCwxLDIIoQgIWRFtoiAiq+iKOrrAlcRBV/lIqAgeNm9lwt4QQkoCCEbmIssYZ0ECFlNmOyZbDOZ9axdVe8fPTOEZJJ05vRM95z6fp55eHhgprfTXd9T3dW/YlprAgAA8/CgNwAAAIKBAAAAMBQCAADAUAgAAABDIQAAAAyFAAAAMBQCAADAUAgAAABDIQAAAAyFAAAAMBQCAADAUAgAAABDWR5/jzH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BXoAAACGQgAAABgKAQAAYCgEAACAoRAAAACGQgAAABgKAQAAYCgEAACAoRAAAACGQgAAABgKAQAAYCgEAACAoXwuBudRUAXIwlw0KqhtQ824Ti/Qo6DqsvkoqBKEYT7rfOfvznr8INADAAAwFAIAAMBQCAAAAEMhAAAADIUAAAAwFAIAAMBQCAAAAEMhAAAADIUAAAAwFAIAAMBQCAAAAEMhAAAADBVMMTijBFJZzPf1+lvkK5DCZ95XGkgNMn8PXVCfVyAnQCCfV5iL93mHHgAAgKEQAAAAhkIAAAAYCgEAAGAoBAAAgKEQAAAAhkIAAAAYCgEAAGAoBAAAgKEQAAAAhkIAAAAYCgEAAGAoFIMLC98LWvlblsvfzQt5ybBAjkkggtrT4iga6K9Ajgl6AAAAhkIAAAAYCgEAAGAoBAAAgKEQAAAAhkIAAAAYCgEAAGAoBAAAgKEQAAAAhkIAAAAYCgEAAGAoBAAAgKEQAAAAhgqmGmhQ9faKgPdDF+ZalSE/AcJ86DwKqtxmIAVcw1zRNuTQAwAAMBQCAADAUAgAAABDIQAAAAyFAAAAMBQCAADAUAgAAABDIQAAAAyFAAAAMBQCAADAUAgAAABDIQAAAAzFAqmjVBwCqWjm+wcR5rps/u5scdTR8yiQomy+r9dfRfCxeufxg0APAADAUAgAAABDIQAAAAyFAAAAMBQCAADAUAgAAABDIQAAAAyFAAAAMBQCAADAUAgAAABDIQAAAAyFAAAAMJTXYnAAAFBk0AMAADAUAgAAwFAIAAAAQyEAAAAMhQAAADAUAgAAwFAIAAAAQyEAAAAMhQAAADAUAgAAwFAIAAAAQyEAAAAM9f8BMAGKJ2yAZagAAAAASUVORK5CYII="
  ["payment_uri"]=>string(42) "0x0E945b1554c8029A6B9bE1F7A24ae75d2F44d8DB"
}

Usage

<img src='data:image/png;base64,<?php echo $qrcode->qr_code; ?>'/>

Estimating transaction fees

<?php
require 'vendor/autoload.php'; // Where your vendor directory is

$fees = CryptAPI\CryptAPI::get_estimate($coin, $addresses, $priority);

Where:

$coin is the coin you wish to check, from CryptAPI's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...)

$addresses The number of addresses to forward the funds to. Optional, defaults to 1.

$priority Confirmation priority, needs to be one of ['fast', 'default', 'economic']. Optional, defaults to default.

Response is an object with estimated_cost and estimated_cost_usd, see https://docs.cryptapi.io/#operation/estimate for more information.

Response sample:

object(stdClass) {
  ["status"]=>string(7) "success"
  ["estimated_cost"]=>string(11) "0.000496344"
  ["estimated_cost_currency"]=>
  object(stdClass) {
    ["AED"]=>string(4) "1.12"
    ["AUD"]=>string(4) "0.46"
    ["BGN"]=>string(4) "0.55"
    # ... remaining FIAT currencies
  }
}

Converting between cryptocurrencies and FIAT

<?php
require 'vendor/autoload.php'; // Where your vendor directory is

$conversion = CryptAPI\CryptAPI::get_convert($coin, $value, $from);

Where:

$coin the target currency to convert to, from CryptAPI's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...)

$value Value to convert in from.

$from Currency to convert from, FIAT or crypto.

Response is an object with value_coin and exchange_rate, see https://docs.cryptapi.io/#operation/convert for more information.

Response sample:

object(stdClass) {
  ["status"]=>string(7) "success"
  ["value_coin"]=>string(1) "3"
  ["exchange_rate"]=>string(8) "0.999467"
}

Getting supported coins

<?php
require 'vendor/autoload.php'; // Where your vendor directory is

$coins = CryptAPI\CryptAPI::get_supported_coins();

Response is an array with all support coins.

Response sample:

array(65) {
  [0]=>string(3) "btc"
  [1]=>string(3) "bch"
  [2]=>string(3) "ltc"
  [3]=>string(4) "doge"
  [4]=>string(11) "bep20_1inch"
  [5]=>string(9) "bep20_ada"
  # ...remaining supported cryptocurrencies or tokens
}

Help

Need help?
Contact us @ https://cryptapi.io/contacts/