We'll take you through the steps required, so that you can start accepting Crypto in your projects today.
Let us tell you exactly how BlockchainAPI works.
The way it works is like this:
The developer creates an address using BlockchainAPI's BTC or ETH endpoint. This will return a unique address for your customers to pay to. (Because it's unique, it means we can track it).
When a payment is sent to an address generated by BlockchainAPI, our system will automatically notice the in-coming funds and forward them to the destination address you supplied when creating a unique address through our endpoint.
At the stage the payment is forwarded and hits 1 confirmation, data is sent to your callback URL you supplied when generating a unique address.
From there, you can dig into the values of the data sent by BlockchainAPI to make sure the payment amount is correct, the destination address is correct, etc.
It's really simple. No long, tiring pieces of code. No registration. Straight to the point.
Within 1 single GET request, you can have customers paying you.
If you'd like to catch the payment information sent back to you, you'll need 1 extra piece of code in your projects... the callback checker.
Generating an address
Like we said above, the first thing to do is generate a unique address for your customers to pay to.
The following code uses CURL to send a GET request to BlockchainAPI's create endpoint.
So with the above code, you'll be able to fully accept Crypto into your projects... however, you will not be able to check the payment details such as the amount sent, the address sent to, the fees sent etc.
This is where the callback checker comes into play.
When BlockchainAPI forwards a payment, it sends data along with it, to the callback URL supplied when creating the unique address in step 1.
Let's check an example of the data that is sent to us from BlockchainAPI.
Everything in the left column are POST values that're sent to your callback URL when a payment is forwarded to you. It is up to you if you wish to use all of these values but they're there for reasons such as confirming the amount sent or confirming the destination address matches yours.
You'll need to make a callback file and place something like the following inside it:
// Payment Settings
// If you're using a secret, put it in here
// Start of checks
die('No secret found.');
// Make sure we have all the POST variables we want to get