With PayByte, you can use simple GET calls in order to create payments, get payments status and also get the latest exchange rates.

PayByte is a simple, reliable and fast way to accept crypto payments from your customers.
Just contact us to register as a merchant and we will provide you with an api Key to start accepting crypto payments.



What do I need to get started

To start using PayByte you just need a 'BTC', 'BCH', 'LTC', 'DASH', 'BTG', 'DGB', 'BTX', 'GRS', 'BTCT' wallet.
Register as a merchant and setup your Wallet providing the Master Public Key (xpub and tpub) and you are good to go.


Important:

Not all wallets support exporting the Master Public Key (xpub, tpub) but you can use one of the following:


Coin Supported wallet
BitcoinCopay, Electrum
Bitcoin CashCopay
LitecoinElectrum-LTC
DashCoinomi (Mobile)
Bitcoin GoldElectrumG
DigiByteExodus, Coinomi (Mobile)
GroestlcoinElectrum GRS, Coinomi (Mobile)
BitCoreCoinomi (Mobile)

Sample code which shows how easy and stress-free it is to create a new payment using PayByte.
Simply call the desired endpoint, provide the required parameters and read the JSON response.

C# sample code

using( var httpClient = new HttpClient()) 
{
    var PayByteCreatePaymentUri = "https://paybyte.io/api/create-payment?req_amount=2.2&api_key=801EAF5B-FA98-4D5F-8F71-D7F627A96C92&req_currency=BTC&pay_currency=BTC";
    var response = await httpClient.GetAsync(PayByteCreatePaymentUri);
    return await response.Content.ReadAsStringAsync();  
}

Javascript sample code

var dataString = "req_amount=2.2&api_key=801EAF5B-FA98-4D5F-8F71-D7F627A96C92&req_currency=BTC&pay_currency=BTC";
$.ajax ({
  type: "GET",
  url: "https://paybyte.io/api/create-payment",
  data: dataString,
  success: function(response) { alert(response); }
});
A PayByte payment can be in one of the following states:

Pending

Any new payment starts in the pending state.
If the payment doesn't get paid within its expiration window (currently set to 24 hours), it will be be moved to the expired state.


Payment Received (Unconfirmed)

As soon as the payment has been received on the payment address, the transaction will be moved to the payment_received_unconfirmed state.
Payments in this state has been broadcasted into the Blockchain but has not been fully confirmed yet, we consider a payment as fully confirmed when at least 6 confirmations have been received from the blockchain.
This is an intermediate state which improves the user expirience, showing to the end-user that the current payment has been received but that still needs further processing.


Payment Received

Once the payment has been fully confirmed, the transaction will be moved to the payment_received state.
For security purposes we consider a payment as fully confirmed once it received at least 6 confirmations from the Blockchain.
If the amount paid is equal to or greater than the original transaction amount, we flag the transaction as paid.


Expired

A transaction is moved to the expired state when the payment has not been received on the payment address within the expiration window (15 minutes).
PayByte won't monitor transactions in this state any further.

A Callback is an HTTP GET message that PayByte sends to the provided callback URL everytime the transaction state changes.

You will need a server-side logic to handle the callback maily to update ypur internal datastore about a change in a state of a payment request.


Remarks

1. We only send HTTP GET request messages containing the details of the transaction, in addition to any parameter already present in the original Callback URL.
2. We only support callback URLs which use HTTPS and which are not longer than 1024 characters.
3. Make sure to properly URL Encode the Callback URL to avoid any loss of parameters being sent over.

Invalid callback URLs will just be ignored.

For security reasons we recommend to include a unique, secret parameter in your callback URL, which will be passed back to you when the callback will be sent. It should be checked against the original secret string to ensure that the received callback is coming from us and it is not forged.

To uniquely identify a received callback message, you can also add additional parameters to your callback URL like an invoice id or a payment identifier.

Make sure to not rely on whitelisting PayByte’s sending IP addresses, as these IP addresses are subject to change without notice.

The following table shows all the GET parameters we will send to your server on the Query String:


Parameter Type Description
payment_amount decimal The amount required to be paid in 'pay_currency'.
payment_amount_received decimal The amount which has been received so far.
payment_address string The blockchain address used for this payment order.
payment_id string The identifier of the payment order.
status string The status of the payment transaction. See payment statuses to inspect the full list.
payment_currency string The cryptocurrency used to pay for this payment request.
Supported crypto: 'BTC', 'BCH', 'LTC', 'DASH', 'BTG', 'DGB', 'BTX', 'GRS', 'BTCT'.

This endpoint creates a new payment request.


HTTP Request


GET https://paybyte.io/api/create-payment

Query string parameters


Parameter Type Required Description
api_key string YES The API key assigned to your merchant account.
req_amount decimal YES The amount for this payment request espressed as a decimal number.
req_currency string YES The payment request currency. It can be either one of the supported cryptocurrencies or a fiat currency.
If this is a FIAT currency, the 'req_amount' will be converted from 'req_currency' to 'pay_currency' based on the latest exchange rate.
Currently supported crypto: 'BTC', 'BCH', 'LTC', 'DASH', 'BTG', 'DGB', 'BTX', 'GRS', 'BTCT'.
pay_currency string YES The cryptocurrency used to pay this payment request.
Currently supported crypto: 'BTC', 'BCH', 'LTC', 'DASH', 'BTG', 'DGB', 'BTX', 'GRS', 'BTCT'.
callback string NO The URL where we will send a GET notification message every time the transaction state changes.

Important

1. We only accept callbacks URLs which use HTTPS.
2. The callback URL cannot be longer than 1024 characters.
3. The callback URL has to be properly URL encoded. Otherwise a loss in the provided list of parameters may occurr.

Invalid callback URLs will be just ignored.
For more information about Receiving Callbacks please follow this link.
affid string NO The affiliate identifier.
return-url string NO The URL which will be used to return the customer to the merchant site.

Important

1. The return URL cannot be longer than 1024 characters.
2. The return URL has to be properly URL encoded. Otherwise a loss in the provided list of parameters may occurr.

Invalid return URLs will be just ignored.

Response fields

Success response

Field Type Description
payment-id string The identifier of the payment order.
payment-address string The blockchain payment address related to the 'payment-currency' network.
payment-amount decimal The amount of The amount of 'payment-currency' for this payment request.
payment-amount-received decimal The amount of 'payment-currency' which has been received so far.
payment-currency string The payment request cryptocurrency.
request-amount decimal The original amount espressed in 'req_currency'. This value can be subject to a coversion if 'req_currency' and 'pay_currency' are different.
request-currency string The cryptocurrency used to pay this payment request
request-currency-is-fiat bool True if the 'req_currency' is a FIAT currency, False otherwise.
conversion-rate decimal The exchange rate applied to this payment request. This is applied if 'req_currency' and 'pay_currency' are different.
created-on datetime The string represenation of the datetime of when the payment transaction has been created.
DateTime format is: "YYYY-MM-ddThh:mm:ss Z"
expires-on datetime The string represenation of the datetime of when the payment transaction will expire.
DateTime format is: "YYYY-MM-ddThh:mm:ss Z"
status string The status of the payment transaction. See payment statuses to inspect the full list.
blockchain-txid string The string representation of the blockchain transaction id related to a payment.
Default value to null when a new transaction is being created.
callback-url string The URL where we will send a GET notification message every time the transaction state changes.
is-testnet bool True if this is a testnet transaction, False otherwise. Supported tetstnet crypto: 'BTCT'.
merchant-id string The identifier of the merchant assigned to the api key.
payment-url string The URL which will show the payment status as a simple HTML page.
affiliate-id string The affiliate identifier assigned to the transaction request.
error string Set to "ok" to confirm that a new payment has been successfully created.

Error response

Field Type Description
error string A string description of the encoutered error.

Example


REQUEST
    curl https://paybyte.io/api/create-payment?req_amount=1212.4&api_key=801EAF5B-FA98-4D5F-8F71-D7F627A96C92&pay_currency=BTCT&req_currency=USD&callback=https://test.com/callback?invoiceId=123%26secret=thisismysecret

RESPONSE
{
   "transaction": {
      "payment-id": "99b2082d-1e74-448b-ab5d-da43b635699f",
      "payment-address": "n3eXiFysGSSrfLxmv3gWPWUygqxYRZvLEA",
      "payment-amount": 0.304300276,
      "payment-amount-received": 0,
      "payment-currency": "BTCT",
      "request-amount": 1212.4,
      "request-currency": "USD",
      "request-currency-is-fiat": true,
      "created-on": "2017-11-18T15:15:41.8655045Z",
      "expires-on": "2017-11-19T03:15:41.8655045Z",
      "custom-field": null,
      "status": "pending",
      "is-testnet": true,
      "blockchain-txid": null,
      "callback-url": "https://test.com/callback?invoiceId=123&secret=thisismysecret",
      "payment-url": "https://paybyte.io/get-invoice?payment_id=27b4d510-3869-4913-939a-62f42041ed86",
      "affiliate-id": null
   },
   "error": "ok"
}

You can create a new payment within a modal dialog on your website, in that way the consumer doesn't have to leave your site during the process.


1. To use the modal dialog, just add a reference to the paybyte.js file into your page:

<script type="text/javascript"
src="https://paybyte.io/scripts/paybyte.js"></script>


2. Add a button or even a generic <div> with id=pbt_create-payment-btn


3. Decorate your div with the following parameters: pbt-req-amount , pbt-api-key , pbt-pay-currency which will be used to generate your payment request.


The modal will automatically update showing the latest state of the current payment.


Code example

<script type="text/javascript" src="https://paybyte.io/scripts/paybyte.js"></script>
<button type="submit" id="pbt_create-payment-btn" 
    pbt-req-amount="0.005" 
    pbt-api-key="801EAF5B-FA98-4D5F-8F71-D7F627A96C92"
    pbt-req-currency="USD"
    pbt-pay-currency="BTC"
    class="btn btn-lg btn-warning">
         Pay with PayByte
</button>

Button parameters


Parameter Type Required Description
pbt-req-amount decimal YES The amount for this transaction espressed as a decimal number.
pbt-api-key string YES The API key assigned to the current merchant account.
pbt-req-currency string YES The payment request currency. Can be either a FIAT or a supported cryptocurrency. Currently supported: 'BTC', 'BCH', 'LTC', 'DASH', 'BTG', 'DGB', 'BTX', 'GRS', 'BTCT'.
pbt-pay-currency string YES The payment cryptocurrency. Currently supported: 'BTC', 'BCH', 'LTC', 'DASH', 'BTG', 'DGB', 'BTX', 'GRS', 'BTCT'.

Button generator

For an even easier integration, you can use our button generator which will generate the code you need, based on your needs.

Button Generator

This endpoint returns detailed information related to the requested transaction.


HTTP Request


GET https://paybyte.io/api/get-payment-status

Query string parameters


Parameter Type Required Description
payment_id string YES The payment identifier for this transaction. It was returned to you initially when you created the payment request.

Response fields

Success response

Field Type Description
payment-id string The identifier of the payment order.
payment-address string The 'payment-currency' address related to this payment request.
payment-amount decimal The amount of The amount of 'payment-currency' for this payment request.
payment-amount-received decimal The amount of 'payment-currency' which has been received so far.
payment-currency string The payment request cryptocurrency.
request-amount decimal The original amount espressed in 'req_currency'. This value can be subject to a coversion if 'req_currency' and 'pay_currency' are different.
request-currency string The cryptocurrency used to pay this payment request
request-currency-is-fiat bool True if the 'req_currency' is a FIAT currency, False otherwise.
conversion-rate decimal The exchange rate applied to this payment request. This is applied if 'req_currency' and 'pay_currency' are different.
created-on datetime The string represenation of the datetime of when the payment transaction has been created.
DateTime format is: "YYYY-MM-ddThh:mm:ss Z"
expires-on datetime The string represenation of the datetime of when the payment transaction will expire.
DateTime format is: "YYYY-MM-ddThh:mm:ss Z"
status string The status of the payment transaction. See payment statuses to inspect the full list.
blockchain-txid string The string representation of the blockchain transaction id related to a payment.
Default value to null when a new transaction is being created.
callback-url string The URL where we will send a GET notification message every time the transaction state changes.
is-testnet bool True if this is a testnet transaction, False otherwise. Supported tetstnet crypto: 'BTCT'.
merchant-id string The identifier of the merchant assigned to the api key.
payment-url string The URL which will show the payment status as a simple HTML page.
affiliate-id string The affiliate identifier assigned to the transaction request.
error string Set to "ok" to confirm that a new payment has been successfully created.

Error response

Field Type Description
error string A string description of the encoutered error.

Example


REQUEST
curl https://paybyte.io/api/create-payment?req_amount=1212.4&api_key=801EAF5B-FA98-4D5F-8F71-D7F627A96C92&pay_currency=BTCT&req_currency=USD&callback=https://test.com/callback?invoiceId=123%26secret=thisismysecret

RESPONSE
{
   "transaction": {
      "payment-id": "99b2082d-1e74-448b-ab5d-da43b635699f",
      "payment-address": "n3eXiFysGSSrfLxmv3gWPWUygqxYRZvLEA",
      "payment-amount": 0.304300276,
      "payment-amount-received": 0,
      "payment-currency": "BTCT",
      "request-amount": 1212.4,
      "request-currency": "USD",
      "request-currency-is-fiat": true,
      "created-on": "2017-11-18T15:15:41.8655045Z",
      "expires-on": "2017-11-19T03:15:41.8655045Z",
      "custom-field": null,
      "status": "pending",
      "is-testnet": true,
      "blockchain-txid": null,
      "callback-url": "https://test.com/callback?invoiceId=123&secret=thisismysecret",
      "payment-url": "https://paybyte.io/get-invoice?payment_id=27b4d510-3869-4913-939a-62f42041ed86",
      "affiliate-id": null
   },
   "error": "ok"
}

You can get the status of any payment using a simple HTML endpoint.


Calling this endpoint will point to the page related to the specified transaction. The page will automatically update reflecting the latest transaction status.

Browser Request


GET https://paybyte.io/get-invoice

Query string parameters


Parameter Type Required Description
payment_id string YES The payment identifier for this transaction. It was returned to you initially when you created the payment request.

Code example

<a target="_blank" href="https://paybyte.io/get-invoice/[payment_id]">Link to payment request</a>

This endpoint returns the exchange rate of the requested currency against all supported crytpocurrencies.


HTTP Request


GET https://paybyte.io/api/get-rate

Query string parameters


Parameter Type Required Description
currency string YES The input currency can be either a supported cryptocurrency or a FIAT currency.

Response fields

Success response

Field Type Description
name string The currency name.
btc_rate string The current exchange rate with BTC.
bch_rate string The current exchange rate with BCH.
ltc_rate string The current exchange rate with LTC.
dash_rate string The current exchange rate with DASH.
btg_rate string The current exchange rate with BTG.
dgb_rate string The current exchange rate with DGB.
grs_rate string The current exchange rate with GRS.
btx_rate string The current exchange rate with BTX.
full_name string The full currency name
error string Set to "ok" to confirm a successful response.

Error response

Field Type Description
error string A string description of the encoutered error.

Example


REQUEST
curl https://paybyte.io/api/get-rate?currency=usd

RESPONSE
{
    "rate": {
        "name": "USD",
        "full_name": "United States Dollar",
        "btc_rate": 0.00025064,
        "bch_rate": 0.00665808,
        "dash_rate": 0.01086955,
        "ltc_rate": 0.01647085,
        "btg_rate": 0.07502075,
        "dgb_rate": 69.06983651,
        "grs_rate": 2.3733071,
        "btx_rate": 4.18410042
    },
    "error": "ok"
}