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
Authentication
This endpoint requires a JWT access token. Specify the token in the Authorization header using the Bearer authentication scheme:
Authorization: Bearer <JWT_ACCESS_TOKEN>
In Postman, select Bearer Token on the Authorization tab and enter the JWT access token.
Arguments
|
Name |
Parameter Type |
Data type |
Required/ Optional |
Description |
||
|---|---|---|---|---|---|---|
|
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 |
|
|
|
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 |
|
|
|
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 |
|||
|
|
|
period_from |
string |
The start date of a period for which the correction is applied (YYYY-MM-DD) if |
|||
|
|
|
period_to |
string |
The finish date of a period for which the correction is applied (YYYY-MM-DD) if |
|||
|
|
|
сomment |
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
Authorization: Bearer <JWT_ACCESS_TOKEN>
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
{
"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
}
}
}