本页内容
取消
在客户锁定资产之前取消未完成的账单,了解允许的状态迁移,并处理取消响应。
POST/v1/invoices/:invoice_id/cancel
API 密钥: Payment
取消仍处于 awaiting_client 状态的账单。一旦客户选择了代币/网络、账单进入 awaiting_payment,就无法再取消——已支付或已过期的账单永远不能取消。取消一张已取消的账单是空操作:返回 200 和同一张账单,而不是错误。
请求体
reason 为必填(最长 500 字符)。它会记入审计日志,并随 invoice.cancelled webhook 携带。
{
"reason": "Customer requested cancellation"
}
响应(200 OK)
{
"invoice_id": "inv_5CcyDYmMUGtzYL10q0Iimr",
"project_id": "prj_xFukZuAJZR06pLVBh3uwzv",
"status": "cancelled",
"is_final": true,
"is_test": true,
"payment_url": "https://checkout.paymos.io/invoice/inv_5CcyDYmMUGtzYL10q0Iimr",
"order": {
"external_id": "order-12345",
"client_id": "customer-67890",
"amount": "100.00",
"currency": "USD"
},
"created_at": 1739280600,
"updated_at": 1739280660,
"expires_at": 1739284200
}
错误
完整目录见错误码。每个错误响应中的 type URI 会深链到对应的行。