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.

POST {base_url}/api/v3/resellers/{reseller_id}/corrections
JSON
{
    "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-Token

header

string

Required

API token of a manager that performs the operation (see


)

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

integer

Required

ID of the current reseller or any of its downstream resellers (see 


)

data

form

object

Required

Information about the attributes of the operation


attributes

form

object

Required

Attributes of the operation



account_id

form

integer

Required

ID of an account for which the correction is applied



included_invoice

form

bool

Required

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_id

form

integer

Optional

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



period_from

form

string

Optional

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_to

form

string

Optional

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



total

form

string

Required

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.



comment

form

string

Optional

Comment 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

data

object

Response data


id

string

Correction ID


type

string

Data type


attributes

object

Correction information



created_at

string

Date and time of the correction creation



updated_at

string

Date and time of the correction update



account_id

integer

ID of an account for which the correction is applied



manager_id

integer

ID of a manager who created the correction



status

string

Current status of the correction:

  • approval_required — the correction is created but not processed.

  • approved — the correction is approved.

  • declined — the correction is declined.



total

string

Correction amount



included_invoice

bool

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_id

integer

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



period_from

string

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



period_to

string

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



сomment

string

Comment by the manager



approved_at

string

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

Request example

XML
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
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

JSON
{
    "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
        }
    }
}