First of all to use Calypso Public API you’ll need to contact Technical Support to generate a new pair of API keys (public and secret keys):
API keys are used for authorization in requests to the Calypso API. After receiving API keys from our Technical Support team you can start sending requests to Calypso Public API.
All requests must contain the following headers:
Sign
The HEX-encoded signature (see below).
Content-Type
All request bodies should have content type application/json and be valid JSON.
Sign — POST data (in the same format in which you want to send) encrypted with the method HMAC-SHA512 using secret key and the result object is converted to a HEX string.
The body is the request body string (in all cases this is JSON stringified request params object).
All the requests should also include the obligatory POST parameter timestamp
with current unix UTC timestamp in milliseconds. The value must not be less than 3 minutes in the past and not greater than 3 minutes in the future.
To create the sign:
Build the body of the request with correct timestamp
Encrypt the request body with method HMAC-SHA512 using the body as a message and the secret key as a key.
Convert bytes to string of hexadecimal digits.
Examples of sign building:
Javascript
JSX
Python
Python
Example of api keys, body and correct sign for request:
Python
Examples of timestamp building:
Javascript
JavaScript
Python
Python
To create a new customer use the following endpoint: customer (**POST** https://api.calypso.finance/api/v1/customer-purse/customer/create
)
You can find the detailed description of all the parameters in the documentation:
Create a customer
Here we consider the most important ones.
To create a new user, you need to pass this parameter in the request:
account (required) - your product/service account id.
timestamp (required) - Current unix UTC timestamp in milliseconds. Must not be less than 3 minutes in the past and not greater than 3 minutes in the future
payload (required) - Request data for creating a new Customer
description
So to create new customer you just have to send request:
curl
If the creation was successful you receive the response:
curl
To update a customer use the following endpoint: customer (**POST** https://api.calypso.finance/api/v1/customer-purse/customer/update
)
You can find the detailed description of all the parameters in the documentation:
Here we consider the most important ones.
To create a new user, you need to pass this parameter in the request:
account (required) - your product/service account id.
timestamp (required) - Current unix UTC timestamp in milliseconds. Must not be less than 3 minutes in the past and not greater than 3 minutes in the future
payload (required) - Request data for creating a new Customer
id (required) - Customer ID
description
So to update customer you just have to send request:
curl
If the update was successful you receive the response:
curl
To get an address for deposits use the following endpoint: customer (POST https://api.calypso.finance/api/v1/customer-purse/address/get
)
You can find the detailed description of all the parameters in the documentation:
Here we consider the most important ones.
To get an address for deposits in a specific currency, you need to pass this parameter in the request:
account (required) - your product/service account id.
timestamp (required) - Current unix UTC timestamp in milliseconds. Must not be less than 3 minutes in the past and not greater than 3 minutes in the future
payload (required) - Request data for get a deposit address
customerId (required)
currency (required)
So to get a depost address, you just have to send request:
JSON
If the address is successfully given, you receive the response:
JSON
If a deposit address has not received any deposits within 30 days of its receipt, it will expired.
And you will receive a webhook - CUSTOMER_PURSE_EXPIRED
When Calypso receives information from the blockchain about a new deposit from your customer, you will receive webhooks about the processes and statuses associated with this deposit:
The transaction pending in the mempool.
Transaction under compliance check.
The transaction failed compliance check.
Transaction received successfully.
After receiving the final successful deposit status, you need to send a request with the transaction ID and get the transaction data.
To get a transaction data from transactionID, use the following endpoint: customer (POST https://api.calypso.finance/api/v1/customer-purse/transaction/get
)
You can find the detailed description of all the parameters in the documentation:
Get Customer Purse Transaction
Here we consider the most important ones.
To get transaction data, you need to pass this parameter in the request:
account (required) - your product/service account id.
timestamp (required) - Current unix UTC timestamp in milliseconds. Must not be less than 3 minutes in the past and not greater than 3 minutes in the future
payload (required) - Request data for get a deposit address
transactionId (required)
So to get a transaction data, you just have to send request:
JSON
If the transaction successfully received, you receive the response:
JSON
Loading...
Before starting an integration please check our Get started with API page for more info.
To accept a single payment for a product with a fixed price when initial price specified in fiat currency you can use Single Fiat invoice type. Single Fiat Invoice is an instrument that allows you to receive a fixed amount of funds for your product.
The invoice is paid in cryptocurrency but the pay amount is being recalculated every 15 minutes according to fiat amount value that you used during invoice creation.
You can find more information about other features of Public API integration in our documentation.
To create a new Invoice use the following endpoint: New Single Fiat Invoice (POST https://api.calypso.finance/api/v1/invoice/single-fiat/create
)
You can find the detailed description of all the parameters in the documentation: New Single Fiat Invoice
Here we consider the most important ones.
amount
- the amount of money merchant want to receive for a product/service in crypto. Recalculates every 15 minutes from fiatAmount
value.
currency
(required) - the crypto currency of payment.
fiatAmount
(required) - the fiat amount of the invoice. The crypto amount is being calculated according to this value.
fiatCurrency
(required) - the fiat currency of the invoice.
description
(required) - the description of product/service.
idempotencyKey
- a specific UUID for the payment link which guarantees uniqueness of the request. It’s possible to check the status of the invoice by this parameter after creation.
So to create an invoice without additional options you just have to send request:
Bash
Some additional options:
You can set a specific custom ID to your Invoice by transmitting externalId
field in request body. It’s possible to check the status of the invoice by this parameter after creation. Here, for example, you can pass a unique client ID and then use this method Get Invoices by External ID get them all. As well, externalId
is returned in all types of events in webhooks, if it is set.
By default the invoice is available 3hours for TRON base currencies 1day for others . You can set custom expiration time of an invoice by transmitting expiration field in request body but the expiration date may only be less than 1 day from the current moment. After this time the invoice will be unavailable for payment.
You can customise interface of your invoice by transmitting return_url
, support_url
and logo_url
fields.
If the creation was successful you receive the response:
Response exampleJSON
To complete the payment the client must pay the amount of money from amount
field to the address specified in invoiceAddress
field.
Now after you’ve successfully created an Invoice you can send link for payment to your client. Link format: https://pay.calypso.finance/invoice/{idempotencyKey}
Invoice Payment link view
The invoice amount for payment will recalculate every time you open the Payment Link according to fiatAmount
that you set earlier.
Or you can build your own invoice interface using data from the response.
For example, you can use the following HTML template:
See in details: How to embed invoice data to your payment page
After creating Single Fiat Invoice you can receive information about it from the system. There are two options to track changes in invoice state:
Get invoice data via request by ID.
Set webhooks for invoices
To receive information about earlier created Invoice you can use Get a Specific Invoice endpoint (POST https://api.calypso.finance/api/v1/invoice
).
You can request invoice by id
, externalId
or idempotencyKey
.
More info on Get a Specific Invoice endpoint: Get a specific Invoice
Example of the request by id
:
Bash
In response you will receive invoice data:
Response exampleJSON
The most important fields you need to pay attention to:
state
- represents the status of the invoice. More info about possible states in documentation: Limited Invoice
totalDebitAmount
- received amount of money to this invoice.
To track the state of your created Invoice you can use Calypso Pay 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.
More detailed information about Calypso Webhooks functionality: Webhooks
First of all, to receive information about Invoice 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:
INVOICE_FUNDS_RECEIVED_FOR_INVOICE
The event shows if funds have been received to invoice wallet
INVOICE_PAID
Invoice successfully paid. All required amount has been received to invoice wallet.
INVOICE_PENDING_INTERVENTION
Invoice has changed state to INVOICE_PENDING_INTERVENTION. Either more or less funds was received to the invoice wallet than required
INVOICE_TRANSLATION_TO_ACCOUNT_COMPLETED
Funds have been received from invoice wallet to the merchant balance.
More info on Calypso Webhooks event types: Types of events
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 “INVOICE” in the notificationServiceTypes
field instead of enumeration all types of events in notificationEventTypes
.
In the response you will get:
JSON
More info on Webhooks management in Calypso Pay system: Webhook API
After successful creation of subscription for Payment events and providing your client with Payment Link you can wait for your client to make payment.
When money are received to invoice address you will receive webhook with type INVOICE_FUNDS_RECEIVED_FOR_INVOICE. It means that money delivered to invoice but it doesn't inform whether the right amount was received. You can compare amount from the webhook payload on your side or wait for the next webhook.
The example of webhook payload:
JSON
If client successfully paid the invoice (he sent the right amount of money) you will receive webhook with type INVOICE_PAID. Receiving this type of webhook guarantees that the invoice was fully paid.
The example of webhook payload:
To avoid errors related to receiving webhooks, it is necessary to request information about the invoice in Calypso Pay after receiving the webhook. To get detailed information about invoice you can use Get a Specific Invoice endpoint (POST https://api.calypso.finance/api/v1/invoice
using idempotencyKey
, externalId
or parentExternalId
(id
in request).
You will see changes in the fields:
The value of state
is PAID.
The value of totalDebitAmount
is changed to received payment amount.
The value of fee
shows the amount of service fee charged from the deposit amount of the invoice.
That means that the money were sent by client and they were received to invoice wallet address (invoiceAddress
field).
After receiving the correct amount of money to the invoice address in Calypso system the money will be automatically credited to the merchant balance.
When money successfully credited to the balance you will receive webhook with type INVOICE_TRANSLATION_TO_ACCOUNT_COMPLETED.
The example of webhook payload:
JSON
The most important fields in the event payload:
parentExternalId
- system ID of invoice.
externalId
- custom merchant ID, that could be set when the invoice was created.
amount
- amount of money paid for this invoice.
serviceFee
- service fee for the invoice deposit. This amount will be charged from the deposit amount.
In order to calculate exact amount of money credited to the merchant balance you should deduct serviceFee
from amount
.
You will see changes in the fields:
The value of state
is COMPLETED.
For advanced invoice usage scenarios and error handling please check our How to manage interventions via API? page.
Before starting an integration please check our Get started with API page for more info.
An invoice is a document given to the buyer by the seller to collect payment. It includes the cost of the products purchased or services rendered to the buyer as well as lists products/services.
Unlimited Invoice is an invoice without a fixed pay amount. Payments to the invoice of this type can be accepted in unlimited quantities for any amount for an unlimited time. Funds are transferred to the merchant account automatically. It can be archived by merchant or after 3 months automatically if no deposit is received during this period.
You can find more information about other features of Public API integration in our documentation.
Calypso charges a one-time commission for creating any unlimited invoice. Further, only a percentage will be charged from any deposits to the invoice.
Important: there are no minimum and maximum replenishment amounts.
To create a new Unlimited Invoice use the following endpoint: New Invoice (POST https://api.calypso.finance/api/v1/invoice/unlimited/create
)
You can find the detailed description of all the parameters in the documentation: New Unlimited Invoice
Here we consider the most important ones.
currency
(required) - the crypto currency of payment.
idempotencyKey
- a specific UUID for the payment link which guarantees uniqueness of the request. It’s possible to check the status of the invoice by this parameter after creation. As well, externalId
is returned in all types of events in webhooks.
description
(required) - the description of product/service.
So to create an invoice without additional options you just have to send request:
cURL
Some additional options:
You can set a specific custom ID to your Invoice by transmitting externalId
field in request body. It’s possible to check the status of the invoice by this parameter after creation. Here, for example, you can pass a unique client ID and then use this method Get Invoices by External ID get them all. As well, externalId
is returned in all types of events in webhooks, if it is set.
You can customise interface of your invoice by transmitting return_url
, support_url
and logo_url
fields.
In order to create a mapping between merchant's clients and invoices on the Calypso Pay side, you can use 2 ways:
1 - pass the client ID to the externalId
2 - on the merchant's side, create mapping between the client ID and idempotencyKey
on the Calypso Pay side (the most optimal way, since it will be possible to immediately request all extended information using idempotencyKey
).
If the creation was successful you would receive the response:
Response example
To complete the payment the client must pay any amount of money to the address specified in invoiceAddress
field. The client may create as many payments as he needs while invoice is not expired.
Now after you’ve successfully created Invoice you can send link for payment to your client. Link format: https://pay.calypso.finance/invoice/{idempotencyKey}
Invoice Payment link view
Or you can build your own invoice interface using data from the response.
After creating Invoice you can receive information about it from the system. There are two options to track changes in invoice state:
Get invoice data via request by ID.
Set webhooks for invoices
To receive information about earlier created Invoice you can use Get a Specific Invoice endpoint (POST https://api.calypso.finance/api/v1/invoice
)
You can request invoice by id
, externalId
or idempotencyKey
.
More info on Get a Specific Invoice endpoint: Get a specific Invoice
Example of the request by id
:
Bash
In response you will receive invoice data:
Response exampleJSON
The most important fields you need to pay attention to are:
state
- the status of invoice processing. There are 2 possible states for unlimited invoices: PENDING_PAYMENT и ARCHIVED. PENDING_PAYMENT - invoice is active, it can accept deposits. ARCHIVED - invoice is archived, deposits can not be accepted.
totalDebitAmount
- total received amount of money to this invoice.
Also you can get detailed information about deposit.
Get all deposits
To receive information about all deposits for invoice you can use Get all Deposits for the Invoice endpoint (POST https://api.calypso.finance/api/v1/invoice/deposit-history
)
You can request deposits by id
or idempotencyKey
.
Example of the request by id
:
cURL
In response you will receive deposit data:
JSON
Get specific deposit
If you want to get information about specific or last deposit you can use Get Deposit for the Invoice endpoint (POST https://api.calypso.finance/api/v1/invoice/deposit
)
In the payload of the event INVOICE_FUNDS_RECEIVED_FOR_INVOICE there is the field transactionId
which can be used in this request. In addition, you have to specify the invoice for which deposit is requested by passing parameters id
or idempotencyKey
of the invoice.
Example of the request by id
:
cURL
In response you will receive deposit data:
JSON
To track state of your created Invoice 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 Invoice 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:
INVOICE_FUNDS_RECEIVED_FOR_INVOICE
The event shows if funds have been received to invoice wallet
INVOICE_TRANSLATION_TO_ACCOUNT_COMPLETED
Funds have been received from invoice wallet to the merchant balance
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 “INVOICE” 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 Payment events and providing your client with Payment Link you can wait for your client to make payment.
If client paid the invoice you will receive webhook with type INVOICE_FUNDS_RECEIVED_FOR_INVOICE.
The example of webhook payload:JSON
The most important fields in the event payload:
parentExternalId
- system ID of invoice.
externalId
- custom merchant ID, that could be set when the invoice was created.
amount
- amount of money paid for this invoice.
transactionIds
- system IDs of deposits.
That means that the money were sent by client and they were received to invoice wallet address (invoiceAddress
field).
After receiving money to invoice wallet address received money amount will be credited to the balance.
When money successfully credited to the balance you will receive webhook with type INVOICE_TRANSLATION_TO_ACCOUNT_COMPLETED.
The example of webhook payload:
JSON
The most important fields in the event payload:
parentExternalId
- system ID of invoice.
externalId
- custom merchant ID, that could be set when the invoice was created.
amount
- amount of money paid for this invoice.
serviceFee
- service fee for the invoice deposit. This amount will be charged from the deposit amount.
In order to calculate exact amount of money credited to the merchant balance you should deduct serviceFee
from amount
.
To avoid errors related to receiving webhooks, it is necessary to request information about the incoming transaction in Calypso Pay after receiving the webhook. You can request additional information about this particular deposit by transactionId
using Get Deposit for the Invoice endpoint (POST https://api.calypso.finance/api/v1/invoice/deposit
).
In the scenario with an unlimited invoice, there are no interventions, the amount of replenishment is not important. It is important to understand that the money that gets on the unlimited invoice is not moved to the available balance instantly. First, INVOICE_FUNDS_RECEIVED_FOR_INVOICE webhook event will be received, then after crediting funds to the balance INVOICE_TRANSLATION_TO_ACCOUNT_COMPLETED will be received. The system guarantees that the money will be transferred from the invoice wallet to the account balance (in negative scenarios, a delay may be due to our fault, but the funds will be given). It follows from this that at the moment when the funds have arrived on the invoice balance, the merchant can already fully verify the transfer of funds from the client on his side.
At the moment when the merchant synchronizes a new deposit in his system you can use Get exchange rate endpoint (POST https://api.calypso.finance/api/v1/rate
) to calculate the fiat amount equivalent of the crypto amount of the deposit.
More info on Get exchange rates endpoint: Get exchange rates.
Loading...
If you already have a checkout page in your application it's can be useful to embed invoice data to checkout page with all needed for client payment data. Embedding invoice data on your checkout page can provide several benefits for your business and your customers:
By including all the necessary information for payment on one page, it makes the process of making a payment in cryptocurrency more streamlined and efficient.
Customers will not need to leave your website to complete their payment and this can increase payment conversion.
Additionally, it can also improve the overall user experience by making the payment process more user-friendly and intuitive.
We also have some detailed guides on how to create and track limited fiat invoices via API:
Limited Fiat invoice - the amount to pay is issued in fiat currency but converted to crypto currency at current exchange rate.
For detailed information about managing invoices read these guides first. Here we will go through the general flow.
To embed Calypso invoice data to your web page, you can follow these steps:
Place the HTML code in your web page's code, wherever you want the invoice to appear:
HTML
cURL
Get invoice data in response
JSON
Replace the placeholder data within the code (such as the currency, amount, and wallet address) with the actual invoice data that you receive in response:
If you have a CSS file in your web page, you can add the CSS styles for the HTML code.
Add the copyText() function to your Javascript file and make sure it is correctly referenced in the HTML code.
HTML
Test the invoice on your web page, to make sure that it looks good and that all the data is correct. Your ready invoice form with CSS styles can be looked like this:
Payment widget is an out of the box solution for accepting crypto currencies from your clients. It is versatile, easy to set up and adjust for you and easy to use for your clients.
While being based on our invoice product under the hood, it also gives your client the possibility to choose the currency and different ways to pay - by just copying the needed address, scanning the QR code or connecting via Metamask or Walletconnect in just a few clicks.
More details about the functions and design of the Payment Widget can be found here .
Following this link you will be able to see and interact with a real payment widget - click here.
To find detailed instructions on how to install the widget on your site please check the following links:
How to create limited fiat payment widget via API?
How to embed a payment widget on a web page?
And also the API documentation for setting a Payment Widget:
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...