Complete payment by document ID
The Complete payment by document ID method is used for completing a payment by its number document_id
for the current reseller or any of its downstream resellers, for example, when it was paid in a third-party system. Only payments in the Waiting for payment and Expired statuses can be completed.
You can also complete a payment by its ID (see Complete payment by ID).
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}/payments/{document_id}
{
"data": {
"attributes": {
"payment_method_id": "{payment_method_id}",
"total": {total},
"currency_code": "{currency_code}"
}
}
}
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 | The ID of the current reseller or any of its downstream resellers (see Viewing and updating reseller general information) |
document_id | path | integer | Required | The payment number |
payment_method_id | form | integer | Required | The ID of the payment method to complete the payment (see Viewing the list of payment methods) |
total | form | number | Optional | The payment amount |
currency_code | form | string | Optional | The currency code. Must match the currency code of the payment (see Get payment) |
Response model
If no errors are encountered, the method returns information about the completed payment (see Get payment without the included
parameter).
Request example
POST /api/v3/resellers/1/payments/2005258
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
"data": {
"attributes": {
"payment_method_id": "2",
"total": 123.45,
"currency_code": "USD"
}
}
}
Response example
{
"data": {
"id": "3212",
"type": "payments",
"attributes": {
"created_at": "2023-10-26T16:37:31.534421+0300",
"updated_at": "2023-10-26T16:37:43.325470+0300",
"account_id": 478,
"discount_amount": "0.0",
"total": "123.45",
"currency_code": "USD",
"comment": "1",
"status": "completed",
"document_id": "2005258",
"expiration_date": null,
"payment_method_id": 2,
"requester_ip": "10.11.12.13",
"manager_id": 6,
"purpose": "",
"external_total": null,
"external_currency": null,
"payment_method_name": "Check",
"closed_at": "2023-10-26T16:37:43.325470+0300"
},
"relationships": {
"orders": {
"data": []
},
"invoices": {
"data": []
},
"charges": {
"data": []
},
"reseller": {
"data": {
"id": "1",
"type": "resellers"
}
},
"account": {
"data": {
"id": "478",
"type": "accounts"
}
},
"payment_method": {
"data": {
"id": "2",
"type": "payment_methods"
}
}
}
}
}
Errors
Status | Error code | Error text | Comment |
---|---|---|---|
404 | PAYMENT-001 | Required parameter document_id is not found | Check the payment number (see Get payment) |
PAYMENT-002 | Required parameter payment_method_id is not found | Check the payment method ID (see Просмотр списка способов оплаты) | |
PAYMENT-003 | Transmitted currency_code does not match the payment currency_code | Check the payment currency code (see Get payment) | |
422 | - | Only payments with \"waiting for payment/expired\" status can be completed | This payment cannot be completed because its status is not Waiting for payment or Expired. |