Giter Club home page Giter Club logo

api-php's Introduction

N|Solid

explorer.cash API for PHP

The library provide an access to explorer.cash Blockchain API for PHP applications. You can easily add payment request and receive a notification when a crypto payment is confirmed on the blockchain. explorer.cash Blockchain API supports multiple cryptocurrencies like Bitcoin (BTC), Bitcoin Cash (BCH), Tether (USDT), USD Coin (USDC), Ethereum (ETH), Litecoin (LTC) ...

📗 See explorer.cash Blockchain API documentation

Requirements

PHP version >= 7.x

How to install

$ composer require explorer-cash/api-php

How to use

Register a payment request to explorer.cash

use ExplorerCash\PaymentRequest;

$payment_request = new PaymentRequest();

$payment_request->push([
    'unit' => 'BTC',
    'address' => '1R9NpmdVpC4eKajqutKqSSEn5hH4DEkLs',
    'payment_reference' => 'ORD-4579',
    'amount' => '0.084',
    'callback_url' => 'https://your-callback-url',
    'timeout' => 10,
    'confirmations' => 3
]);

// In your code
$cart = Cart::byReference('ORD-4579');

$cart->payment_id = $payment_request->paymentId();
$cart->save();

Retrieve payment request when your callback URL is called

You need to check that "payment_id" associated to the "payment_reference" are the same.

use ExplorerCash\PaymentRequest;

$payment_request = new PaymentRequest();

$payment_data = $payment_request->pull();

// In your code
$cart = Cart::byReference($payment_data['payment_reference']);

if ($cart->payment_id === $payment_data['payment_id']) {
    if ($payment_data['status'] === 'PAID') {
        $cart->isPaid = true;
    }
}

Subscribe to explorer.cash crypto currencies exchange rates

You will receive the exchange rates of top 100 cryptos in the currency you provided.

use ExplorerCash\Api;

Api::subscribeRates([
    'currency' => 'EUR',
    'callback_url' => 'https://your-callback-url'
]);

Support or Contact

Having trouble with this library or explorer.cash API ? Contact our support and we’ll help you sort it out.

License

GNU Lesser General Public License v3.0

© 2020 explorer.cash. All Rights Reserved.

api-php's People

Contributors

explorer-cash avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.