AkashicPay
繁體中文
繁體中文
  • 簡介
    • 概述
    • 費用結構
    • 交易時間
    • 術語
  • 儀表板
    • 儀表板
    • 帳號
    • 轉帳
    • 設置
    • 開發者
  • SDK
    • 入門
    • 付款流程
    • SDK 與工具套件
    • 函式 (Functions)
      • getDepositAddress
      • getDepositUrl
      • 識別碼 (Identifier) & ReferenceId
      • 要求的金額和貨幣
      • 提款/提幣 (payout)
      • 提款/提幣回調 (Payout callback)
      • 存款回調 (Deposit callback)
      • getTransfers
      • getBalance
      • getTransactionDetails
      • 錯誤訊息 (Errors)
    • 支援貨幣
    • 回調安全性
  • 指南
    • 快速指南
    • 建議整合流程
Powered by GitBook
On this page
  • 範例
  • 待提款/提幣 (L1Transaction)
  • 提款/提幣 (L1Transaction)
  • 提款/提幣 (L2Transaction)

Was this helpful?

  1. SDK
  2. 函式 (Functions)

提款/提幣回調 (Payout callback)

從您所建立的其中一個錢包 (地址) 支付後所收到的資料

Previous提款/提幣 (payout)Next存款回調 (Deposit callback)

Last updated 2 months ago

Was this helpful?

要接收回調,請確保您在 AkashicPay.com 上註冊了您的 URL。您可以接收 「待定」、「已確認」 和 「失敗」 狀態的交易回調。我們建議您設定所有三種狀態,不過如果需要的話,您可以跳過「待定」狀態。只有狀態為 「已確認」 或 「失敗」 的交易才是最終交易。

注意:如果回調的回應狀態代碼 (status code) >= 400,則回調最多會重試 15 次,延遲時間會增加,第一次嘗試後最多可延遲 10 小時左右。

注意: l2Txnhash(「L2-hash」)應始終用作交易的唯一識別碼 (identifier)。這是 上任何交易的唯一交易哈希 (transaction-hash)。它存在於已確認的存款和待定/已確認的提款中。這對於第二層交易尤其重要,因為交易沒有第一層哈希值 (txHash)

範例

待提款/提幣 (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
}

提款/提幣 (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
}

對於待處理交易,feesPaid 和 confirmedAt 尚未知道,因此不存在。

關於提款費用的說明

提款時,有幾種不同的費用。這些是:

  • Akashic 費用 (回調中的 internalFee.withdraw),總是與交易貨幣相同。例如,ETH 轉帳用 ETH,USDT 轉帳用 USDT,等等。除非發生「費用代令」,否則通常為 0,請參閱下文。

利用這一點,我們可以計算使用者花費的總金額(假設上圖所示的回調資料在 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;
}

請注意,以上是偽碼。您可能需要額外注意處理潛在的未定義/空值(如 internalFee),並根據您所選程式語言的一般慣例,安全正確地解析數字。

提款/提幣 (L2Transaction)

如果使用者要傳送資產給 Akashic 系統中的其他使用者,則會在 AkashicChain 中執行,這是我們的第 2 層區塊鏈,可降低第一層的礦工費和成本。

{
  "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
}

(回調中的 feesPaid),總是以計算 (例如 ETH 代表 ERC20 USDT 轉帳,TRX 代表 TRC20 USDT 轉帳等)。由 收取 (以太坊 (Ethereum)、波場 (Tron) 等)

「費用代付」。Akashic 系統讓您用代幣而非原生幣來支付上述的原生費用,以簡化問題。如果這樣做,feeIsDelegated 將會在回調中為 true。所有使用 SDK 完成的提款都應該是 「代付」 的,而從 啟動的提款預設不會是 「代付」的。「代付」 費用所需的額外代幣金額在 internalFee.withdraw 中。

AkashicChain
第二層
礦工費
原生幣
L1 網路
AkashicLink