orb-billing
Version:
The official TypeScript library for the Orb API
60 lines • 2.58 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreditBlocks = void 0;
const resource_1 = require("../resource.js");
/**
* The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb.
*/
class CreditBlocks extends resource_1.APIResource {
/**
* This endpoint returns a credit block identified by its block_id.
*/
retrieve(blockId, options) {
return this._client.get(`/credit_blocks/${blockId}`, options);
}
/**
* This endpoint deletes a credit block by its ID.
*
* When a credit block is deleted:
*
* - The block is removed from the customer's credit ledger.
* - Any usage of the credit block is reversed, and the ledger is replayed as if
* the block never existed.
* - If invoices were generated from the purchase of the credit block, they will be
* deleted if in draft status, voided if issued, or a credit note will be issued
* if the invoice is paid.
*
* <Note>
* Issued invoices that had credits applied from this block will not be regenerated, but the ledger will
* reflect the state as if credits from the deleted block were never applied.
* </Note>
*/
delete(blockId, options) {
return this._client.delete(`/credit_blocks/${blockId}`, {
...options,
headers: { Accept: '*/*', ...options?.headers },
});
}
/**
* This endpoint returns the credit block and its associated purchasing invoices.
*
* If a credit block was purchased (as opposed to being manually added or allocated
* from a subscription), this endpoint returns the invoices that were created to
* charge the customer for the credit block. For credit blocks with payment
* schedules spanning multiple periods (e.g., monthly payments over 12 months),
* multiple invoices will be returned.
*
* If the credit block was not purchased (e.g., manual increment, allocation), an
* empty invoices list is returned.
*
* **Note: This endpoint is currently experimental and its interface may change in
* future releases. Please contact support before building production integrations
* against this endpoint.**
*/
listInvoices(blockId, options) {
return this._client.get(`/credit_blocks/${blockId}/invoices`, options);
}
}
exports.CreditBlocks = CreditBlocks;
//# sourceMappingURL=credit-blocks.js.map