Payout callback

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.

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.

Example

Payout (L1Transaction)

{
    "layer": "L1Transaction",
    "amount": "0.100000",
    "coinSymbol": "TRX",
    "initiatedAt": "2024-09-05T18:48:44.336Z",
    "confirmedAt": "2024-09-05T18:50:02.133Z",
    "feesEstimate": "6.114654",
    "fromAddress": "TMvP2eXkQLib137dpHP4xyVxDSEJGHeh6V",
    "identifier": "test022",
    "internalFee": {
      "withdraw": "1.000000"
    },
    "l2TxnHash": "AS54535428a38d9aea28543bd458961963b9326c6c487b1962424bbaa155991490",
    "senderIdentity": "ASbb8efead2d5ff2f618a85895bac8e8ac1bae236d4d730bf113400b7e6f108ca5",
    "status": "Confirmed",
    "toAddress": "TXRW3hffYsD5cte1vpDg125K4WD6PYdmu7",
    "tokenSymbol": "USDT",
    "txHash": "0bce253dfeaf05eb6b524c43cfedcc263b78fdeae6f62953c15a131713ada8f8",
    "feesPaid": "5.822220",
    "feeIsDelegated": false, // if using token instead of native coin to pay the fee
    "directResolution": false // if pending payout doesn't exist
  }

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 coin
    if (!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.

Last updated