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.
|
Paid amount |
Payment status |
|
|---|---|---|
|
Waiting for payment, Expired |
Pending billing, Completed, Paid from balance, Cancelled |
|
|
Equals the payment amount in the platform (full payment) |
|
|
|
Greater than the payment amount in the platform (overpayment) |
|
|
|
Less than the payment amount in the platform (partial payment) |
|
|
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}}
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 |
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 |
string |
Required |
The ID of the payment method to complete the payment (see Viewing the list of payment methods) |
|
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
Authorization: Bearer <JWT_ACCESS_TOKEN>
Accept: application/vnd.api+json
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 Viewing the list of payment methods) |
|
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"
}
}
]
}