{"openapi":"3.1.0","info":{"title":"TrustBill Merchant API","version":"1.0.0","description":"Create and query cryptocurrency payment orders. Merchant authentication uses the X-API-KEY header."},"servers":[{"url":"https://docs.trustbill.net","description":"Production"}],"tags":[{"name":"Payment Orders"}],"components":{"securitySchemes":{"MerchantApiKey":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"PaymentOrderCreate":{"type":"object","required":["asset","amount"],"properties":{"externalId":{"type":"string","maxLength":200,"examples":["INV-10025"]},"asset":{"type":"string","enum":["BTC","ETH","USDT-ERC20","BNB","POLYGON","TRX","USDT-TRC20"]},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","examples":["10.00"]},"expiresInMinutes":{"type":"integer","minimum":1,"maximum":10080,"examples":[60]},"metadata":{"type":"object","additionalProperties":true}}},"PaymentOrder":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"externalId":{"type":["string","null"]},"status":{"type":"string","enum":["PENDING","PARTIALLY_PAID","PAID","OVERPAID","EXPIRED","CANCELLED","FAILED"]},"asset":{"type":"string"},"network":{"type":"string"},"amount":{"type":"string"},"paidAmount":{"type":"string"},"address":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}},"ApiError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/api/v1/payment-orders":{"post":{"tags":["Payment Orders"],"summary":"Create a payment order","security":[{"MerchantApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentOrderCreate"}}}},"responses":{"201":{"description":"Payment order created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentOrder"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Invalid API key"}}}},"/api/v1/payment-orders/by-external-id/{externalId}":{"get":{"summary":"Retrieve a payment order by external ID","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"externalId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":200}}],"responses":{"200":{"description":"Payment order retrieved"},"400":{"description":"Invalid external ID"},"404":{"description":"Payment order not found"}}}},"/api/v1/payment-orders/{id}":{"get":{"tags":["Payment Orders"],"summary":"Get a payment order","security":[{"MerchantApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Payment order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentOrder"}}}},"404":{"description":"Not found"}}}},"/api/v1/payment-orders/{id}/status":{"get":{"tags":["Payment Orders"],"summary":"Get payment status","security":[{"MerchantApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Current payment status"},"404":{"description":"Not found"}}}}}}