Welcome
Welcome to the CoinCoin developer documentation.
CoinCoin enables you to easily and quickly inherit cryptocurrency payments into your business, and your customers can pay you directly using their devices/software.
At the same time, CoinCoin offers a full chain solution, you don't have to store addresses and any sensitive information, CoinCoin generates payment addresses on your behalf and continuously checks the blockchain status and notifies you, the status of your customers' payments.
1. Cryptocurrency features
Since the currency exists in the blockchain network, a unique payment address is generated for each order. This helps us to link our customers to their payments and keep you informed.
2. Order status
| Payment Status | Description |
|---|---|
| Receiving(0) | During the validity of the order and without receiving the full amount of cryptocurrency you expect at the time of creation, the order will continue to be collected until the order expires |
| In Settlement(2) | 1. The full amount of cryptocurrency has been received 2. The order is overdue and some cryptocurrency is received in the order |
| Completed(1) | Settlement of completed orders |
| Invalid(-1) | 1. Orders that have timed out and have not received any cryptocurrency 2. Orders where the received cryptocurrency does not cover the network fee 3. Other invalid cases |
3. Orders being settled
All orders with a balance will be settled after the order expiration date or after the full amount of cryptocurrency has been received, and after the settlement is completed, the cryptocurrency will be transferred to your platform wallet. This usually takes a few minutes - a few hours.
Start
- API Server
API path :https://api.coin2.cc/v1 - Create API KEY
- Sign signature
- Create order
- Wait for notification
Interface
Authentication
1. Generating an APIKey
Before you can sign any request, you must create an API Key through the website. after creating the API Key, please save the following information in a secure place.
- APIKey
- SecretKey
2. Making Requests
All private REST requests must contain the following headers:
CC-APP-IDThe APIKey as a StringCC-TIMESPANThe timestamp of your request(13bit)CC-SIGNThe HMAC_SHA1 encoded signature. (see Signature for details).
Request bodies should have content type application/json and be in valid JSON format.
3. Signature
The CC-SIGN header is generated as follows: hmac_sha1(”$CC-APP-ID:CC-TIMESPAN",”secret key”)
For example:
var crypto = require("crypto");const Encrypt = (str, method, key, result = "hex") => { var c = null; if (key) { c = crypto.createHmac(method, key); } else { c = crypto.createHash(method); } c.update(str); return c.digest(result);};const appKey = "asd";const appSecret = "qwe";const timespan = Date.now(); // timespan = 1672106570565const sign = Encrypt(`${appKey}:${timespan}`, "sha1", appSecret);const headers = { "cc-app-id": appKey, "cc-timespan": timespan, "cc-sign": sign, "content-type": "application/json",};Create Request
1. HTTPS
For the security of your account, all request must use https protocol.
2. Limit
To be fair, you can make 100,000 API requests per day and allow a maximum of 500 simultaneous orders that are receiving.
if you need more, please contact us [email protected].
Payment
Create order
You must create the order before you can operate other APIs.
Request
Method: POST
Path: /order/create
Params:
| params | meaning |
|---|---|
| payment_id | Custom order ID (length 8-32 digits, only numbers, upper and lower case letters, underscores allowed) |
| price | Custom payment amount (Minimum 10) |
Request example:
POST /order/createbody{ "payment_id":"EX100100100", "price": 100, "expired": 12}Response
HTTP status code: 200
Params:
| params | meaning |
|---|---|
| payment_id | Order id |
| address | Receipt address |
| amount | Amount received |
| create_time | Order Creation Timestamp |
| expired_time | Order expiration timestamp |
| expired | Order expiration time (h) |
| network | Transfer network |
| coin | Cryptocurrency |
| state | The state of the order. 0: receiving money; 1: settlement; 2: completed; |
Response example:
{ "payment_id": "EX100100100", "address": "coincoinresponseexample", "amount": 100, "create_time": 1609434000000, "expired_time": 1609520400000, "expired": 8, "network": "tron", "coin": "usdt", "state": 0}You can send the returned 'address' to your customers for collection and we will notify you of the webhook address you created when the collection is complete.
When the amount received is less than 'amount', the order will be in the 'under-collected' status, and when the amount received is greater than or equal to 'amount', the order will be completed.
Orders are valid for 48 hours max.
Developer Webhook
Request
Method: POST
Path: Developer created callback address(webhook)
Params:
| params | meaning |
|---|---|
| payment | order Details |
| payment.address | The address created when creating the order |
| payment.amount | The actual amount paid by the user |
| payment.payment_id | Merchant Order Number |
| collected | Amount of cryptocurrency received |
| state | Order Status |
Request example:
{ "payment": { // 订单内容 "address": "coincoinresponseexample", "payment_id": "merchant's order ID", "network": "tron", // tron ethereum "coin": "usdt", // usdt eth trx btc bnb "amount": 100.0 // 加密货币收款数量 }, "collected": { // 已收到加密货币数量,基础逻辑为只看目标收款数量,只要不满足订单都将继续 "usdt": 50 }, "state": 1}Response
HTTP status code: Must respond to 200 status code
When your customer makes multiple payments to an address, we will notify you multiple times until the order is complete or the order times out (48 hours max).
