Data received after a payout is made from one of your created wallets (addresses)
To receive callbacks make sure you registered your URLs on AkashicPay.com. You can receive callbacks for transactions in the "Pending", "Confirmed", and "Failed" status. We recommend setting all three, though you could skip "Pending" if desired. Only transactions with "Confirmed" or "Failed" status are final
Note: If the response to the callback has a status code >= 400, the callback is retried up to 15 times with increasing delays up to around 10hrs since the first attempt.
Note: l2Txnhash (the "L2-hash") should always be used as the unique identifier of a transaction. This is a unique transaction-hash for any transaction on AkashicChain. It is present for Confirmed deposits and Pending/Confirmed payouts. This is particularly important for the case of Layer 2 transactions, which will not have a Layer 1 hash (txHash)
Example
Pending Payout (L1Transaction)
{"fromAddress":"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",// sending wallet/account of transaction"toAddress":"TQH8ygbS8BAnzSQ9uxR9vXHJYMQVRvbgPg",// receiving wallet/account of transaction"layer":"L1Transaction",// 'L1Transaction' or 'L2Transaction'"initiatedAt":"2024-08-19T10:02:54.000Z",// ISO8601 format"amount":"1.000000",// Amount sent"coinSymbol":"TRX",// NetworkSymbol, e.g. 'ETH' or 'TRX'"status":"Confirmed",// TransactionStatus. 'Pending', 'Confirmed', or 'Failed'"txHash":"28a9880ad2ef3b7be1c40763128ec9630ab74e4749a3c81037c3501e4209bfcc",// Network's hash if L1. Not present for L2"feesEstimate":"6.114654",// Gas fee estimated by Akashic. Not present for L2"l2TxnHash":"ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef",// Akashic Transaction Hash. For both L1 and L2 "senderIdentity":"ASbb8efead2d5ff2f618a85895bac8e8ac1bae236d4d730bf113400b7e6f108ca5",// Akashic Address of sender"tokenSymbol":"USDT",// TokenSymbol. Present only if token-transaction"internalFee": {"withdraw":"0.100000" },// Akashic Fee { deposit?: string, withdraw?: string}"identifier":"user123",// User-identifier"feeIsDelegated":false,// Whether L1 gas fees were paid using token instead of native coin"directResolution":false// true if the transaction was never registered in the "Pending" state}
Payout (L1Transaction)
{"fromAddress":"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",// sending wallet/account of transaction"toAddress":"TQH8ygbS8BAnzSQ9uxR9vXHJYMQVRvbgPg",// receiving wallet/account of transaction"layer":"L1Transaction",// 'L1Transaction' or 'L2Transaction'"initiatedAt":"2024-08-19T10:02:54.000Z",// ISO8601 format"confirmedAt":"2024-08-19T10:04:02.000Z",// Only present if status is 'Confirmed' or 'Failed'"amount":"1.000000",// Amount sent"coinSymbol":"TRX",// NetworkSymbol, e.g. 'ETH' or 'TRX'"status":"Confirmed",// TransactionStatus. 'Pending', 'Confirmed', or 'Failed'"txHash":"28a9880ad2ef3b7be1c40763128ec9630ab74e4749a3c81037c3501e4209bfcc",// Network's hash if L1. Not present for L2"feesEstimate":"6.114654",// Gas fee estimated by Akashic. Not present for L2"feesPaid":"5.822220, // Gas Fee paid on network. Not present for L2 "l2TxnHash": "ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef", // Akashic Transaction Hash. For both L1 and L2 "senderIdentity": "ASbb8efead2d5ff2f618a85895bac8e8ac1bae236d4d730bf113400b7e6f108ca5", // Akashic Address of sender "tokenSymbol": "USDT", // TokenSymbol. Present only if token-transaction "internalFee": { "withdraw": "0.100000" }, // Akashic Fee { deposit?: string, withdraw?: string} "identifier": "user123", // User-identifier "feeIsDelegated": false, // Whether L1 gas fees were paid using token instead of native coin "directResolution": false // true if the transaction was never registered in the "Pending" state}
For a pending transaction, feesPaid and confirmedAt are not know yet and thus not present.
A note on withdrawal fees
There are a few different components in play regarding fees when doing a withdrawal. These are:
Akashic Fee (internalFee.withdraw in callback), always in the same currency as the transaction. I.e. ETH for an ETH transfer, USDT for a USDT transfer, etc. Normally 0 unless "fee delegation" happens, see below.
Gas Fee (feesPaid in callback), always in native coin (e.g. ETH for a ERC20 USDT transfer, TRX for a TRC20 USDT transfer, etc.). Charged by the L1 networks (Ethereum, Tron, etc.)
"Fee Delegation". The Akashic system lets you pay for the aforementioned native fee in tokens instead of native coin to simplify matters. If this is done, feeIsDelegated will be true in the callback. All withdrawals done using the SDK should be "delegated" while withdrawals initating from AkashicLink will not by default. The extra token-amount needed to "delegate" the fee is in internalFee.withdraw
Using this, to calculate the total amount spent by a user we can do (assuming callback data of the form shown above is in txCallback):
// Token transaction (USDT)if (txCallback.tokenSymbol) { userTokenSpent =txCallback.amount +txCallback.internalFee.withdraw;// If fee is not delegated, gas fees are paid in native coinif (!feeIsDelegated) { userNativeCoinSpent =txCallback.feesPaid; }} else {// Coin transaction (ETH, TRX) userNativeCoinSpent =txCallback.amount +txCallback.internalFee.withdraw +txCallback.feesPaid;}
Note that the above is pseudocode. You would probably need to take extra care of handling potential undefined/null values like internalFee as well as parse the numbers safely and correctly, following normal practices in your chosen programming language.
Payout (L2Transaction)
If user is sending assets to another user in the Akashic system, it will be executed in AkashicChain, which is our Layer 2 blockchain to reduce the gas fee and cost in Layer 1.
{"initiatedAt":"2024-08-19T10:03:58.649Z","confirmedAt":"2024-08-19T10:03:58.649Z","fromAddress":"AS3ce733d2af1ee530e0e85bd7de45c59626b28f95ac2d8e83a0685a70aac9b764",// Same as senderIdentity"toAddress":"AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5",// Same as receiverIdentity"coinSymbol":"TRX-SHASTA","status":"Confirmed",// "Confirmed" or "Failed""layer":"L2Transaction",// Could be "L2Transaction" here"amount":"10.000000","internalFee": {"withdraw":"0.100000"// Akashic-fee, not present if Failed },"l2TxnHash":"ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef",// AkashicChain txHash"receiverIdentity":"AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5",// Akashic-address of sender"tokenSymbol":"USDT"// Only here if a token-transaction,"identifier": "user123","senderIdentity":"AS3ce733d2af1ee530e0e85bd7de45c59626b28f95ac2d8e83a0685a70aac9b764"// Alashic-address of receiver}