AIO
EN
  • EN
  • ZH
    AIO
    EN
    • EN
    • ZH
    • Overview
    • Create API Key
    • Callback
    • Security
    • Pay-in
    • Pay-out
    • API
      • Before You Begin
      • Get Txs
        GET
      • Get Sub Txs
        GET
      • Get Tx Info
        GET
      • Create Payin Tx
        POST
      • Create Payin Longtime Tx
        POST
      • Create Payout Tx
        POST
      • Price
        GET
      • Calculate price
        GET
    • Schemas
      • Schemas
        • CallbackReqContentData
        • CallbackSubTxData
        • CallbackTxData
        • CallbackType
        • GetSubTxData
        • SubTxDataExt
        • SubTxStatus
        • GetSubTxDataResponse
        • Chain
        • ErrorResponseModel
        • PayTxData
        • PayTxStatusData
        • PayinLongTimeTxParams
        • PayinTxParams
        • PayoutSubTxParams
        • PayoutTxParams
        • PriceData
        • RedisKeyData
        • SubTxData
        • SuceedResponseModel
        • TestData
        • Token
        • TxData
        • TxDetailsData
        • TxStatus
        • TxType
        • VsToken
        • TestDataResponse
        • RedisKeyDataResponse
        • PriceDataResponse
        • PayTxDataResponse
        • PayTxStatusDataResponse
        • TxDetailsDataResponse
        • TxDataResponse

    Callback

    Asynchronous Notification via Callback#

    AIO supports an asynchronous callback mechanism that automatically sends transaction updates to your configured service URL whenever the transaction status changes. This enables you to efficiently handle post-processing logic, such as updating order status, recording transaction flows, or triggering business notifications.

    Callback Integration Process#

    1
    Implement the Callback Endpoint
    Implement an HTTP POST endpoint on your server to receive and parse callback notifications pushed by AIO.
    2
    Configure the Callback URL
    Configure the Callback URL you implemented in the AIO dashboard.

    How to implement an interface for receiving callbacks#

    Interface Overview
    Signature Verification
    Idempotent Processing
    Callback Retry Mechanism
    Callback Trigger Relationship

    Interface Overview#

    To securely and reliably receive and process callback requests, please consider the following:
    The request will include signature-related headers for authentication and integrity validation.
    The request body is in JSON format and follows the CallbackTxData schema.

    Request Headers#

    The following headers are included in each callback request:
    HeaderDescription
    User-AgentIdentifies the request as originating from the AIO callback system.
    AlgorithmSignature algorithm used; currently HMAC-SHA256.
    DateUTC timestamp of the request; recommended for anti-replay protection.
    Body-MD5MD5 hash of the request body for content integrity verification.
    Aio-SignHMAC signature generated using your Secret Key, used to validate the request
    TIP
    It is recommended to verify the Aio-Sign on your server to ensure authenticity and integrity of the request.

    Request Body#

    The request body is a byte stream containing transaction details in JSON format. The field structure follows the definition of CallbackReqContentData. A basic structure is shown below:
    CallbackReqContentData

    example
    {
        "type": "Transaction",
        "data": {
            "uid": "U_PAC116HWGD",
            "txid": "O00745a1afF66fcbBd",
            "status": "Pending Execution",
            "type": "Pay Out",
            "vs_token": null,
            "vs_amount": null,
            "usd": "24.96",
            "chain": "Ethereum",
            "token": null,
            "amount": null,
            "bind_info": null,
            "sub_txs": [
                {
                    "sub_txid": "6616936959160282",
                    "status": "Pending",
                    "token": "ETH",
                    "amount": "0.01",
                    "hash": null,
                    "from_addr": null,
                    "to_addr": "0xe5ac5A490Aa8EFEAF0e3Ddcb494eb8c513016430"
                }
            ]
        }
    }

    How to Verify a Signature#

    Once you have configured the callback URL, the system will automatically send a POST request to your specified URL whenever a transaction status changes. This request will include a set of headers used for signature verification.

    Idempotent processing#

    To ensure the stability of transaction notifications, the AIO callback system has a built-in retry mechanism:
    When calling the callback URL provided by the merchant returns an HTTP status code other than 200, or the response times out, the system will automatically retry the push within a certain period of time.
    Therefore, when implementing the callback interface, you must ensure that the interface has idempotency. That is:
    When receiving the same callback data, multiple calls to the interface should produce the same processing results, and will not cause problems such as repeated execution, repeated updates, or repeated writes.
    Recommended practice
    Use tx_id and sub_tx_id in the callback data as the unique identifier of idempotent processing;
    Record the identifier during the first processing, and directly ignore or return the processing success status when receiving data with the same identifier later.

    Configure the Callback URL#

    You can configure a callback address in the AIO Dashboard to receive transaction status updates:
    1.
    Log in to the AIO Dashboard and go to Integrations -> Callback Management in the left sidebar.
    2.
    Enable and configure your Callback URL to receive transaction status notifications.
    CAUTION
    Please keep your Secret Key safe, as it is required for signature verification.
    4.
    Whenever a transaction status changes, the system will automatically send a POST request to your configured Callback URL, with the transaction details in the request body.
    👋
    Make sure your server supports HTTPS and is able to properly respond to POST requests. We recommend responding with a 200 OK status code; otherwise, the system may treat the callback as failed and attempt retries.
    image.png

    Callback Retry Mechanism#

    To enhance system reliability and stability, the AIO platform has a built-in automatic retry mechanism for pushing transaction status update callbacks. When your server fails to successfully receive or process a callback request, the platform will perform retries using an exponential backoff strategy to maximize the probability of transaction notification delivery.
    Trigger Conditions
    The callback response is not 200 OK
    Request times out or connection fails
    Callback URL is unreachable
    Retry Limits
    Each transaction will be retried up to 16 times
    After the 8th failure, a warning will be triggered
    When the maximum limit is reached, retries will stop and a log entry will be recorded
    Health Check
    The system will check whether there has been any successful callback in the past three days
    If there is no successful callback, the system will mark it as abnormal and trigger an error log or notification

    Callback Trigger Relationship#

    During the lifecycle of a transaction, AIO will automatically send a POST request to your configured Callback URL whenever the transaction status changes. The request body is in JSON format, structured as CallbackTxData.
    Transaction StatusTrigger Descriptionsub_txs ContentCallback Purpose
    Pending ApprovalTriggered when the main transaction is created and pending approvalAn empty array or a list of initial SubTxNotify the system of pending approval
    Pending ExecutionTriggered when the main transaction is approved or waiting for executionAn empty array or a list of initial SubTxNotify the system to prepare for execution
    PendingTriggered whenever a new sub-transaction is generatedA list containing the newly generated SubTxNotify the system of a new incoming transaction
    CompletedTriggered when the main transaction is marked as completedA list containing the most recent SubTx before completionNotify that transaction processing is complete
    ClosedTriggered when the main transaction is closedA list containing the most recent SubTx before closureNotify that the transaction is closed
    OverdueTriggered when the transaction times out without completionA list containing the most recent SubTx before timeoutNotify that the transaction is overdue
    Previous
    Create API Key
    Next
    Security
    Built with