In the API list of Counos Payment Gateway, you cannot do anything without authorization and all APIs are closed. So you have to authorize first. It needs to be mentioned that these APIs are temporarily free and available to all users. To use each API, you simply need to click on it, then click on try it out, and then click on execute. It also needs to be mentioned that the curl of all the APIs are created and you can turn this curl to the code you want in whatever programming language you want and that you are using it in your store. So everything is completely scalable. Use your API key in requests header with ‘X-API-KEY’ parameter.
You can see the API details and samples available on https://payment.counos.io/swagger.
In this section we will describe how to use these API endpoints considering their priority.
- You can get the crypto, currencies and metals rates (in USD or Euro) on these API endpoints to use in your application:
- GET /api/exchange/rate/crypto
- GET /api/exchange/rate/currencies
- GET /api/exchange/rate/metals
- You can convert crypto to currencies and vice versa with these API endpoints:
- GET /api/exchange/rate/currency2crypto/convert
- GET /api/exchange/rate/crypto2currency/convert
- This API shows the list of the activated tickers for the terminal of your store. It shows exactly which tickers are active for your terminal. All the currencies (including cryptocurrencies) have their own id which can be set in this API:
- GET /api/terminal/tickers
- For example, you will see a list including BTC, Eth, CCX, …
-
In order to create a new purchase record due to payment flow, you should call this API to create a new payment tracker for a specific order (with your own specific Order ID).
- POST /api/terminal/order
- When a customer wants to purchase a number of products from your store and then wants to pay for them, when the order is registered and the customer is waiting for the payment gateway, the order is registered here. This order registration is done in this API. For each order, you can set an order id of your choice. This order id must be unique and non-repetitive. You can input the amount that is expected to be paid. And you can also input the ticker id belonging to a specific cryptocurrency. You can get this ticker id from the above-mentioned API. The last part is “renew.” If you set the value for renew as false, and you have used this order id before, then that order id does not change and does not reset. If you set the value for it as true, and you have used this order id before, then that order id is completely deleted and is created again. If the order id is completely new, then you can just set the value as false and it will have no effect. After you create the order, some information is given to you. Thisinformation includes the amount that should be paid, the order id, the date the order id has been created, the number of confirmations it has received, the number of expected confirmations, the amount that has been paid, the address for payment, and all the other relevant information. A link to a QR code is also given to you after you create an order, this is the QR code that you need to put up in your online store. Using that QR code, the customer can make the payment. So with this API, you can create an order.
- POST /api/terminal/order
-
In this step you can check the order payment tracker detail which has been created in previous step (including payment status, confirmations, payment date and etc.).
- GET /api/terminal/order/{orderId}
- This Order ID parameter is the same Order ID you've created previously. You can see the full information of the order id, including how many confirmations it has received, how much of it has been paid, what is its status, when it will expire, and other relevant information. If the payment is not yet made, the value “paid” is set to false, but if the payment is made the value will change to true.
Programmatically As you know you can get your store account balance on your control panel on your website profile with full activities (including orders, total balance and income, withdraws and etc.).
- GET /api/terminal/order/{orderId}
In addition, this can be done programmatically by these API endpoints:
-
GET /api/terminal/balance
- In this API you can see the list of the balance of all tickers. It tells you for example how many Counos Coin, Counos X, Bitcoin, and etc. you have.
-
GET /api/terminal/withdraws
- You can see a list of all your withdrawals with all their information and check their status, whether the payment has been made, the number of confirmations, and all the relevant information. You can also search through this list by wallet address or transaction ID.
-
POST /api/terminal/withdraw
- You can use this API to withdraw the balance from each ticker (cryptocurrency). Keep in mind that in order to withdraw the amount must be higher than a certain minimum.
- Important: in order for you to be able to withdraw, you need to have checked this option in the Counos Payment Gateway dashboard: allow withdraw and send transaction form terminal’s wallet If you have not checked this option, then you will not be able to withdraw, and you will see this message: Withdraw is not permitted by API. Please contact the terminal owner. So you need to check that option in the dashboard. If you have checked that option, after you ask for a withdraw, then an email will be sent to you with a link, in that link you can see the fee amount, the amount that can be withdrawn, and also input the wallet address and make the withdrawal.