Complete postpaid invoice

The Complete postpaid invoice method is used for approving the payment linked to an approved postpaid invoice (see Approve postpaid invoice) with a third-party invoice issued to an account of the reseller by a third-party ERP system (see Managing invoices for the Postpay model by a third-party ERP system).

For accounts with several invoices within the same billing period, use another API method and specify the ID of the required invoice — see Complete postpaid invoice by ID.

The platform matches a third-party invoice and invoice for the Postpay model using the start date of the billing period. 

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 current reseller and downstream resellers accessible within a method.

POST {base_url}/api/v3/resellers/{reseller_id}/accounts/{account_id}/complete_invoices

Arguments

Name

Parameter Type

Data type

Required/Optional

Description

X-Api-TokenheaderstringRequiredAPI token of a manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredMedia type of the request. Specify the following: application/vnd.api+json
AcceptheaderstringRequired

Supported media types of the answer. Specify the following: application/vnd.api+json

base_urlpathstringRequiredActivePlatform URL
reseller_idpathnumberRequiredID of the current reseller or any of its downstream resellers (see Viewing and updating reseller general information)
account_idpathnumberRequiredAccount ID
document_idformstringRequiredThird-party invoice name
billing_dateformstringRequiredStart date (YYYY-MM-DD) of the billing period for which the invoice is issued (calculated, not stored in the platform)

Response model

Name

Data type

Description

dataobjectResponse data


id

string

Invoice ID in the platform

typestringData type

attributesobjectPostpaid invoice information


created_at

string

Date and time of invoice creation


updated_at

string

Data and time of invoice last update


document_id

stringInvoice number


status

stringInvoice status


total

floatInvoice total


account_id

integerID of the account for which the invoice was issued


from_date

dateStart date of the period covered by the invoice


to_date

dateEnd date of the period covered by the invoice


payment_model

string

Invoice payment model: postpay

Errors

StatusError codeError textComment
400INVOICE-0001Required parameters are not providedSpecify all required parameters in the request
404INVOICE-0002Invoice for billing date {billing_date} was not found for account id {account_id}
  • The account does not have an invoice for the specified start date of the billing period.
  • An invoice for the specified start date of the billing period has the total amount equal to 0. A payment for the invoice cannot be approved because the invoice does not have information about the linked subscriptions.
422INVOICE-0004Unable to complete invoice one more timeThe invoice is already completed

Request example

POST /api/v3/resellers/1/accounts/505/complete_invoices
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": "NS2000015",
            "status": "closed",
            "total": "0.32",
            "account_id": 505,
            "from_date": "2019-04-17",
            "to_date": "2019-05-01",
            "payment_model": "postpay"
        }
    }
}