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. Depending on the paid amount compared to the payment amount in the platform and the payment status in the platform, the following situations are possible.
You can also complete a payment by its ID (see Complete payment by ID).
POST {base_url}/api/v3/resellers/{reseller_id}/payments/{document_id}
{
"data": {
"attributes": {
"payment_method_id": "{payment_method_id}",
"amount": {amount},
"currency_code": "{currency_code}",
"external_transaction_id": "{external_transaction_id}"
}
}
}
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 |
The ID of the current reseller or any of its downstream resellers (see
) |
|
document_id |
path |
integer |
Required |
The payment number |
|
payment_method_id |
form |
string |
Required |
|
|
amount |
form |
number |
Optional |
The paid amount which may be not equal to the payment amount in the platform |
|
currency_code |
form |
string |
Optional |
The currency code for paying. Must match the currency code of the payment (see Get payment) |
|
external_transaction_id |
form |
string |
Optional |
The ID of an external transaction related to paying:
The data format: from 2 to 255 characters, Latin letters Aa-Zz, Cyrillic letters Аа-Яя, numbers 0-9, and symbols ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _` { | } ~ (except for space) |
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",
"amount": 123.45,
"currency_code": "USD",
"external_transaction_id": "d2a7e121-8636-42a2-a3cf-d8a5d0131a96"
}
}
}
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",
"amount_paid_from_balance": null,
"initial_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,
"due_date": null,
"payment_method_name": "Check",
"closed_at": "2023-10-26T16:37:43.325470+0300"
},
"relationships": {
"orders": {
"data": []
},
"invoices": {
"data": []
},
"charges": {
"data": []
},
"corrections": {
"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 |
We could not find what you are looking for |
A payment with the specified ) |
|
422 |
PAYMENT-002 |
Required parameter payment_method_id is not found (code: PAYMENT-002). |
Check the payment method ID (see
) |
|
PAYMENT-003 |
Transmitted currency_code does not match the payment currency_code (code: PAYMENT-003). |
|
|
|
PAYMENT-004 |
The payment of the invoice with such external_transaction_id can not be processed again (code: PAYMENT-004). |
Repeat payment with the same the ID of an external transaction is prohibited |
|
|
PAYMENT-005 |
The parameter amount should be in currency format and greater then 0. Example: 123.45 (code: PAYMENT-005). |
Check the paid amount |
|
|
PAYMENT-007 |
External_transaction_id has invalid format (code: PAYMENT-007). |
Check the ID of an external transaction (see the requirements above in the Arguments section) |
Error response example
{
"errors": [
{
"status": "422",
"title": "Unprocessable entity",
"detail": "External_transaction_id has invalid format (code: PAYMENT-007).",
"source": {
"pointer": "/data/attributes/external_transaction_id"
}
}
]
}