Accept Ethereum, Bitcoin, Bitcoin Cash, Bitcoin Gold, Litecoin, Dash and Ethereum Classic on your website
JavaScript
PayBear.io API
This API allows to accept Ethereum, Bitcoin, Bitcoin Cash, Bitcoin Gold, Litecoin, Dash and Ethereum Classic payments. More details can be found on our website: https://www.paybear.io
In order to use the system you need an API key. Getting a key is free and easy, sign up here:
https://www.paybear.io
Multiple Currencies
Once registered, you can manage the currencies you want to integrate in the Membership area / Currencies. Please enable the currencies there before using this API.
Get Currencies
Get a list of enabled currencies with this GET request:
The API always responds with a JSON string. [data] collection contains the important values:
[address] is the payment address to show to the customer
[invoice] is our inner payment identifier, keep it in a safe place and never disclose to your clients.
constCONFIRMATIONS = 3;
$orderId = $_GET['id'];
$data = file_get_contents('php://input');
if ($data) {
$params = json_decode($data);
$invoice = $params->invoice;
$amount = $params->inTransaction->amountif ($params->confirmations>=$params->maxConfirmations) {
//compare $amount with order total//compare $invoice with one saved in the database to ensure callback is legitimate//mark the order as paidecho$invoice; //stop further callbacks
} else {
die("waiting for confirmations");
}
}
Get Market Rate
Use GET query to obtain the current average market rates:
The API returns a JSON string containing the rates from several online exchanges, as well as the average rate. It is recommended to cache the rates for 10-15 minutes.
The API returns a JSON string containing the rates from several online exchanges, as well as the average rate. It is recommended to cache the rates for 10-15 minutes.
$url = "https://api.paybear.io/v2/eth/exchange/usd/rate";
if ($response = file_get_contents($url)) {
$response = json_decode($response);
if ($response->success) {
echo$response->data->mid;
}
}
Request Limit
The system is designed to process thousands of transactions per second, so we do not limit the number of payments you can process.
However, for DDoS protection reasons, the API calls are limited to 1000 per minute from one IP.
What to use as a payout address?
You will need payout addresses for all crypto currencies you want to accept. Only you will have access to your payout wallets.
You can use any online wallet, service or exchange of your choice.
If you don't have one, consider reading our Wallet Guide