Create correction

The Create correction method is used for generating a correction for the specified account and including it in an invoice. 1C can use this method to automate the accounting of payments cancelled in the platform or paid from the account balance (see also Update correction status). A correction can be generated 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.

POST {base_url}/api/v3/resellers/{reseller_id}/corrections
{
    "data": {
        "attributes": {
            "account_id" : {account_id},
            "included_invoice" : {included_invoice},
            "subscription_id" : {subscription_id},
            "period_from" : "{period_from}",
            "period_to" : "{period_to}",
            "total" : "{total}",
            "comment" : "{comment}"
        }
    }
}

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)
dataformobjectRequiredInformation about the attributes of the operation

attributesformobjectRequiredAttributes of the operation


account_idformintegerRequiredID of an account for which the correction is applied


included_invoiceformboolRequired

Indicates whether the correction should be included in an invoice:

  • true — the correction should be included in an invoice.
  • false — the correction should not be included in an invoice.


subscription_idformintegerOptionalID of a subscription for which the correction is applied. Required if included_invoice = true


period_fromformstringOptional

The start date of a period for which the correction is applied (YYYY-MM-DD). Required if included_invoice = true

This period is used only to inform an account and does not affect how an invoice is selected for the correction. A correction is always included in an invoice linked to the billing period in which a manager approved it.



period_toformstringOptionalThe finish date of a period for which the correction is applied (YYYY-MM-DD). Required if included_invoice = true


totalformstringRequired

Correction amount:

  • For a postpaid subscription, a positive correction amount increases the current debt for the subscription, while a negative correction amount decreases it.
  • Otherwise, a positive correction amount increases the account balance, while a negative correction amount decreases it.


commentformstringOptionalComment by the manager

Response model

If no errors are encountered, the method returns data as the information about the created correction with the 201 Created status.

Name

Data type

Description

dataobjectResponse data


id

string

Correction ID

typestringData type

attributesobjectCorrection information



created_at

stringDate and time of the correction creation



updated_at

stringDate and time of the correction update



account_id

integerID of an account for which the correction is applied


manager_idintegerID of a manager who created the correction


status

stringCurrent status of the correction:
  • approval_required — the correction is created but not processed.
  • approved — the correction is approved.
  • declined — the correction is declined.


total

stringCorrection amount


included_invoicebool

Indicates whether the correction should be included in an invoice:

  • true — the correction should be included in an invoice.
  • false — the correction should not be included in an invoice.


subscription_idintegerID of a subscription for which the correction is applied if included_invoice = true



period_from

stringThe start date of a period for which the correction is applied (YYYY-MM-DD) if included_invoice = true



period_to

stringThe finish date of a period for which the correction is applied (YYYY-MM-DD) if included_invoice = true



stringComment by the manager


approved_at

stringDate of the correction approval (YYYY-MM-DD)

Request example

POST /api/v3/resellers/1/corrections
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
    "data": {
        "attributes": {
            "account_id" : 710,
            "included_invoice" : true,
            "subscription_id" : 3008954,
            "period_from" : "2021-12-01",
            "period_to" : "2021-12-31",
            "total" : "100.25",
            "comment" : "top-up payment"
        }
    }
}

Response example

{
    "data": {
        "id": "738",
        "type": "corrections",
        "attributes": {
            "created_at": "2021-08-10T12:18:42.721974+0300",
            "updated_at": "2021-08-10T12:18:42.721974+0300",
            "account_id": 710,
            "manager_id": 225,
            "status": "approval_required",
            "total": "100.25",
            "included_invoice": true,
            "subscription_id": 3008954,
            "period_from": "2021-12-01",
            "period_to": "2021-12-31",
            "comment": "top-up payment",
            "approved_at": null
        }
    }
}