Get invoice

The Get invoice method returns invoice details for the current reseller or any of its downstream resellers.

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.

GET {base_url}/api/v3/resellers/{reseller_id}/invoices/{invoice_id}

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_idpathintegerRequired

ID of the current reseller or of any its downstream resellers (see Viewing and updating Reseller general information)

invoice_idpathintegerRequiredInvoice ID
includequerystringOptional

Returns additional information about objects related to the invoice. The parameter can be a comma-separated list if information about several objects is required. The following objects and possible values are supported:

ObjectParameter value
Subscriptionssubscriptions
Paymentspayments
Chargescharges
Correctionscorrections
Taxestaxes

Response model

Name

Data type

Description

dataobjectResponse data


id

string

Invoice ID

typestringData type

attributesobjectInvoice information



created_at

stringDate and time of the invoice creation



updated_at

stringDate and time of the invoice update



document_id

stringInvoice number



status

stringInvoice status



total

stringInvoice total



account_id

integerID of the account for which the invoice was issued



from_date

stringStart date of the period covered by the invoice (YYYY-MM-DD)



to_date

stringEnd date of the period covered by the invoice (YYYY-MM-DD)



payment_model

string

Invoice payment model:

  • prepay
  • postpay


approvedboolIndicates whether it is an approved postpaid invoice with external management (see Invoices with external management):
  • true — a postpaid invoice with external management, and a third-party ERP system approved it.
  • false — in all other cases:
    • A postpaid invoice with external management, and a third-party ERP system did not approved it yet.
    • A postpaid invoice managed by the platform.
    • A prepaid invoice.

relationshipsobject

Related objects



subscriptionsobjectList of subscriptions included in the invoice



dataarray

Related object information:

NameData typeDescription
idstringID of the object
typestringData type


paymentsobject

List of payments included in the invoice




dataarray

Related object information:

NameData typeDescription
idstringID of the object
typestringData type


chargesobject

List of charges included in the invoice




dataarray

Related object information:

NameData typeDescription
idstringID of the object
typestringData type


correctionsobject

List of corrections included in the invoice




dataarray

Related object information:

NameData typeDescription
idstringID of the object
typestringData type


taxesobjectList of taxes for charges included in the invoice



dataarray

Related object information:

NameData typeDescription
idstringID of the object
typestringData type
includedarray

Additional information about objects listed in the request:

NameData typeDescription
idintegerID of the object
typestringData type
attributesarrayAttributes of the object (see details below)
NameData typeDescription
idstringID of the subscription
typestringData type
attributesobjectSubscription details

created_atstringDate and time of the subscription creation

updated_atstringDate and time when the subscription was updated

auto_renewalbool

The automatic subscription renewal option:

  • true — The automatic subscription renewal is enabled.
  • false — The automatic subscription renewal is off.

billing_fromstringThe start date of generating charges for the subscription (YYYY-MM-DD)

expiration_datestringThe expiration date of the subscription (YYYY-MM-DD)

namestringName of the subscription 

auto_renew_point_daysinteger

Auto-renew point (in days)


start_datestringThe date of activation of the subscription (YYYY-MM-DD)

statusstring

Status of the subscription (for the list of subscription statuses, see Viewing the list of Resellers Subscriptions)


payment_modelstring

Subscription payment model:

  • prepay
  • postpay

payment_model_parametersobjectPayment model parameters


credit_limitnumberThe value of the subscription debt, above which the postpaid subscription will be stopped. For postpaid subscriptions only (payment_model = postpay)


current_debtnumberThe subscription debt that is calculated as the total amount of all blocked charges for the subscription for the current billing period. For postpaid subscriptions only (payment_model = postpay)
  • For a correction:
NameData typeDescription
idstringID of the correction
typestringData type
attributesobjectСorrection details

created_atstringDate and time of the correction creation

updated_atstringDate and time when the correction was updated

account_idintegerAccount ID

statusstringCorrection status

totalstringCorrection total amount

commentstringAdditional information about the correction

period_fromstringBeginning of the period for which the correction was created

period_tostringEnd of the period for which the correction was created

approved_atstringDate and time of the correction approval

subscription_idintegerID of the subscription for which the correction was applied
  • For every tax used to calculate a charge:

    НазваниеТип данныхОписание
    idstringThe tax ID
    typestringData type
    attributesobjectTax details

    created_atstringDate and time of the tax creation

    updated_atstringDate and time when the tax was updated

    charge_idintegerThe ID of the related charge

    origin_idintegerThe tax ID in the taxation module

    namestringThe tax name

    codestringThe tax code

    ratenumberThe tax rate percentage

    amountstringThe tax amount calculated for net_amount of the charge

Request example

GET /api/v3/resellers/1/invoices/3973?include=subscriptions,payments,charges,corrections,taxes
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json

Response example

{
    "data": {
        "id": "3973",
        "type": "invoices",
        "attributes": {
            "created_at": "2021-03-02T01:12:58.186820+0300",
            "updated_at": "2021-03-02T01:12:58.380559+0300",
            "document_id": "003661",
            "status": "closed",
            "total": "220.0",
            "account_id": 906,
            "from_date": "2021-02-01",
            "to_date": "2021-03-01",
            "payment_model": "prepay",
            "approved": "false"
        },
        "relationships": {
            "subscriptions": {
                "data": [
                    {
                        "id": "3007572",
                        "type": "subscriptions"
                    },
                    {
                        "id": "3007576",
                        "type": "subscriptions"
                    }
                ]
            },
            "payments": {
                "data": []
            },
            "charges": {
                "data": [
                    {
                        "id": "85176",
                        "type": "charges"
                    },
                    {
                        "id": "85229",
                        "type": "charges"
                    }
                ]
            },
            "corrections": {
                "data": []
            },
            "taxes": {
                "data": []
            }
        }
    },
    "included": [
        {
            "id": "3007572",
            "type": "subscriptions",
            "attributes": {
                ...
            }
        },
        {
            "id": "3007576",
            "type": "subscriptions",
            "attributes": {
                ...
            }
        },
        {
            "id": "85176",
            "type": "charges",
            "attributes": {
                ...
            },
            "relationships": {
                ...
            }
        },
        {
            "id": "85229",
            "type": "charges",
            "attributes": {
                ...
            },
            "relationships": {
                ...
            }
        }
    ]
}