Revoke invoice approval by ID
The Revoke invoice approval by ID method is used to revoke approval of a postpaid invoice managed by a third-party ERP system by its ID in the platform. Revoking approval returns the invoice, payment, and linked subscriptions to their original state, removes the third-party invoice information, and makes approval available for the invoice again (see Approve invoice by ID).
Optionally, a manager can revoke approval of an invoice for the Postpay model manually in the Operator Control Panel (see Revoking approval for an invoice managed by a third-party ERP system).
Revoking approval for an invoice is not available if the linked payment is completed or cancelled.
The platform matches a third-party invoice and invoice for the Postpay model using the start date of the billing period (billing_date
).
An API token of a manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating manager's information.
The manager's API token specified in an API request determines:
- The role and access level of the manager, which determine the availability of a method.
- The current reseller and downstream resellers accessible within a method.
POST {base_url}/api/v3/resellers/{reseller_id}/invoices/{invoice_id}/revoke
Arguments
Name | Parameter Type | Data type | Required/Optional | Description | |
---|---|---|---|---|---|
X-Api-Token | header | string | Required | API token of a manager that performs the operation (see Viewing and updating manager's information) | |
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) | |
invoice_id | path | number | Required | ID of the invoice in the platform | |
document_id | form | string | Required | Third-party invoice name as it was specified upon approval (see Approve invoice by ID) | |
billing_date | form | string | Required | Billing day (YYYY-MM-DD) — the start date of a billing period linked to the invoice |
Response model
The response model is similar to Get invoice.
Errors
Status | Error code | Error text | Comment |
---|---|---|---|
400 | INVOICE-0001 | Required parameters are not provided | Specify all required parameters in the request |
INVOICE-0005 | Incorrect specified billing date for the invoice | The specified billing day billing_date does not match the specified invoice in the platform | |
INVOICE-0006 | Incorrect specified document_id for the invoice | The specified third-party invoice name document_id does not match the specified invoice in the platform | |
INVOICE-0019 | Payment related to this invoice has been completed. Invoice approval revoking is not possible | Revoking approval for an invoice is not available if the linked payment is completed or cancelled | |
INVOICE-0020 | Payment related to this invoice has been cancelled. Invoice approval revoking is not possible | ||
INVOICE-0021 | Only postpaid invoice can be revoked | The possible reason:
| |
INVOICE-0022 | Only closed approved invoice can be revoked | The invoice has not been approved yet so approval revoke is not available |
Request example
POST /api/v3/resellers/1/invoices/2046/revoke
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
"document_id": "NS2000015",
"billing_date": "2020-04-01"
}
Response example
{
"data": {
"id": "2046",
"type": "invoices",
"attributes": {
"created_at": "2019-04-18T09:02:01.257560+0300",
"updated_at": "2019-05-02T06:12:41.990713+0300",
"document_id": "003661",
"status": "closed",
"total": "987.65",
"account_id": 505,
"from_date": "2019-04-17",
"to_date": "2019-05-01",
"payment_model": "postpay",
"approved": "false"
},
"relationships": {
"subscriptions": {
"data": [
{
"id": "3009839",
"type": "subscriptions"
}
]
},
"payments": {
"data": [
{
"id": "12201",
"type": "payments"
}
]
},
"charges": {
"data": [
{
"id": "323740",
"type": "charges"
}
]
},
"corrections": {
"data": []
}
}
}
}