This document is for an older version of Kazoo (version 4.3) that is no longer supported. You should upgrade and read the current documentation.
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 preforming 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 make a request to add Numbers UI application to the account, if performing this request requires accept charge base on your service plan API will return this response:
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}"
}