@ptkl/sdk - v1.18.0
    Preparing search index...

    Transactions client — billing/subscriptions, invoices, credits/balance, usage pricing and per-project billing-mode overrides. All routes go through the transactions/… gateway prefix (/luma/transactions/v1/...), matching the transactions service's REST surface (internal/controllers/{subscription,invoices,topup,credit_history,billing_modes,prices,balance}.go).

    This is the billing service — not distributed/database transactions.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • Optionaloptions: { env?: string; host?: string; token?: string }

      Returns default

    Properties

    client: AxiosInstance
    env: null | string = null
    host: null | string = null
    token: null | string = null

    Methods

    • Get the current project's credit balance.

      Returns Promise<AxiosResponse<BalanceResult, any>>

    • Get the project's usage-billing-mode overrides plus platform defaults.

      Returns Promise<AxiosResponse<GetBillingModesResult, any>>

    • Get a single invoice by uuid.

      Parameters

      • uuid: string

      Returns Promise<AxiosResponse<Invoice, any>>

    • Download an invoice as a PDF. Resolves with the raw PDF bytes (responseType: "arraybuffer").

      Parameters

      • uuid: string

      Returns Promise<AxiosResponse<ArrayBuffer, any>>

      const { data } = await platform.transactions().getInvoicePdf(uuid)
      fs.writeFileSync("invoice.pdf", Buffer.from(data))
    • List all invoices for the current project.

      Returns Promise<AxiosResponse<Invoice[], any>>

    • Get the usage-based pricing table for a given currency.

      Parameters

      • currency: string

        ISO 4217 currency code, e.g. "USD" or "RSD".

      Returns Promise<AxiosResponse<SubscriptionPrices, any>>

    • List all subscriptions (including expired) for the current project.

      Returns Promise<AxiosResponse<Subscription[], any>>

      const subs = await platform.transactions().getSubscriptions()
      
    • Parameters

      • client: AxiosInstance

      Returns default

    • Generate a checkout link to manually top up the project's credit balance.

      Parameters

      Returns Promise<AxiosResponse<TopUpResult, any>>