Get list of end-customer charges

The Get list of end-customer charges method returns the list of end-customers charges of 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 current reseller and downstream resellers accessible within a method.

GET {base_url}/api/v3/resellers/{reseller_id}/charges

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_idpathintegerRequiredID of the current reseller or any of its downstream resellers (see Viewing and updating Reseller general information)
page[size]queryintegerOptionalPage navigation: number of elements per page. The default value is 50
page[number]queryintegerOptionalPage navigation: page number
filter[close_date]querydateOptional

Filtering charges by the close date in the YYYY-MM-DD format. To specify the period, the following filters are used:

  • filter[close_date][gt] — close date is greater than the specified date.
  • filter[close_date][lt] — close date is less than the specified date.

filter[subscription_id]

query

integer

OptionalFiltering charges by the subscription ID

filter[status]

query

string

OptionalFiltering charges by the status (for the list of charge statuses, see Charges attributes)
filter[created_at]

query

string

Optional

Filtering charges by the date and time of the charge creation in the RFC 3339 format (for example, 2019-05-29T15:12:01.558009+03:00 or 2019-05-29). To specify the period, the following filters are used:

  • filter[created_at][gt] — date and time are greater than the specified.
  • filter[created_at][lt] — date and time are less than the specified.
filter[updated_at]

query

string

Optional

Filtering charges by the date and time when the charge was updated in the RFC 3339 format (for example, 2019-05-29T15:12:01.558009+03:00 or 2019-05-29). To specify the period, the following filters are used:

  • filter[updated_at][gt] — date and time are greater than the specified.
  • filter[updated_at][lt] — date and time are less than the specified.
filter[plan_class_ids]

query

string

Optional

Filtering charges by the service term ID (see Viewing the List of Service Terms). Several IDs must be separated by a comma
includequerystringOptional

Returns additional information about objects related to charges. 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

Reseller

reseller

Account

account

Subscription

subscription

Plan

plan

Response model

Name

Data type

Description

dataarrayResponse data


id

integerID of the charge

typestringData type

attributesobjectInformation about the charge


created_atdateDate and time of the charge creation


updated_atdateDate and time when the charge was updated


subscription_idintegerID of the customer's subscription


subscription_resource_idintegerID of the resource in the customer's subscription


quantityintegerThe number of ordered services or resources


operate_from

dateThe start date of the period paid by the charge


durationfloatPeriod of the charge (in months). For example, 1 day = 0.033, 2 years = 24


descriptionstringCharge details description


unit_pricefloatThe unit price of the service or resource in the plan currency


amountfloatTotal amount of the charge (discount included) in the reseller currency


statusstringStatus of the charge (for the list of charge statuses, see Charges attributes)


typestring

Type of the charge (see also Charges attributes)

  • Charge::Setup — a non-recurring charge for service setup.
  • Charge::Recurring — a monthly charge for service usage.
  • Charge::RecurringResource — a monthly charge for resource usage.
  • Charge::Renewal — a non-recurring charge for service renewal.
  • Charge::RenewalResource — a non-recurring charge for resource renewal.
  • Charge::ExternalResource — an accumulative charge based on the consumed resources records.
  • Charge::SetupResource — a non-recurring charge for resource setup.
  • Charge::Transfer — a non-recurring charge for subscription transfer.


net_costfloatThe net cost of the charge in the plan currency for the selected reseller. For delegated plans only. Calculated using the price of the upstream reseller


taxes_amountfloatThe amount of taxes for the charge in the reseller currency


subscription_resource_namestringName of the resource in the customer's subscription


plan_resource_idintegerName of the resource in the customer's plan


resource_idintegerID of the resource


order_idintegerID of the order


operate_todateThe finish date of the period paid by the charge


close_datedate

The close date of the charge



billing_datedateStart date of the related billing period


application_template_keystringKey of the application template linked to the subscription (see Viewing Application Template details)


additional_paramsarray of objects

Additional parameters of the charge for services based on the following plugins:

  • Manual Provisioning Plugin:

    NameData typeDescription
    tenant_namestringPrimary name of the account ordered the subscription (see Get account)
    tenant_idstringID of the account ordered the subscription
    order_idstringID of the sales order linked to the subscription
    subscription_idstringSubscription ID
    offer_idstringSKU of the Plan linked to the subscription (see Get plan)
  • Office365:

    NameData typeDescription
    tenant_namestringTenant name (domain) in Microsoft Partner Center
    tenant_idstringTenant ID in Microsoft Partner Center
    order_idstringOrder ID on the Microsoft side
    subscription_idstringSubscription ID on the Microsoft side
    offer_idstringPlan SKU or Addon SKU in Microsoft Partner Center
  • Vendor Service Plugin (VSP):

    NameData typeDescription
    external_idstringApplication External ID
    plan_skustringPlan SKU
    subscription_attributesobjectSubscription attributes created in Vendor Portal (the password attribute excluded)
    resource_keystringApplication Resource Key

In other cases, returns the empty array




discountfloatThe amount of the discount for the charge in the reseller currency


original_amountstring

Charge total amount in the plan currency



original_amount_currencystringCurrency code of the plan


currency_ratestringExchange rate used for generating the charge 


currency_unitintegerCurrency units used for generating the charge 

relationshipsobjectRelated objects


taxesobjectTaxes information



dataarray

Related object information:

NameData typeDescription
idintegerID of the object
typestringData type


resellerobjectReseller information



dataobject

Related object information:

NameData typeDescription
idintegerID of the object
typestringData type


accountobjectAccount information



dataobject

Related object information:

NameData typeDescription
idintegerID of the object
typestringData type


subscriptionobjectSubscription information



dataobject

Related object information:

NameData typeDescription
idintegerID of the object
typestringData type


planobjectPlan information



dataobject

Related object information:

NameData typeDescription
idintegerID of the object
typestringData type


plan_resourceobjectPlan resource information



dataobject

Related object information:

NameData typeDescription
idintegerID of the object
typestringData type


discountobjectDiscount information



dataobject

Related object information:

NameData typeDescription
idintegerID of the object
typestringData type
includedarray

Additional information about objects listed in the request:

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

created_atdateDate and time of the subscription creation

updated_atdateDate 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_fromdateThe start date of generating charges for the subscription 

expiration_datedateThe expiration date of the subscription 

namestringName of the subscription 

auto_renew_point_daysinteger

Auto-renew point (in days)


start_datedateThe date of activation of the subscription 

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_limitfloatThe value of the subscription debt, above which the postpaid subscription will be stopped. For postpaid subscriptions only (payment_model = postpay)


current_debtfloatThe 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 plan, see the data model in Get plan.
linksarrayPage navigation links that use the defined page navigation parameters

selfstringCurrent page link

firststringFirst page link

prevstringPrevious page link

nextstringNext page link

laststringLast page link
metaarrayAdditional information about the charge

currencystringReseller's currency code

Request example

GET /api/v3/resellers/1/charges?page[size]=2&page[number]=70&filter[close_date][gte]=2019-10-01&filter[close_date][lte]=2019-10-31&filter[status]=closed&filter[plan_class_ids]=1,5&include=reseller,account,subscription,plan
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json

Response example

{
    "data": [
        {
            "id": "73083",
            "type": "charges",
            "attributes": {
                "created_at": "2019-08-21T11:50:21.263342+0300",
                "updated_at": "2019-11-16T01:18:26.253966+0300",
                "subscription_id": 3005638,
                "subscription_resource_id": 30146,
                "quantity": 1,
                "operate_from": "2019-09-01",
                "duration": 0.667,
                "description": "Upgrade resource (recurring fee) \"res3\" for subscription #3005638 \"Auto provisioning with resources\"",
                "unit_price": "2.0",
                "amount": "1.27",
                "status": "closed",
                "type": "Charge::Recurring",
                "net_cost": null,
                "taxes_amount": 0,
                "subscription_resource_name": "res3",
                "plan_resource_id": 2158,
                "resource_id": 10,
                "order_id": 8025,
                "operate_to": "2019-09-20",
                "close_date": "2019-09-30",
				"billing_date": "2019-09-01",
				"application_template_key": "",
                "additional_params": [],
                "discount": "0.06",
                "original_amount": "1.27",
                "original_amount_currency": "BYN",
                "currency_rate": "1.0",
                "currency_unit": 1
            },
            "relationships": {
                "taxes": {
                    "data": []
                },
                "reseller": {
                    "data": {
                        "id": "1",
                        "type": "resellers"
                    }
                },
                "account": {
                    "data": {
                        "id": "494",
                        "type": "accounts"
                    }
                },
                "subscription": {
                    "data": {
                        "id": "3005638",
                        "type": "subscriptions"
                    }
                },
                "plan": {
                    "data": {
                        "id": "5",
                        "type": "plans"
                    }
                },
                "plan_resource": {
                    "data": null
                },
                "discount": {
                    "data": {
                        "id": "89",
                        "type": "discounts"
                    }
                }
            }
        },
        {
            "id": "73109",
            "type": "charges",
            "attributes": {
                "created_at": "2019-08-22T15:59:54.376771+0300",
                "updated_at": "2019-10-12T01:15:30.459665+0300",
                "subscription_id": 3005649,
                "subscription_resource_id": null,
                "quantity": 1,
                "operate_from": "2019-09-01",
                "duration": 1,
                "description": "Switch resource (recurring fee) #3005649 \"Auto provisioning with resources\"",
                "unit_price": "1.0",
                "amount": "1.0",
                "status": "closed",
                "type": "Charge::Recurring",
                "net_cost": null,
                "taxes_amount": 0,
                "subscription_resource_name": null,
                "plan_resource_id": null,
                "resource_id": null,
                "order_id": 8036,
                "operate_to": "2019-09-30",
                "close_date": "2019-09-30",
				"billing_date": "2019-09-01",
				"application_template_key": "",
                "additional_params": [],
                "discount": "0.00",
                "original_amount": "1.0",
                "original_amount_currency": "BYN",
                "currency_rate": "1.0",
                "currency_unit": 1
            },
            "relationships": {
                "taxes": {
                    "data": []
                },
                "reseller": {
                    "data": {
                        "id": "1",
                        "type": "resellers"
                    }
                },
                "account": {
                    "data": {
                        "id": "503",
                        "type": "accounts"
                    }
                },
                "subscription": {
                    "data": {
                        "id": "3005649",
                        "type": "subscriptions"
                    }
                },
                "plan": {
                    "data": {
                        "id": "5",
                        "type": "plans"
                    }
                },
                "plan_resource": {
                    "data": null
                },
                "discount": {
                    "data": null
                }
            }
        }
    ],
    "included": [
        {
            "id": "1",
            "type": "resellers",
            "attributes": {...
            }
        },
        {
            "id": "494",
            "type": "accounts",
            "attributes": {...
            },
            "relationships": {...
            }
        },
        {
            "id": "3005638",
            "type": "subscriptions",
            "attributes": {
                "created_at": "2019-08-21T11:50:21.083490+0300",
                "updated_at": "2019-11-16T01:18:26.153891+0300",
                "auto_renewal": false,
                "billing_from": "2019-08-21",
                "expiration_date": "2019-09-21",
                "name": "Auto provisioning with resources",
                "auto_renew_point_days": 1,
                "start_date": "2019-08-21",
                "status": "deleted",
                "payment_model": "postpay",
                "payment_model_parameters": {
                    "credit_limit": 100,
                    "current_debt": 0
                }
            }
        },
        {
            "id": "5",
            "type": "plans",
            "attributes": {...
            }
        },
        {
            "id": "503",
            "type": "accounts",
            "attributes": {...
            },
            "relationships": {...
            }
        },
        {
            "id": "3005649",
            "type": "subscriptions",
            "attributes": {
                "created_at": "2019-08-22T15:59:54.138703+0300",
                "updated_at": "2019-09-20T10:47:07.896382+0300",
                "auto_renewal": false,
                "billing_from": "2019-08-22",
                "expiration_date": "2019-12-22",
                "name": "Auto provisioning with resources",
                "auto_renew_point_days": 1,
                "start_date": "2019-08-22",
                "status": "waiting_for_manual_approve",
                "payment_model": "postpay",
                "payment_model_parameters": {
                    "credit_limit": 0,
                    "current_debt": 0
                }
            }
        }
    ],
    "links": {
        "self": "https://test.activeplatform.com/api/v3/resellers/1/charges?filter%5Bclose_date%5D%5Bgte%5D=2019-10-01&filter%5Bclose_date%5D%5Blte%5D=2019-10-31&filter%5Bplan_class_ids%5D=1%2C5&filter%5Bstatus%5D=closed&include=reseller%2Caccount%2Csubscription%2Cplan&page%5Bnumber%5D=70&page%5Bsize%5D=2",
        "first": "https://test.activeplatform.com/api/v3/resellers/1/charges?filter%5Bclose_date%5D%5Bgte%5D=2019-10-01&filter%5Bclose_date%5D%5Blte%5D=2019-10-31&filter%5Bplan_class_ids%5D=1%2C5&filter%5Bstatus%5D=closed&include=reseller%2Caccount%2Csubscription%2Cplan&page%5Bnumber%5D=1&page%5Bsize%5D=2",
        "prev": "https://test.activeplatform.com/api/v3/resellers/1/charges?filter%5Bclose_date%5D%5Bgte%5D=2019-10-01&filter%5Bclose_date%5D%5Blte%5D=2019-10-31&filter%5Bplan_class_ids%5D=1%2C5&filter%5Bstatus%5D=closed&include=reseller%2Caccount%2Csubscription%2Cplan&page%5Bnumber%5D=69&page%5Bsize%5D=2",
        "next": "https://test.activeplatform.com/api/v3/resellers/1/charges?filter%5Bclose_date%5D%5Bgte%5D=2019-10-01&filter%5Bclose_date%5D%5Blte%5D=2019-10-31&filter%5Bplan_class_ids%5D=1%2C5&filter%5Bstatus%5D=closed&include=reseller%2Caccount%2Csubscription%2Cplan&page%5Bnumber%5D=71&page%5Bsize%5D=2",
        "last": "https://test.activeplatform.com/api/v3/resellers/1/charges?filter%5Bclose_date%5D%5Bgte%5D=2019-10-01&filter%5Bclose_date%5D%5Blte%5D=2019-10-31&filter%5Bplan_class_ids%5D=1%2C5&filter%5Bstatus%5D=closed&include=reseller%2Caccount%2Csubscription%2Cplan&page%5Bnumber%5D=79&page%5Bsize%5D=2"
    },
    "meta": {
        "currency": "BYN"
    }
}

Отзыв | Feedback