Subscriptions
With Krayon Digital API, you can create different subscriptions in your system based on various events, such as transactions, deposits, compliance, and elections.
Krayon offers different channels to notify the client, such as Webhooks, emails, slack channels, and Telegram channels.
Create A Subscription
Request:
import axios from 'axios';
const options = {
method: 'POST',
url: 'https:/api.aqua.test.krayondigital.com/main/api/v1/subscriptions',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'Bearer': 'YOUR-API-TOKEN'
},
data: {
"type": "transactions",
"notification_channels": [
{
"channel_type": "webhook",
"address": "https://eo3y4clrcxypoxe.m.pipedream.net"
}
]
}
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
import requests
url = "https:/api.aqua.test.krayondigital.com/main/api/v1/subscriptions"
payload = {
"type": "transactions",
"notification_channels": [
{
"channel_type": "webhook",
"address": "https://eo3y4clrcxypoxe.m.pipedream.net"
}
]
}
headers = {
"accept": "application/json",
"content-type": "application/json"
"Bearer": "YOUR-API-TOKEN"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
- In this request, we are requesting notifications on transactions through a webhook.
Response:
{
"data": {
"id": "302beabd51be44d482565b48bd6836e4",
"organization": "org_aAgoWL5DjwSvQSf0",
"type": "transactions",
"notification_channels": [
{
"channel_type": "webhook",
"address": "https://eo3y4clrcxypoxe.m.pipedream.net"
}
]
}
}
Examples of Webhooks data:
Transfers
{
"amount": "2.679000000000000000000",
"block_time_stamp": "2024-03-31T09:36:00Z",
"blockchain": "tron_shasta",
"chain_id": 1461562,
"decimals": 6,
"from_address": "TBSmvEVv7zZSCthwbhjYQXTgvNVwjxG3mQ",
"hash": "b65df1a1b7a701a3b1c96f7e9fb2177cfb5d41476683d9cb4debc71b88be1f1f",
"id": "c5d7ec4be86b416c8241c8afed821493",
"logo_uri": "https://static.tronscan.org/production/upload/logo/TEkxiTehnzSmSe2XqrBj4w32RUN966rdz81.png",
"name": "USD Coin",
"native_amount": "0",
"native_price": "0.122520964148135790",
"status": "TRANSACTION_SUCCESS",
"symbol": "USDC",
"to_address": "TRzjB6ZsdniBZg4AXdLXTTw43owftL9pX7",
"token_price": "1.000260862331133800",
"transaction_fee": "5.823480000000000000",
"transaction_fee_usd": "0.713498384297385810",
"transaction_id": "7ccb8ccd3ad14a1a9ee041c822e9d6f9",
"wallet": "bfcd9d46c271405ea3ec64df2d256e09"
}
Transfer object:
Field | Format | Description |
---|---|---|
deposit_id | string | ID of the deposit. |
block_time_stamp | string | The Transfer timestamp. |
blockchain | string | The blockchain. |
chain_id | number | The blockchain chain id. |
decimals | number | Number of decimals for the token. |
from_address | string | The transfer sender. |
hash | string | The transfer hash. |
id | string | The Transfer UUID. See more details here Deposit Object. |
logo_uri | string | The Token's logo. |
name | string | The Token's name. |
native_amount | string | The amount in native form with all decimals. |
native_price | string | The native price of the Token used to pay the Transfer. |
status | string | The transfer status. See more details here Transfer Object |
symbol | string | The Token's symbol. |
to_address | string | The transfer receiver. |
token_price | string | The Token's price in USD. |
transaction_fee | string | The fee in native form. |
transaction_fee_usd | string | The fee in USD price. |
transaction_id | string | The transaction UUID. |
wallet | string | The wallet UUID. See more details here Wallet Object |
Deposits
{
"id": "08ca7622ebdb4ae68001733a733c4eab",
"status": "SUCCESS",
"amount": "700",
"currency": "INR",
"payment_method": "UPI",
"description": "",
"payment_fee": "42.00",
"net_amount": "658.00"
}
Notification object:
Field | Format | Description |
---|---|---|
id | string | ID of the deposit. ** This is not the reference id, this is Krayon's internal deposit object ID. |
status | string | Status of the deposit. See more details hereDeposit Object. |
amount | string | The amount that the end user paid. ** This is not the amount that the deposit object has been created with. |
currency | string | The currency of the deposit. |
payment_method | string | The payment method of the deposit. e.g INR, CRYPTO |
description | string | The description of the deposit. |
payment_fee | string | The deposit fee. e.g., amount * fee% |
net_amount | string | The net amount of the deposit. e.g., amount * (1-fee%) |
Updated 13 days ago