How to calculate service fee for operation
General information
In order to calculate service fee for operations, Calypso Pay provides Tarifficator API.
API includes the following endpoints:
- Get available operation codes
- Get all tariff configurations
- Get tariff configuration for the operation
- Get service fee for the operation
Get all operation codes
Each operation in Calypso Pay is represented by a particular operation code such as CREATION_UNLIMITED_INVOICE or SINGLE_WITHDRAWAL. You can obtain all available operation codes by requesting the endpoint Get available operation codes.
In the response you receive all available operation codes.
Here is the description of all operation codes.
Operation code | Description |
---|---|
SINGLE_WITHDRAWAL | Single payout execution |
MASS_WITHDRAWAL | Mass payout execution. This operation code indicates a separate withdrawal inside mass payout. |
CREATION_SINGLE_INVOICE | Creation of the invoice with type "SINGLE" |
CREATION_SINGLE_FIAT_INVOICE | Creation of the invoice with type "SINGLE_FIAT" |
CREATION_UNLIMITED_INVOICE | Creation of the invoice with type "UNLIMITED" |
CREATION_UNLIMITED_LINKED_INVOICE | Creation of the invoice with type "UNLIMITED_LINKED" |
CREATION_BOUND_INVOICE | Creation of the invoice with type "BOUND" |
SINGLE_INVOICE | Deposit for the invoice with type "SINGLE" |
SINGLE_FIAT_INVOICE | Deposit for the invoice with type "SINGLE_FIAT" |
UNLIMITED_INVOICE | Deposit for the invoice with type "UNLIMITED" |
UNLIMITED_LINKED_INVOICE | Deposit for the invoice with type "UNLIMITED_LINKED" |
BOUND_INVOICE | Deposit for the invoice with type "BOUND" |
TOP_UP | Direct top-up of the account balance |
CRYPTO_TO_CRYPTO_WITHDRAWAL | Withdrawal of money for the crypto-to-crypto exchange |
CRYPTO_TO_CRYPTO_DEPOSIT | Deposit of money as a result of crypto-to-crypto exchange |
Get all set service fees
To obtain all set service fees, you can make the request Get all tariff configurations.
The response will include the following parameters:
opCode
- code of the operation, that corresponds to the operation for which the commission is charged.currency
- currency of the operation.percentageFee
- percent of operation amount that will be charged for as service fee.fixedAmount
- fixed amount of money that will be charger for the operation.minFixedFee
- minimal amount that will be charged for the operation if fee in percent lower that value of this parameter. Can be used only withpercentageFee
.
Example of the response:
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"opCode": "SINGLE_WITHDRAWAL",
"currency": "USDT",
"percentageFee": 0,
"fixedFee": 10,
"minFixedFee": 0
},
{
"id": "0bab0a0a-54e9-4b2a-b3de-bed95f320d84",
"opCode": "SINGLE_INVOICE",
"currency": "ETH",
"percentageFee": 0.1,
"fixedFee": 0,
"minFixedFee": 0.001
}
]
To get service fee for particular operation find the element in the response with needed opCode
and currency
and take amount from fixedAmount
, percentageFee
or minFixedFee
.
Get service fee for particular operation
You can get the set service fee for particular operation by request Get tariff configuration for the operation.
In the request you need to provide:
opCode
- code of the operation, that corresponds to the operation for which the commission is charged.currency
- currency of the operation.
In the response you will receive the following parameters:
opCode
- code of the operation, that corresponds to the operation for which the commission is charged.currency
- currency of the operation.percentageFee
- percent of operation amount that will be charged for as service fee.fixedAmount
- fixed amount of money that will be charger for the operation.minFixedFee
- minimal amount that will be charged for the operation if fee in percent lower that value of this parameter. Can be used only withpercentageFee
.
Example of the response:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"opCode": "SINGLE_WITHDRAWAL",
"currency": "USDT",
"percentageFee": 0,
"fixedFee": 10,
"minFixedFee": 0
}
Use this endpoint if you don't know the amount of the operation.
Calculate service fee by operation amount
You can calculate the service fee providing operation code, amount of the operation and currency by request Get service fee for the operation.
Calypso Pay will check the set tariff for the operation and will calculate the amount of service fee using the amount of the operation. In response the final amount of service fee will be returned:
serviceFee
- amount of service fee for the operation.
serviceFeeCurrency
- currency of service fee for the operation.
Use this endpoint if you know the amount of the operation.
Example of service fee calculation for Unlimited Invoice
Usually in Calypso Pay service fee for invoices consists of two parts:
- Fixed fee amount for invoice creation.
- Percentage of the deposit amount.
Let's assume that you want to calculate service fee for an unlimited invoice in USDT (ERC-20). First step is to get service fee for invoice creation. As Unlimited Invoice doesn't have amount, fixed fee for creation always will be used. So, you can use endpoint Get tariff configuration for the operation. As operation code you have to use CREATION_UNLIMITED_INVOICE.
Request:
{
"timestamp": 1,
"payload": {
"opCode": "CREATION_UNLIMITED_INVOICE",
"currency": "USDT"
}
}
In the response you receive:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"opCode": "CREATION_UNLIMITED_INVOICE",
"currency": "USDT",
"percentageFee": 0,
"fixedFee": 5,
"minFixedFee": 0
}
As you can see the field fixedFee
is 5. So, the fixed fee amount for invoice creation is 5 USDT. This amount will be charged from account balance in the moment of invoice creation.
Second step is to calculate fee for each deposit to Unlimited Invoice.
If the amount of deposit is unknown you can use the same endpoint Get tariff configuration for the operation with the operation code UNLIMITED_INVOICE.
Request:
{
"timestamp": 1,
"payload": {
"opCode": "UNLIMITED_INVOICE",
"currency": "USDT"
}
}
In the response you receive:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"opCode": "UNLIMITED_INVOICE",
"currency": "USDT",
"percentageFee": 0.1,
"fixedFee": 0,
"minFixedFee": 0
}
As you can see percentageFee
is 0.1. That means that for each deposit for this invoice 0.1% of the deposit amount will be charged as the service fee. For example, deposit with the amount of 1000 USDT was received. The service fee will be 1 USDT and 999 USDT will be settle to account balance.
If the amount of deposit is defined it is possible to calculate the exact amount of service fee in advance. Use the endpoint Get service fee for the operation.
Request:
{
"timestamp": 1,
"payload": {
"opCode": "UNLIMITED_INVOICE",
"currency": "USDT",
"amount": 1000
}
}
In the response you receive:
{
"serviceFee": 1,
"serviceFeeCurrency": "USDT"
}
So, you received the same amount of service we as earlier you calculated using percentage.
Example of service fee calculation for Mass Payout
In Calypso Pay service fee for mass payout is charged for each withdrawal. So, you must get sum of all withdrawal amounts and then calculate the fee based on calculated amount.
Let's assume that you have a mass payout with 3 withdrawals in USDT. Their amounts are 200, 150 and 1000 USDT.
The first step is to find sum of amounts: 200 + 150 + 1000 = 1350 USDT.
The second step is to calculate service fee by this amount. Use the endpoint Get service fee for the operation with the operation code MASS_WITHDRAWAL.
Request:
{
"timestamp": 1,
"payload": {
"opCode": "MASS_WITHDRAWAL",
"currency": "USDT",
"amount": 1350
}
}
In the response you receive:
{
"serviceFee": 1.35,
"serviceFeeCurrency": "USDT"
}
In the field serviceFee
you received 1.35 USDT. This amount will be charged in addition to the payment amount. So, to proceed this payout you need to pay 1351.35 USDT.
Updated 8 months ago