Skip to main content

Accounts

The Accounts API allows you to manage user accounts, including retrieving account information, checking balances, performing currency conversions, and managing Tropicard integrations.

The Account Object

{
"id": 21221,
"accountNumber": "TP00-0000-0000-0000-0000",
"userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"alias": "My Account",
"balance": 418090,
"pendingIn": 1422276,
"pendingOut": 0,
"state": 1,
"paymentEntityId": 34,
"currency": "USDC",
"type": 1,
"createdAt": "2025-07-14T19:10:04.936Z",
"updatedAt": "2025-07-22T13:16:59.737Z",
"isDefault": false,
"groupId": null,
"TropiCards": [],
"services": [
{
"slug": "CRYPTO_TOPUP",
"enabled": true
}
],
"paymentMethods": [
{
"slug": "TPP",
"name": "Tropipay",
"enabled": true
}
]
}

Attributes

AttributeTypeDescription
idintegerUnique identifier for the account.
accountNumberstringThe unique account number.
userIdstringThe ID of the user who owns the account.
aliasstringA user-defined name for the account.
balanceintegerThe current balance of the account in cents.
pendingInintegerThe amount of incoming funds that are pending confirmation, in cents.
pendingOutintegerThe amount of outgoing funds that are pending confirmation, in cents.
stateintegerThe state of the account (e.g., 1 for active).
currencystringThe currency code for the account (e.g., USDC, EUR).
typeintegerThe type of account (e.g., 1 for a standard account).
createdAtstringThe date and time when the account was created, in ISO 8601 format.
updatedAtstringThe date and time when the account was last updated, in ISO 8601 format.
isDefaultbooleanIndicates if this is the user's default account.
servicesarrayA list of financial services enabled for this account.
paymentMethodsarrayA list of payment methods available for this account.

List All Accounts

Returns a list of all accounts associated with the authenticated user.

GET/accounts/
curl -X GET https://sandbox.tropipay.me/api/v3/accounts/ \
-H "Authorization: Bearer sk_test_..."

Parameters

ParameterTypeRequiredDescription
typestringNoFilter by account type

Response

[
{
"id": 21221,
"accountNumber": "TP00-0000-0000-0000-0000",
"userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"alias": "My Account",
"balance": 418090,
"pendingIn": 1422276,
"pendingOut": 0,
"state": 1,
"paymentEntityId": 34,
"currency": "USDC",
"type": 1,
"createdAt": "2025-07-14T19:10:04.936Z",
"updatedAt": "2025-07-22T13:16:59.737Z",
"isDefault": false,
"groupId": null,
"TropiCards": [],
"services": [
{
"slug": "CRYPTO_TOPUP",
"enabled": true
}
],
"paymentMethods": [
{
"slug": "TPP",
"name": "Tropipay",
"enabled": true
}
]
}
]

Retrieve Account Balance

Retrieves the balance for a specific account.

GET/accounts/balance/{accountNumber}
curl -X GET https://sandbox.tropipay.me/api/v3/accounts/balance/TP1234567890123456789012 \
-H "Authorization: Bearer sk_test_..."

Response

{
"accountNumber": "TP00-0000-0000-0000-0000",
"balance": 418090,
"pendingIn": 1422276,
"pendingOut": 0,
"currency": "USDC"
}

Response Parameters

ParameterTypeDescription
accountNumberstringThe unique account number.
balanceintegerThe current balance of the account in cents.
pendingInintegerThe amount of incoming funds that are pending confirmation, in cents.
pendingOutintegerThe amount of outgoing funds that are pending confirmation, in cents.
currencystringThe currency code for the account (e.g., USDC).

Retrieve All Account Balances

Retrieves the balance information for all user accounts.

GET/accounts/allBalance
curl -X GET https://sandbox.tropipay.me/api/v3/accounts/allBalance \
-H "Authorization: Bearer sk_test_..."

Response

[
{
"balance": 418090,
"currency": "USDC"
},
{
"balance": 163202,
"currency": "EUR"
}
]

Response Parameters

The response is an array of account objects, each with the following attributes:

ParameterTypeDescription
balanceintegerThe total balance of the account in cents.
currencystringThe currency code for the account (e.g., USDC, EUR).

Set Default Account

Sets a specific account as the default account for the user.

PUT/accounts/default
curl -X PUT https://sandbox.tropipay.me/api/v3/accounts/default \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"accountId": 21221
}'

Parameters

ParameterTypeRequiredDescription
accountIdstringYesID of the account to set as default

Response

{
"success": true
}

Add Tropicard Account

Links a Tropicard to the user's account.

POST/accounts/
curl -X POST https://sandbox.tropipay.me/api/v3/accounts/ \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"tropicardNumber": "1234567890123456",
"pin": "1234"
}'

Parameters

ParameterTypeRequiredDescription
tropicardNumberstringYes16-digit Tropicard number
pinstringYes4-digit PIN code

Simulate Currency Conversion

Simulates a currency conversion between two accounts to preview rates and fees.

POST/accounts/{sourceAccountId}/convert/{targetAccountId}/simulate
curl -X POST https://sandbox.tropipay.me/api/v3/accounts/acc_123/convert/acc_124/simulate \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"amountToPay": 10000
}'

Parameters

ParameterTypeRequiredDescription
amountToPayintegerYesAmount to convert in cents

Response

{
"amountToPay": 10000,
"amountToGet": 8500,
"rate": 0.85,
"fee": 250,
"sourceCurrency": "USD",
"targetCurrency": "EUR"
}

Response Parameters

ParameterTypeDescription
amountToPayintegerAmount to be debited in cents
amountToGetintegerAmount to be credited in cents
ratenumberExchange rate applied
feeintegerConversion fee in cents
sourceCurrencystringSource account currency
targetCurrencystringTarget account currency

Execute Currency Conversion

Executes a currency conversion between two accounts.

POST/accounts/{sourceAccountId}/convert/{targetAccountId}
curl -X POST https://sandbox.tropipay.me/api/v3/accounts/acc_123/convert/acc_124 \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"amountToPay": 10000
}'

Parameters

ParameterTypeRequiredDescription
amountToPayintegerYesAmount to convert in cents

Get Crypto Address for Self-Charge

Retrieves a cryptocurrency address for depositing funds into an account.

GET/accounts/{accountId}/selfcharge/crypto
curl -X GET https://sandbox.tropipay.me/api/v3/accounts/21221/selfcharge/crypto \
-H "Authorization: Bearer sk_test_..."

Response

{
"feePercent": 300,
"feeFixed": 0,
"accounts": [
{
"address": "Bvmv25du1Um2gvMFAd3EQjUCano9a7tPXDp9KnxWRqjc",
"network": "SOLANA",
"currency": "USDC"
}
]
}

Response Parameters

ParameterTypeDescription
feePercentintegerThe deposit fee as a percentage (e.g., 300 for 3.00%).
feeFixedintegerA fixed deposit fee in cents.
accountsarrayAn array of available deposit addresses.

Account Object in accounts array

ParameterTypeDescription
addressstringThe cryptocurrency wallet address for the deposit.
networkstringThe blockchain network (e.g., SOLANA).
currencystringThe cryptocurrency code (e.g., USDC).

Error Handling

The Accounts API uses conventional HTTP response codes to indicate the success or failure of an API request.

Common Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid authentication
403Forbidden - Insufficient permissions
404Not Found - Account doesn't exist
409Conflict - Account already exists or invalid state
422Unprocessable Entity - Invalid account data
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Example Error Response

{
"error": {
"type": "invalid_request_error",
"code": "account_not_found",
"message": "No such account: acc_invalid",
"param": "accountId"
}
}