Get Started

Get Started

Easiest way to get started is by using our ready-to-use plugins and libraries,
please check our resources page.

Otherwise, if you're a developer or you want to integrate our service with your code,
just follow this guide.

Arrow Down

How it works

  1. You request a new payment address from our API, with your crypto address and callback URL (e.g http://example.com/callback?invoice=1234)
  2. You present your customer with the payment address generated by our system
  3. Your customer sends the amount to the payment address our system generated
  4. Upon confirmation[1] our system forwards the payment to the address you provided when you request the address and notifies your system via the callback URL you provided with the payment details (value, TXID in, TXID out, etc)
  5. Your system confirms the payment value and grants access to the user

Practical Scenario

Let's say you want to be paid in Bitcoin, and that your Bitcoin address is:

1PE5U4temq1rFzseHHGE2L8smwHCyRbkx3

And your service's callback URL is:

http://myservice.com/payment/callback/

User A enters your website and places the Order #1234, with the total of 0.001 BTC.

So, you make a request to our BTC API like so:

https://api.cryptapi.io/btc/create/?address=1PE5U4temq1rFzseHHGE2L8smwHCyRbkx3&callback=http://myservice.com/payment/callback/?invoice=1234&nonce=randomstring

This will generate a new payment bitcoin address, and will return a JSON, like this:

{ "status": "success", "callback_url": "http://myservice.com/payment/callback/?invoice=1234&nonce=randomstring", "address_in": "1SKNHcxFc1bFccqPd5g3En4j2WCVX3Dqc", "address_out": "1PE5U4temq1rFzseHHGE2L8smwHCyRbkx3" }

Where the address_in is the new generated address, the address_out is the BTC address you provided (where the funds will be sent to) and callback_url is the URL you provided, where the payment confirmation will be sent to.

You save this data on your side and present the address_in to your customer, along with the value of invoice (in this case 0.001 BTC).

Your customer sends the 0.001 BTC to that address and whenever the payment is confirmed (has 1 confirmations) [1], our system forwards the payment to the BTC address you provided (address_out). After this, our system will make a GET request to the callback URL you provided, with the payment details.

In this example, the callback request would look something like the following:

http://myservice.com/payment/callback/?invoice=1234&nonce=randomstring&value=100000&address_in=1SKNHcxFc1bFccqPd5g3En4j2WCVX3Dqc&address_out=1PE5U4temq1rFzseHHGE2L

Upon receiving this request, you can validate the invoice, check if the value matches and save the transaction IDs (TXID).

It's also very much recomended for you to provice a nonce, which is a random string you generate, that you validate when you receive our request, to make sure the request is coming from us.

[1] in case you append the pending=1 parameter to the address request, you will be notified twice, once when the transaction is first seen on the network, and another when confirmed.

Examples

BTC_

https://api.cryptapi.io/btc/create/?address=1PE5U4temq1rFzseHHGE2L8smwHCyRbkx3&callback=http://example.com/callback?invoice=1234

BTH_

https://api.cryptapi.io/bch/create/?address=bitcoincash:qrz6pkvsaxmy6aypy8sdvg5l3pac8zg3qvtqdaarwq&callback=http://example.com/callback?invoice=1234

LTC_

https://api.cryptapi.io/ltc/create/?address=LLGrzcbppKCii4377sMpRiiBeNP8QjWnqt&callback=http://example.com/callback?invoice=1234

ETH_

https://api.cryptapi.io/eth/create/?address=0x76e81bf0d554c1c9237cc143905079c6a4a5bf26&callback=http://example.com/callback?invoice=1234

XMR_

https://api.cryptapi.io/xmr/create/?address=84wnBPZxhSrHFRnrHnBsnti5jZkWcXJRrYJWJ4A61xEQfJF4H8VL9RZGcvSrQKumMNFHgEqHiJvMHWkx67w64Q2sQRmkxE7&callback=ht

TRX_

https://api.cryptapi.io/trx/create/?address=TBEQYbaTXZdYd9hUpEpp6QRRTbzs3o6kSr&callback=http://example.com/callback?invoice=1234

IOTA_

https://api.cryptapi.io/iota/create/?address=GCSTVSRTLLPBEXZNGWTDHCGPNVARNSRXFPWGAWTQBSZLIMELSZPWKKTKXHKBXIUDNGQFHVYAZMHG9NXNDRXPRLL9ZA&callbac