---
title: "Purchase credits"
method: POST
path: "/v1/customers/{id}/credits/{productId}/purchase"
tags: ["Customers > Credits"]
---

# Purchase credits

`POST /v1/customers/{id}/credits/{productId}/purchase`

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

## Path parameters

- `id` string, required
- `productId` string, required

## Request body

- CreateCreditPurchase
  - `credit_count` number, 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_tax` number — Custom amount for the added credits. Either `amount_excluding_tax` or `price_id` must be defined. Expressed in currency's smallest unit.
  - `price_id` string — Price ID used to add credits. The price must be of type `bundle`. Either `amount_excluding_tax` or `price_id` must be defined.
  - `expires_at` string, date-time — Expiration date for credits linked to this transaction. UTC date time string in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.

## Response `201`

Invoice ID and balance after purchase

- object
  - `invoice_id` string, required
  - `new_credit_balance` number, required

---

[API](https://skmtc.dev/hyperline/apis/hyperline-api.md) · [All operations](https://skmtc.dev/hyperline/apis/hyperline-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hyperline/hyperline-api/revisions/19fa5f22e39b/schema)
