BillingPrepaidPurchase
Operations
Every route this entity exposes. Each route links to its own reference on this page.
| Method | Route | SDK operation | Returns |
|---|---|---|---|
POST |
/api/v1/organizations/{organization_id}/billing/prepaid_purchases |
create |
Purchase accepted for payment reconciliation |
GET |
/api/v1/organizations/{organization_id}/billing/prepaid_purchases |
list |
Purchases, newest first |
GET |
/api/v1/organizations/{organization_id}/billing/prepaid_purchases/{id} |
load |
Purchase status and balance |
GET |
/api/v1/organizations/{organization_id}/billing/prepaid_purchases/{id}/payment_page |
load |
Current hosted invoice URL |
Examples
One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.
Golang
Construct client as shown in the Golang setup, then call the operations:
billing_prepaid_purchases, err := client.BillingPrepaidPurchase(nil).List(map[string]any{"organization_id": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(billing_prepaid_purchases)
billing_prepaid_purchase, err := client.BillingPrepaidPurchase(nil).Load(map[string]any{"id": "example_id", "organization_id": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(billing_prepaid_purchase)
created, err := client.BillingPrepaidPurchase(nil).Create(map[string]any{"organization_id": "example", "minutes": 1, "request_key": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(created)
Lua
Construct client as shown in the Lua setup, then call the operations:
local billing_prepaid_purchases, err = client:BillingPrepaidPurchase():list({ organization_id = "example" })
local billing_prepaid_purchase, err = client:BillingPrepaidPurchase():load({ id = "example_id", organization_id = "example" })
local created, err = client:BillingPrepaidPurchase():create({ organization_id = "example", minutes = 1, request_key = "example" })
PHP
Construct client as shown in the PHP setup, then call the operations:
$billing_prepaid_purchases = $client->BillingPrepaidPurchase()->list(["organization_id" => "example"]);
$billing_prepaid_purchase = $client->BillingPrepaidPurchase()->load(["id" => "example_id", "organization_id" => "example"]);
$created = $client->BillingPrepaidPurchase()->create(["organization_id" => "example", "minutes" => 1, "request_key" => "example"]);
Python
Construct client as shown in the Python setup, then call the operations:
billing_prepaid_purchases = client.BillingPrepaidPurchase().list({"organization_id": "example"})
billing_prepaid_purchase = client.BillingPrepaidPurchase().load({"id": "example_id", "organization_id": "example"})
created = client.BillingPrepaidPurchase().create({ "organization_id": "example", "minutes": 1, "request_key": "example" })
Ruby
Construct client as shown in the Ruby setup, then call the operations:
billing_prepaid_purchases = client.BillingPrepaidPurchase.list({ "organization_id" => "example" })
billing_prepaid_purchase = client.BillingPrepaidPurchase.load({ "id" => "example_id", "organization_id" => "example" })
created = client.BillingPrepaidPurchase.create({ "organization_id" => "example", "minutes" => 1, "request_key" => "example" })
TypeScript
Construct client as shown in the TypeScript setup, then call the operations:
const billing_prepaid_purchases = await client.BillingPrepaidPurchase().list({ organization_id: "example" })
const billing_prepaid_purchase = await client.BillingPrepaidPurchase().load({ id: "example_id", organization_id: "example" })
const created = await client.BillingPrepaidPurchase().create({ organization_id: "example", minutes: 1, request_key: "example" })
Fields
| Field | Type | Required | Description |
|---|---|---|---|
activated_at |
one,string,null |
Yes | Activated At |
created_at |
string |
Yes | Created At |
currency |
string |
Yes | Currency |
id |
string |
Yes | Id |
last_error |
one,string,null |
Yes | Last Error |
minutes |
integer |
Yes | Minutes |
net_amount_cents |
integer |
Yes | Net Amount Cents |
paid_at |
one,string,null |
Yes | Paid At |
paid_total_cents |
one,integer,null |
Yes | Paid Total Cents |
payment_action_url |
one,string,null |
Yes | Payment Action Url |
prepaid |
object |
Yes | Prepaid |
purchase |
object |
Yes | Purchase |
receipt_url |
one,string,null |
Yes | Receipt Url |
refunded_net_cents |
integer |
Yes | Refunded Net Cents |
request_key |
string |
Yes | Request Key |
state |
string |
Yes | State |
create
POST /api/v1/organizations/{organization_id}/billing/prepaid_purchases
Operation ID: post_api_v1_organizations_organization_id_billing_prepaid_purchases.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
organization_id |
path |
string |
Yes |
Request body
application/json
| Property | Type | Required | Description |
|---|---|---|---|
minutes |
enum: 100, 500, 1000 |
Yes | |
request_key |
string |
Yes |
Responses
202: Purchase accepted for payment reconciliation
application/json
| Property | Type | Required | Description |
|---|---|---|---|
prepaid |
object |
Yes | |
prepaid.balance |
object |
Yes | |
prepaid.balance.available_minutes |
number |
Yes | |
prepaid.balance.held_minutes |
number |
Yes | |
prepaid.balance.monthly_minutes |
number |
Yes | |
prepaid.balance.operator_minutes |
number |
Yes | |
prepaid.balance.purchased_minutes |
number |
Yes | |
prepaid.balance.reserved_minutes |
number |
Yes | |
prepaid.can_cancel |
boolean |
Yes | |
prepaid.can_purchase |
boolean |
Yes | |
prepaid.cancel_at |
string,null (date-time) |
Yes | |
prepaid.cancellation_pending |
boolean |
Yes | |
prepaid.has_paid_period |
boolean |
Yes | |
prepaid.included_minutes |
number |
Yes | |
prepaid.monthly_payment |
object and object or null |
Yes | |
prepaid.monthly_price_cents |
integer |
Yes | |
prepaid.needs_payment_method |
boolean |
Yes | |
prepaid.next_renewal_at |
string,null (date-time) |
Yes | |
prepaid.package_name |
string |
Yes | |
prepaid.recent_purchases |
array of object |
Yes | |
prepaid.recent_purchases[].activated_at |
string,null (date-time) |
Yes | |
prepaid.recent_purchases[].created_at |
string (date-time) |
Yes | |
prepaid.recent_purchases[].currency |
string |
Yes | |
prepaid.recent_purchases[].id |
string |
Yes | |
prepaid.recent_purchases[].last_error |
string,null |
Yes | |
prepaid.recent_purchases[].minutes |
integer |
Yes | |
prepaid.recent_purchases[].net_amount_cents |
integer |
Yes | |
prepaid.recent_purchases[].paid_at |
string,null (date-time) |
Yes | |
prepaid.recent_purchases[].paid_total_cents |
integer,null |
Yes | |
prepaid.recent_purchases[].payment_action_url |
string,null |
Yes | |
prepaid.recent_purchases[].receipt_url |
string,null |
Yes | |
prepaid.recent_purchases[].refunded_net_cents |
integer |
Yes | |
prepaid.recent_purchases[].state |
enum: requested, submitting, pending, requires_action, uncertain, failed, ... |
Yes | |
prepaid.refresh_recommended |
boolean |
Yes | |
prepaid.subscription_status |
string |
Yes | |
prepaid.top_up_options |
array of object |
Yes | |
prepaid.top_up_options[].amount_cents |
integer |
Yes | |
prepaid.top_up_options[].currency |
string |
Yes | |
prepaid.top_up_options[].minutes |
enum: 100, 500, 1000 |
Yes | |
purchase |
object |
Yes | |
purchase.activated_at |
string,null (date-time) |
Yes | |
purchase.created_at |
string (date-time) |
Yes | |
purchase.currency |
string |
Yes | |
purchase.id |
string |
Yes | |
purchase.last_error |
string,null |
Yes | |
purchase.minutes |
integer |
Yes | |
purchase.net_amount_cents |
integer |
Yes | |
purchase.paid_at |
string,null (date-time) |
Yes | |
purchase.paid_total_cents |
integer,null |
Yes | |
purchase.payment_action_url |
string,null |
Yes | |
purchase.receipt_url |
string,null |
Yes | |
purchase.refunded_net_cents |
integer |
Yes | |
purchase.state |
enum: requested, submitting, pending, requires_action, uncertain, failed, ... |
Yes |
422: Invalid purchase or no active prepaid package
application/json
| Property | Type | Required | Description |
|---|---|---|---|
details |
array of string |
Yes | |
error |
string |
Yes | |
field_errors |
object |
Yes | |
purchase_rejected |
boolean |
Yes | True only when this request identity is durably rejected and cannot later be accepted. Otherwise retain the identity for recovery. |
list
GET /api/v1/organizations/{organization_id}/billing/prepaid_purchases
Operation ID: api_v1_organization_billing_prepaid_purchases.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
organization_id |
path |
string |
Yes |
Responses
200: Purchases, newest first
application/json
| Property | Type | Required | Description |
|---|---|---|---|
pagination |
object |
Yes | |
pagination.count |
integer |
Yes | |
pagination.last |
integer |
Yes | |
pagination.limit |
integer |
Yes | |
pagination.next |
integer,null |
No | |
pagination.page |
integer |
Yes | |
pagination.previous |
integer,null |
No | |
pagination.series |
array of integer or string |
Yes | |
purchases |
array of object |
Yes | |
purchases[].activated_at |
string,null (date-time) |
Yes | |
purchases[].created_at |
string (date-time) |
Yes | |
purchases[].currency |
string |
Yes | |
purchases[].id |
string |
Yes | |
purchases[].last_error |
string,null |
Yes | |
purchases[].minutes |
integer |
Yes | |
purchases[].net_amount_cents |
integer |
Yes | |
purchases[].paid_at |
string,null (date-time) |
Yes | |
purchases[].paid_total_cents |
integer,null |
Yes | |
purchases[].payment_action_url |
string,null |
Yes | |
purchases[].receipt_url |
string,null |
Yes | |
purchases[].refunded_net_cents |
integer |
Yes | |
purchases[].state |
enum: requested, submitting, pending, requires_action, uncertain, failed, ... |
Yes |
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway
load
GET /api/v1/organizations/{organization_id}/billing/prepaid_purchases/{id}
Operation ID: api_v1_organization_billing_prepaid_purchase.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
organization_id |
path |
string |
Yes | |
id |
path |
string |
Yes |
Responses
200: Purchase status and balance
application/json
| Property | Type | Required | Description |
|---|---|---|---|
prepaid |
object |
Yes | |
prepaid.balance |
object |
Yes | |
prepaid.balance.available_minutes |
number |
Yes | |
prepaid.balance.held_minutes |
number |
Yes | |
prepaid.balance.monthly_minutes |
number |
Yes | |
prepaid.balance.operator_minutes |
number |
Yes | |
prepaid.balance.purchased_minutes |
number |
Yes | |
prepaid.balance.reserved_minutes |
number |
Yes | |
prepaid.can_cancel |
boolean |
Yes | |
prepaid.can_purchase |
boolean |
Yes | |
prepaid.cancel_at |
string,null (date-time) |
Yes | |
prepaid.cancellation_pending |
boolean |
Yes | |
prepaid.has_paid_period |
boolean |
Yes | |
prepaid.included_minutes |
number |
Yes | |
prepaid.monthly_payment |
object and object or null |
Yes | |
prepaid.monthly_price_cents |
integer |
Yes | |
prepaid.needs_payment_method |
boolean |
Yes | |
prepaid.next_renewal_at |
string,null (date-time) |
Yes | |
prepaid.package_name |
string |
Yes | |
prepaid.recent_purchases |
array of object |
Yes | |
prepaid.recent_purchases[].activated_at |
string,null (date-time) |
Yes | |
prepaid.recent_purchases[].created_at |
string (date-time) |
Yes | |
prepaid.recent_purchases[].currency |
string |
Yes | |
prepaid.recent_purchases[].id |
string |
Yes | |
prepaid.recent_purchases[].last_error |
string,null |
Yes | |
prepaid.recent_purchases[].minutes |
integer |
Yes | |
prepaid.recent_purchases[].net_amount_cents |
integer |
Yes | |
prepaid.recent_purchases[].paid_at |
string,null (date-time) |
Yes | |
prepaid.recent_purchases[].paid_total_cents |
integer,null |
Yes | |
prepaid.recent_purchases[].payment_action_url |
string,null |
Yes | |
prepaid.recent_purchases[].receipt_url |
string,null |
Yes | |
prepaid.recent_purchases[].refunded_net_cents |
integer |
Yes | |
prepaid.recent_purchases[].state |
enum: requested, submitting, pending, requires_action, uncertain, failed, ... |
Yes | |
prepaid.refresh_recommended |
boolean |
Yes | |
prepaid.subscription_status |
string |
Yes | |
prepaid.top_up_options |
array of object |
Yes | |
prepaid.top_up_options[].amount_cents |
integer |
Yes | |
prepaid.top_up_options[].currency |
string |
Yes | |
prepaid.top_up_options[].minutes |
enum: 100, 500, 1000 |
Yes | |
purchase |
object |
Yes | |
purchase.activated_at |
string,null (date-time) |
Yes | |
purchase.created_at |
string (date-time) |
Yes | |
purchase.currency |
string |
Yes | |
purchase.id |
string |
Yes | |
purchase.last_error |
string,null |
Yes | |
purchase.minutes |
integer |
Yes | |
purchase.net_amount_cents |
integer |
Yes | |
purchase.paid_at |
string,null (date-time) |
Yes | |
purchase.paid_total_cents |
integer,null |
Yes | |
purchase.payment_action_url |
string,null |
Yes | |
purchase.receipt_url |
string,null |
Yes | |
purchase.refunded_net_cents |
integer |
Yes | |
purchase.state |
enum: requested, submitting, pending, requires_action, uncertain, failed, ... |
Yes |
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway
GET /api/v1/organizations/{organization_id}/billing/prepaid_purchases/{id}/payment_page
Operation ID: payment_page_api_v1_organization_billing_prepaid_purchase.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
organization_id |
path |
string |
Yes | |
id |
path |
string |
Yes |
Responses
200: Current hosted invoice URL
application/json
| Property | Type | Required | Description |
|---|---|---|---|
url |
string |
Yes |