Complete payment by ID

The Complete payment by ID method is used for completing a payment by its 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 number document_id (see Complete payment by document ID).

XML
PATCH {base_url}/api/v3/resellers/{reseller_id}/payments/{payment_id}
JSON
{
    "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


)

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 


)

payment_id

path

number

Required

Payment ID

payment_method_id

form

number

Required

ID of the payment method to complete the payment (see )

Response model

If no errors are encountered, the method returns information about the completed payment (see Get payment without the included parameter).

Request example

XML
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
JSON
{
    "data":
    {
        "attributes":
        {
            "payment_method_id": 2
        }
    }
}

Response example

JSON
{
    "data": {
        "id": "6475",
        "type": "payments",
        "attributes": {
            "created_at": "2019-11-01T04:30:47.797788+0300",
            "updated_at": "2019-11-01T04:34:42.986099+0300",
            "account_id": 505,
            "discount_amount": "0.0",
            "total": "99.0",
            "amount_paid_from_balance": null,
            "initial_total": "99.0",
            "currency_code": "USD",
            "comment": "cash",
            "status": "completed",
            "document_id": "2005258",
            "expiration_date": null,
            "payment_method_id": 2,
            "requester_ip": "10.0.0.203",
            "manager_id": 234,
			"purpose": "",
            "external_total": null,
            "external_currency": null,
            "due_date": null, 
            "payment_method_name": "Cash",
            "closed_at": "2019-11-01T04:34:42.986099+0300"
        },
        "relationships": {
            "orders": {
                "data": []
            },
            "invoices": {
                "data": []
            },
            "corrections": {
                "data": []
            },
            "reseller": {
                "data": {
                    "id": "1",
                    "type": "resellers"
                }
            },
            "account": {
                "data": {
                    "id": "505",
                    "type": "accounts"
                }
            },
            "payment_method": {
                "data": {
                    "id": "2",
                    "type": "payment_methods"
                }
            }
        }
    }
}

Errors

In case of error, the method returns the error description. For example, for error 422:

JSON
{
    "errors": {
        "title": "Only payments with \"waiting for payment/expired\" status can be completed.",
        "status": "422"
    }
}