Cancel a Reseller's Payment
The Cancel Payment method is used for cancelling a Payment of of the current Reseller or any of its downstream Resellers. Only Payments in the Waiting for payment status that are not linked to postpaid Invoices can be cancelled.
Access to the current Reseller and downstream Resellers is determined by the Manager's token in the API request.
DELETE {base_url}/api/v3/resellers/{reseller_id}/payments/{payment_id}
Arguments
Name | Parameter Type | Data type | Required/ Optional | Description |
---|---|---|---|---|
X-Api-Token | header | string | Required | API token of the Manager that performs the operation (see Viewing and updating manager's information) |
Content-Type | header | string | Required | Indicates the media type (text/html or text/JSON) of the request that is sent to the server by the client (browser) |
Accept | header | string | Required | Information about data types that the client (browser) supports |
reseller_id | path | number | Required | ID of the current Reseller or any of its downstream Resellers (see Viewing and updating reseller general information) |
payment_id | path | number | Required | Payment ID |
Response model
If a Payment is successfully cancelled, the method returns information about the Payment (see Get the Reseller's Payment information by ID without included additional information).
Request example
DELETE/api/v3/resellers/1/payments/6476
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
Response example
If a Payment is successfully cancelled, the method returns information about the Payment.
{
"data": {
"id": "6476",
"type": "payments",
"attributes": {
"created_at": "2019-11-01T06:37:31.737051+0300",
"updated_at": "2019-11-01T07:56:50.551216+0300",
"account_id": 505,
"discount_amount": "0.0",
"total": "199.99",
"comment": "top-up payment",
"status": "cancelled",
"document_id": "2005259",
"expiration_date": null,
"payment_method_id": null,
"requester_ip": null,
"manager_id": null,
"purpose": "",
"payment_method_name": null,
"closed_at": "2019-11-01T07:56:50.520553+0300"
},
"relationships": {
"orders": {
"data": []
},
"invoices": {
"data": []
},
"reseller": {
"data": {
"id": "1",
"type": "resellers"
}
},
"account": {
"data": {
"id": "505",
"type": "accounts"
}
},
"payment_method": {
"data": null
}
}
}
}
For Payments in any status but Waiting for payment, the method returns error 422 with the following description:
{
"errors": {
"title": "Only payments with \"waiting for payment\" status can be cancelled.",
"status": "422"
}
}
For Payments that are linked to postpaid Invoices, the method returns error 422 with the following description:
{
"errors": {
"title": "Only payments for prepaid payment model can be cancelled.",
"status": "422"
}
}