v1

latestOpenAPI 3.1.02026-07-222392081.7 MB
Customers > Credits

Purchase credits

Purchase a number of credits. This action will generate an invoice and charge the customer.

post/v1/customers/{id}/credits/{productId}/purchase

Path parameters

idstring required
productIdstring required

Request body

credit_countnumber required

Value indicating a number of credits to add. If price_id is defined, this value must correspond to a full credit pack for the price.

amount_excluding_taxnumber

Custom amount for the added credits. Either amount_excluding_tax or price_id must be defined. Expressed in currency's smallest unit.

price_idstring

Price ID used to add credits. The price must be of type bundle. Either amount_excluding_tax or price_id must be defined.

expires_atstring date-time

Expiration date for credits linked to this transaction. UTC date time string in the ISO 8601 format.

Example request

{
  "credit_count": 32,
  "expires_at": "2024-12-20T16:04:11Z"
}

Response

Invoice ID and balance after purchase

invoice_idstring required
new_credit_balancenumber required