402 Payment Required

When a request is made via API and this request is updating a quantity from the services (e.g. adding a device, a user, a number, etc…) API will return a 402 Payment Required error message to show resulting charge for performing the query.

For accepting the charge and performing the query, you have to send the same exact request payload again this time with accept_charges: true in root body of the payload.

It is also possible to bypass the charges confirmation handshake entirely and perform the query right away by setting accept_charges: true directly on the original request.

Example Accept Charges Response

For example, if you make a request to add a new UI application to a subaccount, the active service plan may require you to accept the charge and will return this response at first:

Note

"activation_charges" is the total for all category / items.

{
    "data": {
        "{CATEGORY}": {
            "{ITEM}": {
                "category": "{CATEGORY}",
                "item": "{ITEM}",
                "quantity": 1,
                "rate": 2.0,
                "single_discount": true,
                "single_discount_rate": 0.0,
                "cumulative_discount": 0,
                "cumulative_discount_rate": 0.0,
                "activation_charges": 1.0
            }
        },
        "activation_charges": 1.0
    },
    "error": "402",
    "message": "accept charges",
    "status": "error"
}

For accepting the charge simply repeat the first request with accept_charges: true included.

{
    "data": {...},
    "accept_charges": true,
    "auth_token": "{AUTH_TOKEN}"
}

On this page