Callbacks
Crypto2B can generate notifications for the client's system with information about operations (for example, deposits, withdrawals, service operations, address checks). Callbacks are used for this.
Setup
If the client wants to use the callback mechanism to track the processing status of operations, the callback URL must be configured in the personal account.
Then, while processing crypto payments, Crypto2B will send JSON-formatted notifications to this URL with all the necessary information about the transaction.
Callback content
Crypto2B callbacks contain all the important information about the transaction:
- operation type
- processing status
- currency
- address
- amount
- transaction hash in the blockchain
- number of confirmations
- fee
and so on
Callback examples
Deposit
{
"data": {
"type": "Deposit",
"id": 123456,
"status": "Success",
"date": "2024-01-15T10:30:00Z",
"clientDepositId": "client-deposit-001",
"error": null,
"instrument": {
"currencyShortName": "USDT",
"transportProtocol": "trc20"
},
"address": {
"address": "TExampleDepositAddress1234567890abc",
"tag": null,
"foreignId": "user-12345",
"senderAddress": "TExampleSenderAddress0987654321xyz"
},
"transaction": {
"approach": "FullProcessing",
"hash": "abc123def456abc123def456abc123def456abc123def456abc123def456abcd",
"amount": 1000.50,
"confirmations": 21,
"amlRiskGrade": "Low"
},
"fees": [
{
"type": "Commercial",
"currencyShortName": "USDT",
"transportProtocol": "trc20",
"amount": 5.00
}
]
}
}
Withdrawal
{
"data": {
"type": "Withdrawal",
"id": 789012,
"status": "Success",
"date": "2024-01-15T14:45:00Z",
"paymentOrderId": "withdrawal-order-001",
"foreignId": "user-withdrawal-789",
"error": null,
"instrument": {
"currencyShortName": "BTC",
"transportProtocol": "btc"
},
"address": {
"address": "bc1qexamplewithdrawaladdress000000000000000",
"tag": null
},
"transaction": {
"approach": "FullProcessing",
"hash": "00000000000000000000abcdef1234567890abcdef1234567890abcdef123456",
"amount": 0.05,
"confirmations": 6,
"amlRiskGrade": null
},
"fees": [
{
"type": "Commercial",
"currencyShortName": "BTC",
"transportProtocol": "btc",
"amount": 0.0001
},
{
"type": "Technical",
"currencyShortName": "BTC",
"transportProtocol": "btc",
"amount": 0.00005
}
]
}
}
Service Operation
{
"data": {
"type": "Service",
"id": 345678,
"soType": "Common",
"status": "Success",
"date": "2024-01-15T16:00:00Z",
"error": null,
"instrument": {
"currencyShortName": "ETH",
"transportProtocol": "erc20"
},
"sender": "0x0000000000000000000000000000000000000001",
"recipient": "0x0000000000000000000000000000000000000002",
"transaction": {
"hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"amount": 2.5,
"confirmations": 35
},
"technicalFee": {
"currencyShortName": "ETH",
"transportProtocol": "erc20",
"amount": 0.002
}
}
}
Address Check
{
"data": {
"type": "AddressCheck",
"checkId": "550e8400-e29b-41d4-a716-446655440000",
"address": "TJYeasypBnB2x5hLTpYPQZ6YR9ZL3hLj6b",
"status": "Completed",
"amlRiskGrade": "Low",
"description": "Exchange wallet",
"currency": "USDT",
"protocol": "Tron",
"feeAmount": 0.5,
"feeCurrencyShortName": "USDT",
"timestamp": "2024-01-15T10:30:00Z",
"errorCode": null,
"errorMessage": null
}
}
Field description
| Field | Description |
|---|---|
type | Operation type: Deposit, Withdrawal, Service, AddressCheck |
id | Unique operation identifier in the system |
status | Operation processing status |
date | Date and time of the operation (ISO 8601) |
instrument | Information about the currency and protocol |
address | Transaction address and additional parameters |
transaction | Blockchain transaction details |
fees | Array of fees (commercial, technical) |
error | Error message (if any) |
Fields specific to deposits
| Field | Description |
|---|---|
clientDepositId | Deposit ID in the client's system |
address.foreignId | External user identifier |
address.senderAddress | Sender address |
Fields specific to withdrawals
| Field | Description |
|---|---|
paymentOrderId | Payment order ID |
foreignId | External operation identifier |
Fields specific to service operations
| Field | Description |
|---|---|
soType | Service operation type (for example, Common) |
sender | Sender address |
recipient | Recipient address |
technicalFee | Technical fee for the operation |
Address check callback fields
The address check callback does not contain the common id, date, instrument, address, transaction and fees fields. Its structure is described in the Address Check section.
Important note
Keep in mind that, due to implementation specifics, the same callback may sometimes be sent more than once. Always track transaction identifiers to avoid double spending and similar issues.