Skip to content

Commit 0b16b13

Browse files
authored
Merge pull request #1554 from livechat/ACC-3770-billing-charges-new-status
ACC-3770 new status for recurrent charges + API url update + endpoint…
2 parents c49d42e + 17d9038 commit 0b16b13

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/pages/monetization/billing-api/index.mdx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The Billing API is based on the [Text OAuth](https://platform.text.com/docs/auth
6262

6363
## 2. APIs
6464

65-
The current version of the Billing API is `v2`. This version makes it possible to handle various products, with the support of two of them already available: LiveChat and HelpDesk.
65+
The current version of the Billing API is `v3`. This version makes it possible to handle various products, with the support of two of them already available: LiveChat and HelpDesk.
6666
The product information is put explicitly in API endpoints - as the `<product>` element of each path.
6767

6868
### 2.1. Direct Charges
@@ -124,9 +124,9 @@ There are three possible direct charge flows:
124124

125125
## Usage
126126

127-
- Create a charge for a user (`POST /v2/direct_charge/<product>`) and redirect them to the `confirmation_url`.
127+
- Create a charge for a user (`POST /v3/direct_charge/<product>`) and redirect them to the `confirmation_url`.
128128
- After the user confirms or declines the charge, they will be redirected to `return_url` with charge `id` passed as a URL param.
129-
- Based on `id`, you can check charge status (`GET /v2/direct_charge/<product>/:ID`). If it is `accepted`, you must activate the charge (`PUT /v2/direct_charge/<product>/:ID/activate`).
129+
- Based on `id`, you can check charge status (`GET /v3/direct_charge/<product>/:ID`). If it is `accepted`, you must activate the charge (`PUT /v3/direct_charge/<product>/:ID/activate`).
130130
- After a while, our payment gateway will try to charge the user and it will automatically change the charge status to `success` or `failed`.
131131

132132
<Section>
@@ -167,7 +167,7 @@ Parameters description:
167167
"test": false,
168168
"per_account":true,
169169
"status": "pending",
170-
"confirmation_url": "https://billing.livechatinc.com/?id=5deab95d-c0c9-4397-9593-436f533e83e5",
170+
"confirmation_url": "https://billing.text.com/?id=5deab95d-c0c9-4397-9593-436f533e83e5",
171171
"commission_percent": 20,
172172
"created_at": "2017-10-20T13:31:27Z",
173173
"updated_at": "2017-10-23T13:27:45Z"
@@ -188,12 +188,12 @@ If you want to use this API, you must create an app in Developer Console and che
188188

189189
## Endpoints
190190

191-
Base URL: `https://billing.livechatinc.com`
191+
Base URL: `https://billing.text.com`
192192

193-
- `POST /v2/direct_charge/<product>` - create a new charge. Required fields: `name`, `price`, `quantity`, `return_url`. Optional fields: `per_account`, `test`
194-
- `GET /v2/direct_charge/<product>/:ID` - get an existing charge.
195-
- `GET /v2/direct_charge/<product>` - create a paginated charges list (20 items per page) ordered by the creation date. Optional fields: `page`, `status`, `recurrent_charge_id`
196-
- `PUT /v2/direct_charge/<product>/:ID/activate` - activate a charge (the payment gateway starts processing it).
193+
- `POST /v3/direct_charge/<product>` - create a new charge. Required fields: `name`, `price`, `quantity`, `return_url`. Optional fields: `per_account`, `test`
194+
- `GET /v3/direct_charge/<product>/:ID` - get an existing charge.
195+
- `GET /v3/direct_charge/<product>` - create a paginated charges list (20 items per page) ordered by the creation date. Optional fields: `page`, `status`, `recurrent_charge_id`
196+
- `PUT /v3/direct_charge/<product>/:ID/activate` - activate a charge (the payment gateway starts processing it).
197197

198198
# Ledger
199199

@@ -244,7 +244,7 @@ If you want to use this API, you must create an app in Developer Console and che
244244

245245
## Endpoints
246246

247-
Base URL: `https://billing.livechatinc.com`
247+
Base URL: `https://billing.text.com`
248248

249249
- `GET /v2/ledger/livechat` - returns the current ledger. It lists up to 20 entries, use `?page=X` for pagination. Required format: `{result: [LEDGER ENTRY 1, LEDGER ENTRY 2, ...]}`,
250250
- `GET /v2/ledger/livechat/balance` - returns the current ledger balance in cents. Format: `{"balance": 10}`
@@ -255,14 +255,15 @@ The Recurrent Charges API handles periodic payments. Once the payment is set up,
255255

256256
## Statuses
257257

258-
There are six possible recurrent charge statuses:
258+
There are seven possible recurrent charge statuses:
259259

260260
| Status | Description |
261261
| ----------- | ---------------------------------------------------------------- |
262262
| `pending` | the charge has been created and is awaiting merchant interaction |
263263
| `accepted` | the charge has been accepted by the merchant |
264264
| `declined` | the charge has been declined by the merchant |
265-
| `active` | the charge is being processed by a payment gateway |
265+
| `active` | the charge is active and all issued invoices have been paid |
266+
| `past_due` | the charge is active but has unpaid invoices |
266267
| `frozen` | the charge could not be collected |
267268
| `cancelled` | the charge has been cancelled |
268269

@@ -274,6 +275,9 @@ There are three possible recurrent charge flows:
274275
- `pending` -> `accepted` -> `processed` -> `active` -> `frozen`
275276
- `pending` -> `declined`
276277

278+
Additionally, whenever a payment is due, and an invoice is issued, the charge enters the `past_due` status. As soon as the invoice is paid the status changes back to `active`.
279+
In the best-case scenario, this only takes a few seconds. In other cases, the `past_due` status may be used to, for example, display a pending invoice notification to the app user or limit the app's functionality.
280+
277281
<Section>
278282

279283
<Text>
@@ -346,12 +350,12 @@ Parameters description:
346350

347351
All endpoints return a recurrent charge object.
348352

349-
- `POST /v2/recurrent_charge/<product>` - create a new charge. Required fields: `name`, `price`, `return_url`. Optional fields: `external_id`, `test`, `trial_days`, `months`, `per_account`
350-
- `GET /v2/recurrent_charge/<product>/:ID` - get the existing charge
351-
- `PUT /v2/recurrent_charge/<product>/:ID/accept` - accept recurrent charge. The buyer must confirm the payment before the charge is collected
352-
- `PUT /v2/recurrent_charge/<product>/:ID/decline` - decline recurrent charge. The buyer can decline a `pending` charge
353-
- `PUT /v2/recurrent_charge/<product>/:ID/activate` - activate recurrent charge
354-
- `PUT /v2/recurrent_charge/<product>/:ID/cancel` - cancel recurrent charge
353+
- `POST /v3/recurrent_charge/<product>` - create a new charge. Required fields: `name`, `price`, `return_url`. Optional fields: `external_id`, `test`, `trial_days`, `months`, `per_account`
354+
- `GET /v3/recurrent_charge/<product>/:ID` - get the existing charge
355+
- `PUT /v3/recurrent_charge/<product>/:ID/accept` - accept recurrent charge. The buyer must confirm the payment before the charge is collected
356+
- `PUT /v3/recurrent_charge/<product>/:ID/decline` - decline recurrent charge. The buyer can decline a `pending` charge
357+
- `PUT /v3/recurrent_charge/<product>/:ID/activate` - activate recurrent charge
358+
- `PUT /v3/recurrent_charge/<product>/:ID/cancel` - cancel recurrent charge
355359

356360
# Checkout link charges
357361

0 commit comments

Comments
 (0)