跳至主要内容

Query Transaction API

HTTP Request

GET /v5/bybitpay/agreement/pay/query

Query single deduction transaction or refund record details.


Request Parameters

ParameterTypeRequiredDescription
merchant_idstringYesMerchant ID
user_idstringYesPlatform user ID
agreement_typestringYesSign type: CYCLE / NON_CYCLE / SINGLE
record_typestringNoRecord type: PAY (default) / REFUND
trade_nostringConditionalPlatform trade number (for record_type=PAY)
out_trade_nostringConditionalMerchant order number (for record_type=PAY)
refund_nostringConditionalPlatform refund number (for record_type=REFUND)
out_refund_nostringConditionalMerchant refund number (for record_type=REFUND)
信息
  • For record_type=PAY: Either trade_no or out_trade_no required
  • For record_type=REFUND: Either refund_no or out_refund_no required

Response Parameters (Deduction Transaction)

ParameterTypeDescription
retCodeintResponse code
retMsgstringResponse message
resultobjectTransaction details
result.trade_nostringPlatform trade number
result.out_trade_nostringMerchant order number
result.statusstringTransaction status
result.amountobjectRequested amount
result.crypto_paymentobjectActual crypto payment (for fiat orders)
result.pay_timestringPayment time
result.refund_amountobjectRefunded amount

Response Parameters (Refund Record)

ParameterTypeDescription
retCodeintResponse code
retMsgstringResponse message
resultobjectRefund details
result.refund_nostringPlatform refund number
result.out_refund_nostringMerchant refund number
result.trade_nostringOriginal trade number
result.statusstringRefund status: PROCESSING / SUCCESS / FAILED
result.refund_amountobjectRefund amount
result.refund_timestringRefund success time
result.failure_reasonstringFailure reason

Request Examples

Query Deduction Transaction

GET /v5/bybitpay/agreement/pay/query?merchant_id=M123456789&user_id=U_123456789&agreement_type=CYCLE&record_type=PAY&trade_no=PAY202601070001 HTTP/1.1
Host: api2.bybit.com
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1736233200000
X-BAPI-SIGN: {signature}
X-BAPI-RECV-WINDOW: 5000

Query Refund Record

GET /v5/bybitpay/agreement/pay/query?merchant_id=M123456789&user_id=U_123456789&agreement_type=CYCLE&record_type=REFUND&refund_no=RF202601070001 HTTP/1.1
Host: api2.bybit.com
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1736233200000
X-BAPI-SIGN: {signature}
X-BAPI-RECV-WINDOW: 5000

Response Examples

Deduction Transaction (with Fiat to Crypto Conversion)

{
"retCode": 20000,
"retMsg": "Success",
"result": {
"trade_no": "PAY202601070002",
"out_trade_no": "ORDER20260107002",
"status": "SUCCESS",
"amount": {
"total": "10000",
"currency": "USD",
"currency_type": "FIAT"
},
"crypto_payment": {
"currency": "USDT",
"amount": "10005.50",
"chain": "TRC20",
"exchange_rate": "1.00055",
"rate_time": "2026-01-07T10:29:55Z"
},
"pay_time": "2026-01-07T10:30:00Z",
"refund_amount": {
"total": "0",
"currency": "USD",
"currency_type": "FIAT"
}
}
}

Refund Record

{
"retCode": 20000,
"retMsg": "Success",
"result": {
"refund_no": "RF202601070001",
"out_refund_no": "REFUND20260107001",
"trade_no": "PAY202601070001",
"status": "SUCCESS",
"refund_amount": {
"total": "2350",
"currency": "USDT",
"currency_type": "CRYPTO",
"chain": "TRC20"
},
"refund_time": "2026-01-07T11:30:00Z"
}
}

Notes

  • Use this API to confirm transaction status after timeout
  • refund_amount in transaction response shows total refunded amount
  • For PROCESSING status, wait for webhook or poll periodically