Complete a Reseller's Payment
The Complete the Payment method is used for completing a Payment of the current Reseller or any of its downstream Resellers paid in a third-party system. Only Payments in the Waiting for payment and Expired statuses can be completed.
The Manager's API token specified in an API request determines the current Reseller and downstream Resellers accessible within a method.
PATCH {base_url}/api/v3/resellers/{reseller_id}/payments/{payment_id}
{
"data":
{
"attributes":
{
"payment_method_id": {payment_method_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 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 | number | Required | ID of the current Reseller or any of its downstream Resellers (see Viewing and updating reseller general information) |
payment_id | path | number | Required | Payment ID |
payment_method_id | form | number | Required | ID of the Payment Method to complete the Payment (see Viewing the list of payment methods) |
Response model
If a Payment is successfully completed, the method returns information about the Payment (see Get the Reseller's Payment information by ID without included additional information).
Request example
PATCH /api/v3/resellers/1/payments/6475
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
}
}
}
Response example
If a Payment is successfully completed, the method returns information about the Payment.
{
"data": {
"id": "6465",
"type": "payments",
"attributes": {
"created_at": "2019-10-21T07:02:54.651997+0300",
"updated_at": "2019-10-21T07:03:00.230411+0300",
"account_id": 502,
"discount_amount": "0.0",
"total": "360.0",
"comment": "Payment for order 8128",
"status": "completed",
"document_id": "2005248",
"expiration_date": null,
"payment_method_id": 2,
"requester_ip": "10.0.0.203",
"manager_id": null,
"purpose": "",
"payment_method_name": "Cash",
"closed_at": "2019-10-21T07:03:00.230411+0300"
},
"relationships": {
"orders": {
"data": [
{
"id": "8128",
"type": "change_orders"
}
]
},
"invoices": {
"data": []
},
"reseller": {
"data": {
"id": "1",
"type": "resellers"
}
},
"account": {
"data": {
"id": "502",
"type": "accounts"
}
},
"payment_method": {
"data": {
"id": "2",
"type": "payment_methods"
}
}
}
},
"included": [
{
"id": "8128",
"type": "change_orders",
"attributes": {
"created_at": "2019-10-21T07:02:54.273531+0300",
"updated_at": "2019-10-21T07:03:00.465342+0300",
"account_id": 502,
"total": "360.0",
"payment_id": 6465,
"status": "completed",
"type": "ChangeOrder",
"expiration_date": "2019-10-28",
"owner_id": 864,
"promo_code": null,
"document_id": "CO001022",
"requester_ip": "10.0.0.203",
"manager_id": 214,
"custom_price": false,
"net_cost": null,
"discount_amount": "0.0",
"payment_model": "prepay",
"closed_at": "2019-10-21T07:03:00.465342+0300"
}
},
{
"id": "502",
"type": "accounts",
"attributes": {
"created_at": "2019-08-22T15:11:47.339+03:00",
"updated_at": "2019-10-21T07:03:00.217+03:00",
"reseller_id": 1,
"name": "Vit Ada",
"account_class_id": 1601,
"primary_name": "DepV0304-4",
"first_name": "Vit",
"middle_name": "",
"last_name": "Ada",
"country": "TW",
"region": "MSK",
"city": "Moscow",
"street": "Yamskaya",
"building": "",
"office": "",
"zip": "119002",
"phone": "+74950000001",
"email": "test@example.com",
"status": "active",
"balance": "1293.12",
"usable_balance": "770.45",
"current_debt": 99.26,
"subscription_credit_limit": 100.0,
"financial_blocking_threshold": 100.0,
"account_type_id": 1564,
"manager_id": null,
"owner_id": 864,
"tech_user_id": 864,
"bill_user_id": 864,
"custom_attributes": {},
"manager": null,
"default_payment_model": "postpay",
"account_type": {
"id": 1564,
"name": "Физическое лицо",
"created_at": "2017-03-20T16:34:28.163+03:00",
"updated_at": "2017-03-20T16:34:28.163+03:00",
"reseller_id": 1,
"name_pattern": "%first_name %middle_name %last_name",
"primary_name": "",
"key": "personal",
"default_payment_method_id": null,
"ancestry": "1562",
"use_by_default": false
},
"account_class": {
"id": 1601,
"reseller_id": 1,
"name": "543535",
"created_at": "2018-07-23T17:41:37.677+03:00",
"updated_at": "2019-10-27T10:58:37.566+03:00",
"financial_blocking_threshold": "100.0",
"due_order_period": 7,
"subzero_period": -1,
"stop_subscription_type": "automatically",
"key": "3535535353",
"color": "grey",
"guaranteed_payment_limit": 1000,
"guaranteed_payment_period": 7,
"delete_subscription_type": "automatically",
"denominated": false,
"buy_with_negative_balance": false,
"receipt_day": null,
"payment_model": "postpay",
"default": false,
"due_payment_period": 6,
"subscription_credit_limit": "100.0"
}
},
"relationships": {
"subscriptions": {
"data": [
{
"id": "3005710",
"type": "subscriptions"
},
{
"id": "3005731",
"type": "subscriptions"
},
{
"id": "3005648",
"type": "subscriptions"
}
]
}
}
},
{
"id": "2",
"type": "payment_methods",
"attributes": {
"created_at": "2016-08-25T09:26:12.947229+0300",
"updated_at": "2017-10-03T11:20:32.446864+0300",
"name": "Cash",
"description": "",
"enabled": true,
"plugin_id": "check_cash"
}
}
]
}
In case of error, the method returns the error description. For example, for error 422:
{
"errors": {
"title": "Only payments with \"waiting for payment/expired\" status can be completed.",
"status": "422"
}
}