Introduction
This section describes how to use the API to create, consult, list transactions, check balances, and set up the webhook.
TCC is RESTFul . This means we use predictable, resource-oriented URLs to do operations. The API itself speaks exclusively in JSON, including errors.
Flow
1 TCC = 1 VCU
First, create a transaction. It will have the status 1 (Created) and the specified amount of TCC will be sent from the eFX wallet to the Merchant's wallet. The status will then change to 2 (Processed), and a Txid (transaction receipt) will be generated. You can consult the transaction using the reference or ID. If a webhook is set up, it will be triggered.
When the eFX's balance is nearing depletion, Merchant will sent back to the eFX wallet, and the process will restart.
All transactions can be verified on the block explorer at the following link: https://algoexplorer.io/asset/000000000. You can find the details of each transaction at: https://algoexplorer.io/tx/{TXID}.
Transactions Status
This section describes the status available
Status Name | Status Code | Description |
---|---|---|
Created | 1 | Transaction initiated |
Processed | 2 | Transaction done |
Error | -1 | Error, will be retried |
Get The Api Key
This section describes how you can get your api key.
To get your Api Key, please contact the project support
Create Transaction
This section describes the process of create the transaction.
To create the transaction follow the example code and be careful with the perameters. You will need to make request with these following API end points.
End Point: https://apitrustcarboncredit.com/transaction
Request Method: POST
Request to the end point with the following parameters below.
Param Name | Param Type | Description |
---|---|---|
api-key (Header) | string | Required Your API key |
ref | string (55) | Required You Internal identifier |
amount | double | Required Transaction amount. |
curl
-H 'Content-type: application/json'
-H 'api-key: {{API-KEY}}'
-d '
{
"ref": "ref_9",
"amount": "10",
}
'
-X POST https://apitrustcarboncredit.com/transaction
//Error Response.
{
"code": "401",
"message": {
"status": "error",
"description": "Unauthorized",
},
}
//Success Response.
{
"code": 201,
"message": {
"status": "ok",
"description": "Created"
},
"response": {
"status": "Created",
"id": "17ba0791499db908433b80f37c5fbc89b870084b",
"ref": "ref_101",
"data": {
"id_wallet_from": "2",
"id_wallet_to": "1",
"id_user": "1",
"status": 1,
"txid": "",
"ref": "ref_101",
"amount": "10",
"date": "2023-07-10",
"time": "23:13:38"
}
}
}
Consult Transaction
This section describes the process of consult the transaction.
To consult the transaction follow the example code and be careful with the perameters. You will need to make request with these following API end points.
Production End Point: https://apitrustcarboncredit.com/transaction/{id}
Request Method: GET
Request to the end point with the following parameters below.
Param Name | Param Type | Description |
---|---|---|
api-key (Header) | string | Required Your API key |
curl https://apitrustcarboncredit.com/transaction/77de68daecd823babbb58edb1c8e14d7106e83bb
-H 'api-key: {{API-KEY}}'
//Error Response.
{
"code": 500,
"message": {
"status": "error",
"description": "Internal Server Error."
},
"response": {
"status": "Error",
"msg": [
"This Ref already exists."
]
}
}
//Success Response.
{
"code": 201,
"message": {
"status": "ok",
"description": "Created"
},
"response": {
"status": "Created",
"id": "17ba0791499db908433b80f37c5fbc89b870084b",
"ref": "ref_101",
"data": {
"id_wallet_from": "2",
"id_wallet_to": "1",
"id_user": "1",
"status": 1,
"to_type": "Merchant or eFX",
"txid": "",
"ref": "ref_101",
"amount": "10",
"date": "2023-07-10",
"time": "23:13:38"
}
}
}
List Transactions
This section describes the process of list the transactions.
To list the transactions follow the example code and be careful with the perameters. You will need to make request with these following API end points.
Production End Point: https://apitrustcarboncredit.com/transactions
Request Method: GET
Request to the end point with the following parameters below.
Param Name | Param Type | Description |
---|---|---|
api-key (Header) | string | Required Your API key |
id | string | Transaction ID |
status | string | Transaction Status |
to_type | string | Merchant or eFX |
ref | string | You Internal identifier |
pointer | integer | Pointer |
curl https://apitrustcarboncredit.com/transactions/?id=&ref=&status=&pointer=
-H 'api-key: {{API-KEY}}'
//Error Response.
{
"code": "401",
"message": {
"status": "error",
"description": "Unauthorized",
},
}
//Success Response.
{
"code": 200,
"message": {
"status": "ok",
"description": "Successful request"
},
"response": {
"total": "11",
"transactions": [
{
"id": "17ba0791499db908433b80f37c5fbc89b870084b",
"ref": "ref_101",
"txid": "",
"status": "1",
"to_type": "Merchant or eFX",
"amount": "10",
"date": "2023-07-10 23:13:38"
},
{
"id": "b1d5781111d84f7b3fe45a0852e59758cd7a87e5",
"ref": "ref_10",
"txid": "",
"status": "1",
"to_type": "Merchant or eFX",
"amount": "10",
"date": "2023-07-10 23:11:01"
},
{
"id": "0ade7c2cf97f75d009975f4d720d1fa6c19f4897",
"ref": "ref_9",
"txid": "AOWT6GYN2B6OU2E7WOZWMJCWFQUEFKAUAWRMWBBRJT6ONPNQUBSA",
"status": "2",
"to_type": "Merchant or eFX",
"amount": "1.9",
"date": "2023-07-09 18:13:12"
}
]
}
}
Consult Balances
This section describes the process of consult the balances.
To consult the balances follow the example code and be careful with the perameters. You will need to make request with these following API end points.
Production End Point: https://apitrustcarboncredit.com/balances
Request Method: GET
Request to the end point with the following parameters below.
Param Name | Param Type | Description |
---|---|---|
api-key (Header) | string | Required Your API key |
curl https://apitrustcarboncredit.com/balances
-H 'api-key: {{API-KEY}}'
//Error Response.
{
"code": "401",
"message": {
"status": "error",
"description": "Unauthorized",
},
}
//Success Response.
{
"code": 200,
"message": {
"status": "ok",
"description": "Successful request"
},
"response": [
{
"type": "Merchant",
"address": "ABKW46UIKDH43EJCUEG7U32RZDCXWHVXHJLHLEGPJ3AMN5D7QP6YZAXH7Q",
"balance": "61800000",
"max_balance": "900000000000"
},
{
"type": "eFX",
"address": "YQ7HUWBRGOTRPFUTEDZYYS3KA6K74WXCCRCEJHH2DZ6FKTWZZZ2LLPKGZM",
"balance": "999938200000",
"max_balance": null
}
]
}
Configure Webhook
This section describes the process to configure the webhook. Use Basic Authorization HTTP to receive data and ensure security.
To configure the webhook to receive the status update and txid (Transactions IDs) follow the example code and be careful with the perameters. You will need to make request with these following API end points.
End Point: https://apitrustcarboncredit.com/webhook
Request Method: PUT
Request to the end point with the following parameters below.
Param Name | Param Type | Description |
---|---|---|
api-key (Header) | string | Required Your API key |
url | string (255) | Required Your URL |
user | string (100) | Required Username |
pass | string (100) | Required Password |
curl
-H 'Content-type: application/json'
-H 'api-key: {{API-KEY}}'
-d '
{
"url": "https://yourserver.com/webhook",
"user": "bet",
"pass": "nakamoto",
}
'
-X POST https://apitrustcarboncredit.com/transaction
//Error Response.
{
"code": "401",
"message": {
"status": "error",
"description": "Unauthorized",
},
}
//Success Response.
{
"code": 202,
"message": {
"status": "ok",
"description": "Accepted"
}
}
//Sent Result: Transaction from eFX to Merchant
{
"action":"eFX_to_Merchant",
"user":"eFX Name",
"id":"1e6a55b214563e652a23de9d6232a5055c356940",
"ref":"ref_108",
"status":"2",
"amount":"8",
"txid":"PQ4SMVH2M7BRQDVLEWMDLBC4L4W7QI3BIMGFWZCNXQABBX6S5PJQ",
"date":"2023-07-12 00:24:01"
}
//Sent Result: Transaction from Merchant to eFX
{
"action":"Merchant_to_eFX",
"user":"eFX Name",
"id":"1e6a55b214563e652a23de9d6232a5055c356940",
"ref":"ae6a45b21161e612a21e2d6232a5055c35694a",
"status":"2",
"amount":"8",
"txid":"AA3SMVH2M7B5QDVLM5LBC4L4W7QI3BIMGAADWZCNXQABBX6S5PJQ",
"date":"2023-07-12 00:24:01"
}