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
PHP version >= 7.x
$ composer require explorer-cash/api-php
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();
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;
}
}
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'
]);
Having trouble with this library or explorer.cash API ? Contact our support and we’ll help you sort it out.
GNU Lesser General Public License v3.0
© 2020 explorer.cash. All Rights Reserved.