API Documentation - Transactions

Create Transaction

This API allows you to create a new transaction. The required inputs are:

cURL Request Example

curl -X POST https://api.example.com/transaction \
-H "Authorization: Bearer {user_token}" \
-H "Content-Type: application/json" \
-d '{
    "email": "[email protected]",
    "amount": 100,
    "payment_network": "TON",
    "callback_url": "https://example.com/callback"
}'

Server Response

On success, the server will return a response with the following details:

JSON Response Example

{
    "wallet_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
    "payment_deadline": 1800,
    "amount": 100,
    "network": "TON",
    "value_usd": 0.0025,
    "value_eur": 0.0022
}

List Active Transactions

This API returns a list of active transactions based on optional filters like gateway ID, product ID, and status. Required inputs:

cURL Request Example

curl -X GET https://api.example.com/transactions/active \
-H "Authorization: Bearer {user_token}" \
-H "Content-Type: application/json" \
-d '{
    "gateway_id": "gateway123",  // Optional
    "product_id": "product456",  // Optional
    "status": "active"  // Optional
}'

Server Response

The response will include a list of active transactions with the following details:

JSON Response Example

[
    {
        "transaction_id": "txn789",
        "amount": 100,
        "timestamp": "2024-08-12T14:30:00Z"
    },
    {
        "transaction_id": "txn101",
        "amount": 250,
        "timestamp": "2024-08-12T15:00:00Z"
    }
]

Transaction Details

This API returns detailed information about a transaction based on the transaction ID and user token. Required inputs:

cURL Request Example

curl -X GET https://api.example.com/transaction/details \
-H "Authorization: Bearer {user_token}" \
-H "Content-Type: application/json" \
-d '{
    "transaction_id": "txn789"
}'

Server Response

The response will include the following details:

JSON Response Example

{
    "status": "active",
    "timestamp": "2024-08-12T14:30:00Z",
    "amount": 100,
    "wallet_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
    "email": "[email protected]"
}

Create Gateway

This API allows you to create a new gateway ID. The required inputs are:

cURL Request Example

curl -X POST https://api.example.com/gateway/create \
-H "Authorization: Bearer {user_token}" \
-H "Content-Type: application/json" \
-d '{
    "payment_network": "TON",
    "currency": "Vestcoin",
    "activation_date": "2024-09-01T00:00:00Z",  // Optional
    "deactivation_date": "2024-09-15T00:00:00Z"  // Optional
}'

Server Response

On success, the server will return a response with the following details:

JSON Response Example

{
    "gateway_id": "gateway789",
    "wallets_created": 40,
    "transaction_identifier": "txn-gw-12345",
    "wallet_key": "walletkey123",
    "creation_time": "2024-08-12T14:30:00Z"
}

Gateway Balance

This API returns the balance of wallets associated with a specific gateway. Required inputs:

cURL Request Example

curl -X GET https://api.example.com/gateway/balance \
-H "Authorization: Bearer {user_token}" \
-H "Content-Type: application/json" \
-d '{
    "wallet_key": "walletkey123"
}'

Server Response

The response will include a list of balances for the wallets associated with the gateway:

JSON Response Example

[
    {
        "wallet_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
        "balance": 500
    },
    {
        "wallet_address": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy",
        "balance": 300
    }
]

Gateway Settlement

This API is used for settling a gateway. Required inputs:

cURL Request Example

curl -X POST https://api.example.com/gateway/settlement \
-H "Authorization: Bearer {user_token}" \
-H "Content-Type: application/json" \
-d '{
    "wallet_key": "walletkey123",
    "gateway_id": "gateway789",
    "destination_wallet": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy",
    "transaction_tag": "settle123"  // Optional
}'

Server Response

The response will include details of the settlement transaction:

JSON Response Example

{
    "amount_transferred": 100,
    "source_wallet": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
    "destination_wallet": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy",
    "transaction_time": "2024-08-12T15:00:00Z",
    "status": "successful"
}

Settlement History

This API returns a list of settlements for a specific gateway. Required inputs:

cURL Request Example

curl -X GET https://api.example.com/gateway/settlement-history \
-H "Authorization: Bearer {user_token}" \
-H "Content-Type: application/json" \
-d '{
    "gateway_id": "gateway789"
}'

Server Response

The response will include a list of settlements made for the gateway:

JSON Response Example

[
    {
        "amount": 100,
        "time": "15:00",
        "date": "2024-08-12",
        "fee": 1,
        "currency": "Vestcoin",
        "payment_network": "TON",
        "source_wallet": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
        "destination_wallet": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy"
    },
    {
        "amount": 200,
        "time": "16:00",
        "date": "2024-08-13",
        "fee": 2,
        "currency": "Vestcoin",
        "payment_network": "TRON",
        "source_wallet": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
        "destination_wallet": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy"
    }
]

Error Codes

Below is a list of error codes and descriptions that you might encounter while using the API:

Error Code Description
500 Token not found
501 Token is inactive
502 Gateway is inactive
503 Gateway ID is incorrect
504 Invalid entry
505 Destination wallet is invalid
506 Source wallet balance is insufficient
507 Source wallet balance is less than the transfer fee
508 Transaction key is incorrect
509 Transactions not found
600 Server error
601 ID not found
602 Unauthorized access
603 Unstable transaction
604 Transaction amount is less than the minimum allowed