跳至主要内容

Agreement Deduction API

HTTP Request​

POST /v5/pay/agreement/deduction

Execute automatic deduction from user's account using a signed agreement. This is the core API for agreement payment.


Request Parameters​

ParameterTypeRequiredDescription
merchantIdstringYesMerchant ID
userIdstringYesPlatform user ID
agreementTypestringYesSign type: CYCLE / NON_CYCLE / SINGLE
agreementNostringYesPlatform agreement number
outTradeNostringYesMerchant order number (unique)
sceneCodestringYesScene code - Supports 17 scenarios including TAXI, PARKING, SUBSCRIPTION, FOOD, ENTERTAINMENT, EDUCATION, etc.
amountobjectYesDeduction amount
amount.totalstringYesAmount (minimum unit)
amount.currencystringYesCurrency code
amount.currencyTypestringYesFIAT or CRYPTO
amount.chainstringNoChain network (required in dynamic chain settlement mode, e.g., BSC, TRX, ARBI, LTC, SOL, ETH, TON, APTOS)
amount.chainAddressstringNoChain address (required in dynamic chain settlement mode)
orderInfoobjectYesOrder information
orderInfo.orderTitlestringYesOrder title (displayed to user)
orderInfo.orderDescstringNoOrder description
orderInfo.goodsNamestringNoGoods name
orderInfo.goodsIdstringNoGoods ID
orderInfo.goodsCategorystringYesGoods category (4-digit code, see Appendix.MCC Industry Categories)
sceneInfoobjectNoScene information
sceneInfo.deviceIdstringNoDevice ID
sceneInfo.deviceIpstringNoDevice IP
sceneInfo.locationobjectNoLocation information
sceneInfo.location.latitudestringNoLatitude
sceneInfo.location.longitudestringNoLongitude
sceneInfo.location.addressstringNoDetailed address
notifyUrlstringYesDeduction result webhook URL
riskInfoobjectNoRisk control information
riskInfo.userIpstringNoUser IP address
riskInfo.deviceFingerprintstringNoDevice fingerprint
riskInfo.userAgentstringNoUser agent string

Response Parameters​

ParameterTypeDescription
retCodeintResponse code
retMsgstringResponse message
resultobjectResponse data
result.orderNostringPlatform order number
result.tradeNostringPlatform trade number
result.outTradeNostringMerchant order number
result.statusstringTransaction status: PROCESSING / SUCCESS / FAILED / TIMEOUT
result.amountobjectRequested amount
result.cryptoPaymentobjectActual crypto payment info (for fiat orders)
result.cryptoPayment.currencystringCryptocurrency (e.g., USDT)
result.cryptoPayment.amountstringCryptocurrency amount
result.cryptoPayment.chainstringChain network (e.g., BSC, TRX, ARBI, LTC, SOL, ETH, TON, APTOS)
result.cryptoPayment.exchangeRatestringExchange rate
result.cryptoPayment.rateTimestringRate lock time
result.payTimestringPayment time (on success)
result.failureReasonstringFailure reason (on failure)

Request Examples​

Cryptocurrency Order​

POST /v5/pay/agreement/deduction HTTP/1.1
Host: api.bybit.com
Content-Type: application/json
X-Request-Id: 550e8400-e29b-41d4-a716-446655440000
X-Timestamp: 1736233200000
X-Signature: {signature}
Authorization: Bearer {access_token}

{
"merchantId": "M123456789",
"userId": "U_123456789",
"agreementType": "CYCLE",
"agreementNo": "AGR202601070001",
"outTradeNo": "ORDER20260107001",
"sceneCode": "SUBSCRIPTION",
"amount": {
"total": "2350",
"currency": "USDT",
"currencyType": "CRYPTO",
"chain": "TRC20"
},
"orderInfo": {
"orderTitle": "Monthly subscription - January 2026",
"orderDesc": "Premium membership",
"goodsName": "Premium Plan",
"goodsId": "PREMIUM_001",
"goodsCategory": "7372"
},
"notifyUrl": "https://merchant.com/notify/pay"
}

Fiat Currency Order​

POST /v5/pay/agreement/deduction HTTP/1.1
Host: api.bybit.com
Content-Type: application/json
X-Request-Id: 550e8400-e29b-41d4-a716-446655440000
X-Timestamp: 1736233200000
X-Signature: {signature}
Authorization: Bearer {access_token}

{
"merchantId": "M123456789",
"userId": "U_123456789",
"agreementType": "CYCLE",
"agreementNo": "AGR202601070001",
"outTradeNo": "ORDER20260107002",
"sceneCode": "TAXI",
"amount": {
"total": "10000",
"currency": "USD",
"currencyType": "FIAT"
},
"orderInfo": {
"orderTitle": "Ride fare",
"orderDesc": "Trip from A to B",
"goodsCategory": "4121"
},
"sceneInfo": {
"deviceId": "DEVICE_001",
"deviceIp": "192.168.1.1",
"location": {
"latitude": "39.9042",
"longitude": "116.4074",
"address": "Beijing, China"
}
},
"riskInfo": {
"userIp": "203.0.113.45",
"deviceFingerprint": "fp_abc123xyz"
},
"notifyUrl": "https://merchant.com/notify/pay"
}

Response Examples​

Crypto Order Success​

{
"retCode": 20000,
"retMsg": "Success",
"result": {
"orderNo": "ORD202601070001",
"tradeNo": "PAY202601070001",
"outTradeNo": "ORDER20260107001",
"status": "SUCCESS",
"amount": {
"total": "2350",
"currency": "USDT",
"currencyType": "CRYPTO",
"chain": "TRC20"
},
"payTime": "2026-01-07T10:30:00Z"
}
}

Fiat Order Success (with Crypto Payment)​

{
"retCode": 20000,
"retMsg": "Success",
"result": {
"orderNo": "ORD202601070002",
"tradeNo": "PAY202601070002",
"outTradeNo": "ORDER20260107002",
"status": "SUCCESS",
"amount": {
"total": "10000",
"currency": "USD",
"currencyType": "FIAT"
},
"cryptoPayment": {
"currency": "USDT",
"amount": "10005.50",
"chain": "TRC20",
"exchangeRate": "1.00055",
"rateTime": "2026-01-07T10:29:55Z"
},
"payTime": "2026-01-07T10:30:00Z"
}
}

Processing Status​

{
"retCode": 20000,
"retMsg": "Success",
"result": {
"orderNo": "ORD202601070003",
"tradeNo": "PAY202601070003",
"outTradeNo": "ORDER20260107003",
"status": "PROCESSING",
"amount": {
"total": "5000",
"currency": "USDT",
"currencyType": "CRYPTO",
"chain": "TRC20"
}
}
}

Deduction Failed​

{
"retCode": 20000,
"retMsg": "Success",
"result": {
"orderNo": "ORD202601070004",
"tradeNo": "PAY202601070004",
"outTradeNo": "ORDER20260107004",
"status": "FAILED",
"amount": {
"total": "5000",
"currency": "USDT",
"currencyType": "CRYPTO",
"chain": "TRC20"
},
"failureReason": "BALANCE_NOT_ENOUGH"
}
}

Verification Steps​

Platform performs the following checks before executing deduction:

  1. Agreement Validity: Agreement must be in SIGNED status
  2. Single Limit Check: Amount does not exceed single transaction limit
  3. Period Limit Check: Cumulative amount does not exceed period limit
  4. Balance Check: User account has sufficient balance
  5. Risk Check: Transaction passes risk control rules

Notes​

  1. Idempotency: Same outTradeNo returns result of first request
  2. Async Processing: PROCESSING status requires waiting for webhook or query
  3. Timeout Handling: Set 30-second timeout, query if timeout occurs
  4. Fiat Orders: User pays with cryptocurrency; cryptoPayment shows actual payment details