The Cancel payment method is used for cancelling a payment 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.
DELETE {{base_url}}/api/v3/resellers/{{reseller_id}}/payments/{{payment_id}}
Authentication
This endpoint requires a JWT access token. Specify the token in the Authorization header using the Bearer authentication scheme:
Authorization: Bearer <JWT_ACCESS_TOKEN>
In Postman, select Bearer Token on the Authorization tab and enter the JWT access token.
Arguments
|
Name |
Parameter Type |
Data type |
Required/ Optional |
Description |
|---|---|---|---|---|
|
Content-Type |
header |
string |
Required |
Media type of the request. Specify the following: application/vnd.api+json |
|
Accept |
header |
string |
Required |
Supported media types of the answer. Specify the following: application/vnd.api+json |
|
base_url |
path |
string |
Required |
ActivePlatform URL |
|
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 no errors are encountered, the method returns information about the cancelled payment (see Get payment without the included parameter).
Request example
DELETE/api/v3/resellers/1/payments/6476
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
Authorization: Bearer <JWT_ACCESS_TOKEN>
Accept: application/vnd.api+json
Response example
{
"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",
"amount_paid_from_balance": null,
"initial_total": "199.99",
"currency_code": "USD",
"comment": "top-up payment",
"status": "cancelled",
"document_id": "2005259",
"expiration_date": null,
"payment_method_id": null,
"requester_ip": null,
"manager_id": null,
"purpose": "",
"external_total": null,
"external_currency": null,
"due_date": null,
"payment_method_name": null,
"closed_at": "2019-11-01T07:56:50.520553+0300"
},
"relationships": {
"orders": {
"data": []
},
"invoices": {
"data": []
},
"corrections": {
"data": []
},
"reseller": {
"data": {
"id": "1",
"type": "resellers"
}
},
"account": {
"data": {
"id": "505",
"type": "accounts"
}
},
"payment_method": {
"data": null
}
}
}
}
Errors
For payments in any status except 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"
}
}