const invoicesController = new InvoicesController(client);
InvoicesController
- Create Invoice
- Get Invoices
- Cancel Invoice
- Update Invoice Metadata
- Get Partial Invoice
- Update Invoice Status
- Get Invoice
Create an Invoice
async createInvoice(
subscriptionId: string,
cycleId: string,
request?: CreateInvoiceRequest,
idempotencyKey?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetInvoiceResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
subscriptionId |
string |
Template, Required | Subscription Id |
cycleId |
string |
Template, Required | Cycle Id |
request |
CreateInvoiceRequest | undefined |
Body, Optional | - |
idempotencyKey |
string | undefined |
Header, Optional | - |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const subscriptionId = 'subscription_id0';
const cycleId = 'cycle_id6';
try {
const { result, ...httpResponse } = await invoicesController.createInvoice(subscriptionId, cycleId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Gets all invoices
async getInvoices(
page?: number,
size?: number,
code?: string,
customerId?: string,
subscriptionId?: string,
createdSince?: string,
createdUntil?: string,
status?: string,
dueSince?: string,
dueUntil?: string,
customerDocument?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListInvoicesResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
page |
number | undefined |
Query, Optional | Page number |
size |
number | undefined |
Query, Optional | Page size |
code |
string | undefined |
Query, Optional | Filter for Invoice's code |
customerId |
string | undefined |
Query, Optional | Filter for Invoice's customer id |
subscriptionId |
string | undefined |
Query, Optional | Filter for Invoice's subscription id |
createdSince |
string | undefined |
Query, Optional | Filter for Invoice's creation date start range |
createdUntil |
string | undefined |
Query, Optional | Filter for Invoices creation date end range |
status |
string | undefined |
Query, Optional | Filter for Invoice's status |
dueSince |
string | undefined |
Query, Optional | Filter for Invoice's due date start range |
dueUntil |
string | undefined |
Query, Optional | Filter for Invoice's due date end range |
customerDocument |
string | undefined |
Query, Optional | - |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await invoicesController.getInvoices();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Cancels an invoice
async cancelInvoice(
invoiceId: string,
idempotencyKey?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetInvoiceResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
invoiceId |
string |
Template, Required | Invoice id |
idempotencyKey |
string | undefined |
Header, Optional | - |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const invoiceId = 'invoice_id0';
try {
const { result, ...httpResponse } = await invoicesController.cancelInvoice(invoiceId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Updates the metadata from an invoice
async updateInvoiceMetadata(
invoiceId: string,
request: UpdateMetadataRequest,
idempotencyKey?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetInvoiceResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
invoiceId |
string |
Template, Required | The invoice id |
request |
UpdateMetadataRequest |
Body, Required | Request for updating the invoice metadata |
idempotencyKey |
string | undefined |
Header, Optional | - |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const invoiceId = 'invoice_id0';
const requestMetadata: Record<string, string> = {'key0' : 'metadata3' } const request: UpdateMetadataRequest = {
metadata: requestMetadata,
};
try {
const { result, ...httpResponse } = await invoicesController.updateInvoiceMetadata(invoiceId, request);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
async getPartialInvoice(
subscriptionId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetInvoiceResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
subscriptionId |
string |
Template, Required | Subscription Id |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const subscriptionId = 'subscription_id0';
try {
const { result, ...httpResponse } = await invoicesController.getPartialInvoice(subscriptionId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Updates the status from an invoice
async updateInvoiceStatus(
invoiceId: string,
request: UpdateInvoiceStatusRequest,
idempotencyKey?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetInvoiceResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
invoiceId |
string |
Template, Required | Invoice Id |
request |
UpdateInvoiceStatusRequest |
Body, Required | Request for updating an invoice's status |
idempotencyKey |
string | undefined |
Header, Optional | - |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const invoiceId = 'invoice_id0';
const request: UpdateInvoiceStatusRequest = {
status: 'status8',
};
try {
const { result, ...httpResponse } = await invoicesController.updateInvoiceStatus(invoiceId, request);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Gets an invoice
async getInvoice(
invoiceId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetInvoiceResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
invoiceId |
string |
Template, Required | Invoice Id |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const invoiceId = 'invoice_id0';
try {
const { result, ...httpResponse } = await invoicesController.getInvoice(invoiceId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}