How to create a single payout via API
Last updated
Last updated
Before starting an integration please check our General API integration rules page for more info.
Before creating payouts you will probably want to check whether you have enough funds on your wallets or not. To do this please check our Get balance information via API page for more info.
Single Payout is a single payment of a reward, dividend, insurance compensation, etc. (i.e. you may need to pay dividends to partners).
To send single payment with fixed amount in cryptocurrency you can use single payout functionality. To make a payment you just need to know receiver address and specify amount and currency of payment.
You can find more information about other features of Public API integration in our documentation:
To create a new single payout use the following endpoint: New Payout (POST https://api.calypso.finance/api/v1/payout/create
)
You can find the detailed description of all the parameters in the documentation:
Here we consider the most important ones.
depositAddress
- address of the receiver of payment. Pay attention to specify address in the correct blockchain network.
amount
- amount of the payment.
currency
- the crypto currency of payment. Calypso supports the following currencies:
Bitcoin blockchain: BTC
Ethereum blockchain: ETH, USDT, FRAX, BUSD_ETH, USDC, DAI
Tron blockchain: TRX, USDT_TRX
Binance Smart Chain blockchain: BNB, BUSD
Polygon blockchain: MATIC, USDT_MATIC
Doge blockchain: XDG
comment
- some information about payment.
idempotencyKey
- a specific UUID for the payout which guarantees uniqueness of the request. It’s possible to check the status of the payout by this parameter after creation.
So to create payout without additional options you just have to send request:
Bash
Some additional options:
You can set time of the payout processing by transmitting executionDate
field in request body. The payout will be sent on specified date and time.
If the creation was successful you receive the response:
Response exampleJSON
After that you can track state changes until payout will be completed.
After creating payout you can receive information about it from the system. There are two options to track changes in payout state:
Get payout data via request by ID.
Set webhooks for payouts.
To receive information about earlier created payout you can use Get Specific Payout endpoint (POST https://api.calypso.finance/api/v1/payout
).
You can request payout by id
or idempotencyKey
.
Example of the request by id
:
JSON
In response you will receive payout data:
Response exampleJSON
The most important fields you need to pay attention to:
calypsoFee
- service fee you paid for payout.
To track state of your created Payout you can use Calypso Payment functionality which is called Webhooks.
Webhook is a way for an app to provide other applications with real-time information. The Webhooks API allows you to subscribe to events happening with your created objects (Invoices or Payouts) in Calypso. Rather than making an API call to check status of invoice or payout during processing, Calypso can send an HTTP request to an endpoint you configure.
First of all, to receive information about Payout state change you need to create a subscription for system events which you want to track.
There are several types of events which you need to track in order to understand what is happening to your Invoices.
The main events are:
PAYOUT_CHANGE_STATUS
Payout has changed state to In Progress, Canceled, Failed or Completed
PAYOUT_VALIDATION_ERROR
Validation error has been occurred during payout processing
We’ll look at more scenarios of using Webhooks in following sections.
To create a subscription for those events you can use the Create Webhook Public API endpoint: POST https://api.calypso.finance/api/v1/subscription/webhook/create
Bash
You can subscribe to all types of events if you specify value “PAYOUT” in the notificationServiceTypes
field instead of enumeration all types of events in notificationEventTypes
.
In the response you will get:
JSON
After successful creation of subscription for payout state changes you should wait while the payout is processing.
If payout was successfully processed you will receive webhook with type PAYOUT_CHANGE_STATUS where the field payoutStatus
will be COMPLETED.
The example of webhook payload:JSON
To get detailed information about payout you can use Get Specific Payout endpoint (POST https://api.calypso.finance/api/v1/payout
) using idempotencyKey
or parentExternalId
(id
in request).
The value of the field state
will be changed to COMPLETED.
If payout was finished due to the error you will receive webhook with type PAYOUT_CHANGE_STATUS where the field payoutStatus
will be FAILED.
The example of webhook payload:JSON
To get detailed information about payout you can use Get Specific Payout endpoint (POST https://api.calypso.finance/api/v1/pub/payout
) using idempotencyKey
or parentExternalId
(id
in request).
The value of the field state
will be changed to FAILED.
This state means that the error occurred on the side of Calypso system. You should resend this payout or ask our technical support about the problem.
More info on Get Specific Payout endpoint:
state
- represents status of the payout. More info about possible states in documentation:
More detailed information about Calypso Webhooks functionality:
More info on Calypso Webhooks event types:
More info on Webhooks management in Calypso Pay system: