API Integration Guide
Our goal is to make it as simple as possible for your website to accept cryptocurrencies. Our API does not require an account, API keys, or any verification. All that’s needed is a single API request.
Creating a payment invoice
To generate a payment invoice is simple and only requires a single API request. The API end point is https://gateway.paymentapi.io/api/create_payment and the URL parameters are as follows.
Parameter | Options | Required |
---|---|---|
currency | btc, ltc, doge | yes |
payout_address | Payout address valid to the selected currency | yes |
amount | Invoice amount in USD, between 1.00 and 9000.00 | yes |
return_url | The return URL in a valid url format. | yes |
ipn_url | Callback URL for your IPN endpoint | no |
ipn_key | A secret key to validate the request came from us | no |
ipn_data | A string that can contain info such as order ID and user email | no |
product_name | Used as the invoice page title | no |
Invoice without IPN
https://gateway.paymentapi.io/api/create_payment?payout_address=1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa&amount=9.99¤cy=btc&return_url=https://paymentapi.io/
This will generate an invoice for $9.99 USD paid in Bitcoin, once the invoice is paid the Bitcoin will be sent to the address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa and the user will be redirected to https://paymentapi.io/
Invoice with IPN
https://gateway.paymentapi.io/api/create_payment?payout_address=1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa&amount=9.99¤cy=btc&return_url=https://paymentapi.io/&ipn_url=https://paymentapi.io/ipn&ipn_key=secret&ipn_data=420
This will generate an invoice for $9.99 USD paid in Bitcoin, once the invoice is paid the Bitcoin will be sent to the address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa and the user will be redirected to https://paymentapi.io/ a POST request will be sent to https://paymentapi.io/ipn containing ipn_key, ipn_data, and other parameter. Please see below for additional information about IPN.
Payment invoice JSON
Once an invoice is successfully generated it will return JSON containing useful parameters.
Parameter | Comment |
---|---|
status | “success” will be returned if the invoice is generated. Otherwise “error” |
hash | A unique hash of the invoice |
pay_address | The address the user pays to |
price | The price in the selected currency |
invoice_url | The URl of the invoice |
Example success JSON
{"status":"success","hash":"a60b5870afe444fac6e5fe7cc350ba67","pay_address":"bc1q0sfymueg2aukawp3l4sc9luwyzkg0cekg26czj","price":0.000339,"invoice_url":"https:\/\/gateway.paymentapi.io\/invoice\/payment\/a60b5870afe444fac6e5fe7cc350ba67"}
In your application please redirect the user to invoice_url
Error JSON
If there is an issue generating an invoice, for example you’ve inputted an invalid currency – you will receive “status”:”error” containing an error message in the “error” field.
IPN Callback
If you have specified a callback URL in the ipn_url field once the payment has confirmed we will send a post request containing useful information. For each confirm up to 3 confirms we will send this post request.
This post request is made up of three fields; confirms, ipn_key, and ipn_data.
Field | Data |
---|---|
confirms | The amount of confirms the payment has from 1 to 3 |
ipn_key | The secret key sent when creatinmg the invoice |
ipn_data | The data sent when creating the invoice |
Payouts & fees
You will receive the funds to the specified wallet address after one confirm. We take a flat rate fee of 3%.
Invoice themes
We currently have two themes you can use for an invoice, dark & white. By default the invoice will be a white theme. If the parameter &theme=dark is specified the dark theme will be used. Below are an example of both themes.
Christopher
says:
Please how does your service works and how can I sign up and how can I use the services