Skip to content

Query a Withdrawal Order — checkWithdrawOrder

Look up the current status of a withdrawal order by your merchant order number (userOrder). The response has the same structure as the withdrawal status callback, which makes it useful for:

  • Actively polling as a fallback when a callback hasn't arrived in time;
  • Verifying the final order state (orderStatus) and the on-chain transaction hash (txid) during reconciliation.
POST https://api.anonypay.io/api/merchant/checkWithdrawOrder

As with every other business endpoint: the request body is the RSA-OAEP-encrypted ciphertext of the business JSON, sent with the full set of signature headers (ANONY-APP-ID / ANONY-TOKEN / ANONY-TIMESTAMP / ANONY-NONCE / ANONY-SIGN). See the protocol reference for encryption and signing details, and getToken for obtaining a token.

Request Parameters

FieldTypeRequiredDescription
userOrderstringYesMerchant order number (the userOrder you supplied when creating the withdrawal order)

Example request body (the business JSON before encryption):

json
{ "userOrder": "W20260708-0001" }

Response Fields

After verifying the signature and decrypting, data contains the business JSON. Its fields match the withdrawal status callback:

FieldTypeDescription
businessTypestringAlways withdraw
toAddressstringWithdrawal destination address
amountstringWithdrawal amount
currencystringCurrency symbol
feestringFee
apiOrderstringPlatform order number
userOrderstringMerchant order number
withdrawTypestringWithdrawal type: normal / financialConfirmation (finance review)
messagestringRemarks
txidstringOn-chain transaction hash (may be empty while the order is still in progress)
orderStatusstringOrder status — see the table below for all values

Example decrypted response:

json
{
  "businessType": "withdraw",
  "toAddress": "TXYZ...abcd",
  "amount": "100",
  "currency": "trx.usdt",
  "fee": "1",
  "apiOrder": "AP2026070812345",
  "userOrder": "W20260708-0001",
  "withdrawType": "normal",
  "message": "",
  "txid": "9a1b2c3d...",
  "orderStatus": "success"
}

All orderStatus Values

ValueKindMeaning
pendingConfirmIntermediateOrder accepted (funds deducted, order created), awaiting platform confirmation
pendingTransferIntermediateWaiting for / executing the on-chain transfer (normal flow)
pendingFinancialConfirmationIntermediateAwaiting finance approval (only in the withdrawType=financialConfirmation flow)
pendingCallbackIntermediateOn-chain processing finished, callback to the merchant pending
successFinalWithdrawal succeeded
WithdrawRefundFinalWithdrawal rejected/refunded — the amount has been returned to your merchant balance
failFinalWithdrawal failed

Status transitions for the two flows (see the state-machine diagram on the createWithdrawOrder page):

  • Normal withdrawal (normal): pendingConfirmpendingTransferpendingCallbacksuccess
  • Finance-review withdrawal (financialConfirmation): pendingConfirmpendingFinancialConfirmationpendingCallbacksuccess
  • Either flow can end in WithdrawRefund (rejected and refunded) or fail (failed).

Base business decisions on final states only

The exact names and transitions of the intermediate states (pending*) may change as platform workflows evolve — do not hardcode logic against them. Determine the outcome of an order solely from the three final states: success / WithdrawRefund / fail. The final result is also delivered asynchronously via the withdrawal status callback; this endpoint is best used as a fallback for callbacks and for reconciliation.

Errors

messageDescription
withdrawOrderNotExistNo withdrawal order found for this userOrder (wrong order number, or the order belongs to a different merchant account)

On failure the response is { "code": 9999, "data": "", "message": "withdrawOrderNotExist" }. For other common errors (signatureFailed, tokenExpired, etc.), see Error Codes.

Code Examples

php
require 'AnonyV2Client.php';

$client = new AnonyV2Client($appId, $serverPublicKeyB64, $merchantPrivateKeyB64);
$token  = $client->getToken($secret);

$res = $client->post('checkWithdrawOrder', ['userOrder' => 'W20260708-0001'], $token);
// $res['data'] is already signature-verified and decrypted
$order = $res['data'];
if (in_array($order['orderStatus'], ['success', 'WithdrawRefund', 'fail'], true)) {
    // Final state — safe to update your local order accordingly
}
python
from anony_v2 import AnonyV2Client, auth_header
import requests

c = AnonyV2Client(app_id, server_pub_b64, merchant_priv_b64)

# Get a token (the response is still an encrypted + signed envelope; verify and decrypt it)
tr = requests.post(c.base_url + "getToken",
                   headers={"ANONY-APP-ID": str(app_id),
                            "Authorization": auth_header(app_id, secret)})
tb = tr.json()
token = c.verify_response(tb["data"], tr.headers["ANONY-TIMESTAMP"],
                          tr.headers["ANONY-NONCE"], tr.headers["ANONY-SIGN"])["token"]

req = c.build_request({"userOrder": "W20260708-0001"}, token)
r = requests.post(c.base_url + "checkWithdrawOrder", data=req["body"], headers=req["headers"])
body = r.json()
if body["code"] == 10000:
    order = c.verify_response(body["data"], r.headers["ANONY-TIMESTAMP"],
                              r.headers["ANONY-NONCE"], r.headers["ANONY-SIGN"])
    print(order["orderStatus"], order["txid"])
else:
    print(body["message"])  # e.g. withdrawOrderNotExist
js
const { AnonyV2Client } = require('./anony_v2');

const c = new AnonyV2Client(appId, serverPubB64, merchantPrivB64);
const token = await c.getToken(secret); // Node ≥18

const req = c.buildRequest({ userOrder: 'W20260708-0001' }, token);
const r = await fetch(c.baseUrl + 'checkWithdrawOrder', {
  method: 'POST', body: req.body, headers: req.headers,
});
const body = await r.json();
if (body.code === 10000) {
  const order = c.verifyResponse(body.data, r.headers.get('anony-timestamp'),
    r.headers.get('anony-nonce'), r.headers.get('anony-sign'));
  console.log(order.orderStatus, order.txid);
} else {
  console.log(body.message); // e.g. withdrawOrderNotExist
}
  • createWithdrawOrder — creating withdrawal orders, parameter validation, and the state-machine diagram
  • Callbacks — withdrawal status callback fields, signature verification, and decryption
  • Error Codes — full error code list and troubleshooting