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-Token | header | string | Required | API token of a manager that performs the operation (see Viewing and updating manager's information) | |||||
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 Viewing and updating reseller general information) | |||||
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:
| |||||
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 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:
| |||||
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:
| |||||
total | string | Correction amount | |||||
included_invoice | bool | Indicates whether the correction should 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 | |||||
string | Comment by the manager | ||||||
approved_at | string | Date 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
}
}
}