BackstageClient.billing
BackstageClient.billing in @ticketlayer/backstage.
@ticketlayer/backstage / BackstageClient / billing
billing: {
cancelSubscription: (subscriptionId: string, requestOptions?: RequestOptions) => Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}>;
canSell: (organisationId: string, requestOptions?: RequestOptions) => Promise<{
canSell: boolean;
currentBalance: number;
reason: string | null;
}>;
createAiTopup: (request: {
aiPackageId: string;
billingAddress?: {
city: string;
country: string;
line1: string;
line2?: string;
name?: string;
postal_code: string;
state?: string;
};
currency?: string;
email?: string;
paymentMethodId: string;
}, requestOptions?: RequestOptions) => Promise<{
creditsAdded: number;
invoice: {
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
};
newBalance: number;
payment: {
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
};
}>;
createPurchase: (request: {
billingAddress?: {
city: string;
country: string;
line1: string;
line2?: string;
name?: string;
postal_code: string;
state?: string;
};
currency?: string;
email?: string;
packageId: string;
paymentMethodId: string;
}, requestOptions?: RequestOptions) => Promise<{
invoice: {
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
};
newBalance: number;
payment: {
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
};
success: boolean;
transaction: {
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
};
}>;
createSetupIntent: (requestOptions?: RequestOptions) => Promise<string>;
createSubscription: (request: {
currency?: string;
email?: string;
interval: "month" | "year";
packageId: string;
paymentMethodId: string;
}, requestOptions?: RequestOptions) => Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}>;
deletePaymentMethod: (paymentMethodId: string, requestOptions?: RequestOptions) => Promise<boolean>;
getAiBalance: (requestOptions?: RequestOptions) => Promise<{
balance: number;
isDepleted: boolean;
isLow: boolean;
lifetimeCredits: number;
lifetimeUsed: number;
}>;
getAutoTopup: (requestOptions?: RequestOptions) => Promise<
| {
attemptsToday: number;
createdAt: string;
enabled: boolean;
id: string;
lastAttemptAt: string | null;
maxAttemptsPerDay: number;
organisationId: string;
thresholdCredits: number;
topupPackageId: string;
updatedAt: string;
}
| null>;
getBalance: (requestOptions?: RequestOptions) => Promise<{
balance: number;
createdAt: string;
id: string;
isSuspended: boolean;
lifetimeCredits: number;
lifetimeUsed: number;
organisationId: string;
status: "low" | "healthy" | "depleted" | "negative" | "suspended";
suspendedAt: string | null;
suspendedReason: string | null;
updatedAt: string;
}>;
getInvoice: (invoiceId: string, requestOptions?: RequestOptions) => Promise<{
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
}>;
listAiPackages: (requestOptions?: RequestOptions) => Promise<{
baseCurrency: string;
basePrice: number;
credits: number;
discountPercent: number;
displayOrder: number;
finalPrice: number;
id: string;
isActive: boolean;
name: string;
}[]>;
listAiTransactions: (options?: {
limit?: string;
page?: string;
}, requestOptions?: RequestOptions) => Promise<{
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
}[]>;
listInvoices: (options?: {
limit?: string;
page?: string;
status?: string;
}, requestOptions?: RequestOptions) => Promise<{
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
}[]>;
listPackages: (requestOptions?: RequestOptions) => Promise<{
baseCurrency: string;
basePrice: number;
credits: number;
discountPercent: string;
displayOrder: number;
finalPrice: number;
id: string;
isActive: boolean;
name: string;
}[]>;
listPaymentMethods: (requestOptions?: RequestOptions) => Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}[]>;
listPayments: (options?: {
limit?: string;
page?: string;
status?: string;
}, requestOptions?: RequestOptions) => Promise<{
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
}[]>;
listSubscriptions: (requestOptions?: RequestOptions) => Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}[]>;
listTransactions: (options?: {
limit?: string;
page?: string;
type?: string;
}, requestOptions?: RequestOptions) => Promise<{
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
}[]>;
savePaymentMethod: (request: {
paymentMethodId: string;
setAsDefault?: boolean;
}, requestOptions?: RequestOptions) => Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}>;
setDefaultPaymentMethod: (paymentMethodId: string, requestOptions?: RequestOptions) => Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}>;
updateAutoTopup: (request: {
enabled: boolean;
thresholdCredits: number;
topupPackageId: string;
}, requestOptions?: RequestOptions) => Promise<
| {
attemptsToday: number;
createdAt: string;
enabled: boolean;
id: string;
lastAttemptAt: string | null;
maxAttemptsPerDay: number;
organisationId: string;
thresholdCredits: number;
topupPackageId: string;
updatedAt: string;
}
| null>;
};Defined in: client.ts:3779
Billing methods
cancelSubscription()#
cancelSubscription: (subscriptionId: string, requestOptions?: RequestOptions) => Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}>;Cancel subscription Cancel an active subscription
Parameters#
| Parameter | Type |
|---|---|
subscriptionId | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}>
Operation Id#
cancelSubscription
canSell()#
canSell: (organisationId: string, requestOptions?: RequestOptions) => Promise<{
canSell: boolean;
currentBalance: number;
reason: string | null;
}>;Check if organisation can sell Check whether the caller's own organisation has sufficient credits to process sales. Answers only for the organisation the credential belongs to: any other organisation id is 404 ORGANISATION_NOT_FOUND, whether or not it exists. Requires billing.balance.read, the permission the balance itself is read with.
Parameters#
| Parameter | Type |
|---|---|
organisationId | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
canSell: boolean;
currentBalance: number;
reason: string | null;
}>
Operation Id#
checkCanSell
createAiTopup()#
createAiTopup: (request: {
aiPackageId: string;
billingAddress?: {
city: string;
country: string;
line1: string;
line2?: string;
name?: string;
postal_code: string;
state?: string;
};
currency?: string;
email?: string;
paymentMethodId: string;
}, requestOptions?: RequestOptions) => Promise<{
creditsAdded: number;
invoice: {
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
};
newBalance: number;
payment: {
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
};
}>;Top up AI credits Purchase AI credits directly (separate from the bundle included with ticket-credit purchases)
Parameters#
| Parameter | Type | Description |
|---|---|---|
request | { aiPackageId: string; billingAddress?: { city: string; country: string; line1: string; line2?: string; name?: string; postal_code: string; state?: string; }; currency?: string; email?: string; paymentMethodId: string; } | - |
request.aiPackageId | string | - |
request.billingAddress? | { city: string; country: string; line1: string; line2?: string; name?: string; postal_code: string; state?: string; } | - |
request.billingAddress.city? | string | - |
request.billingAddress.country? | string | - |
request.billingAddress.line1? | string | - |
request.billingAddress.line2? | string | - |
request.billingAddress.name? | string | - |
request.billingAddress.postal_code? | string | - |
request.billingAddress.state? | string | - |
request.currency? | string | - |
request.email? | string | Format: email |
request.paymentMethodId? | string | - |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
creditsAdded: number;
invoice: {
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
};
newBalance: number;
payment: {
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
};
}>
Operation Id#
createAiTopup
createPurchase()#
createPurchase: (request: {
billingAddress?: {
city: string;
country: string;
line1: string;
line2?: string;
name?: string;
postal_code: string;
state?: string;
};
currency?: string;
email?: string;
packageId: string;
paymentMethodId: string;
}, requestOptions?: RequestOptions) => Promise<{
invoice: {
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
};
newBalance: number;
payment: {
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
};
success: boolean;
transaction: {
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
};
}>;Purchase credits Purchase a credit package for an organisation
Parameters#
| Parameter | Type | Description |
|---|---|---|
request | { billingAddress?: { city: string; country: string; line1: string; line2?: string; name?: string; postal_code: string; state?: string; }; currency?: string; email?: string; packageId: string; paymentMethodId: string; } | - |
request.billingAddress? | { city: string; country: string; line1: string; line2?: string; name?: string; postal_code: string; state?: string; } | - |
request.billingAddress.city? | string | - |
request.billingAddress.country? | string | - |
request.billingAddress.line1? | string | - |
request.billingAddress.line2? | string | - |
request.billingAddress.name? | string | - |
request.billingAddress.postal_code? | string | - |
request.billingAddress.state? | string | - |
request.currency? | string | - |
request.email? | string | Format: email |
request.packageId? | string | - |
request.paymentMethodId? | string | - |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
invoice: {
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
};
newBalance: number;
payment: {
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
};
success: boolean;
transaction: {
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
};
}>
Operation Id#
createCreditPurchase
createSetupIntent()#
createSetupIntent: (requestOptions?: RequestOptions) => Promise<string>;Create setup intent Create a Stripe setup intent for saving a new payment method
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<string>
Operation Id#
createSetupIntent
createSubscription()#
createSubscription: (request: {
currency?: string;
email?: string;
interval: "month" | "year";
packageId: string;
paymentMethodId: string;
}, requestOptions?: RequestOptions) => Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}>;Create subscription Create a new credit subscription for an organisation
Parameters#
| Parameter | Type | Description |
|---|---|---|
request | { currency?: string; email?: string; interval: "month" | "year"; packageId: string; paymentMethodId: string; } | - |
request.currency? | string | - |
request.email? | string | Format: email |
request.interval? | "month" | "year" | |
request.packageId? | string | - |
request.paymentMethodId? | string | - |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}>
Operation Id#
createSubscription
deletePaymentMethod()#
deletePaymentMethod: (paymentMethodId: string, requestOptions?: RequestOptions) => Promise<boolean>;Delete payment method Delete a saved payment method
Parameters#
| Parameter | Type |
|---|---|
paymentMethodId | string |
requestOptions? | RequestOptions |
Returns#
Promise<boolean>
Operation Id#
deletePaymentMethod
getAiBalance()#
getAiBalance: (requestOptions?: RequestOptions) => Promise<{
balance: number;
isDepleted: boolean;
isLow: boolean;
lifetimeCredits: number;
lifetimeUsed: number;
}>;Get AI credit balance Get the organisation's AI-credit (Cue) wallet balance
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<{
balance: number;
isDepleted: boolean;
isLow: boolean;
lifetimeCredits: number;
lifetimeUsed: number;
}>
Operation Id#
getAiBalance
getAutoTopup()#
getAutoTopup: (requestOptions?: RequestOptions) => Promise<
| {
attemptsToday: number;
createdAt: string;
enabled: boolean;
id: string;
lastAttemptAt: string | null;
maxAttemptsPerDay: number;
organisationId: string;
thresholdCredits: number;
topupPackageId: string;
updatedAt: string;
}
| null>;Get auto top-up configuration Get the auto top-up configuration for an organisation
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<
| {
attemptsToday: number;
createdAt: string;
enabled: boolean;
id: string;
lastAttemptAt: string | null;
maxAttemptsPerDay: number;
organisationId: string;
thresholdCredits: number;
topupPackageId: string;
updatedAt: string;
}
| null>
Operation Id#
getAutoTopup
getBalance()#
getBalance: (requestOptions?: RequestOptions) => Promise<{
balance: number;
createdAt: string;
id: string;
isSuspended: boolean;
lifetimeCredits: number;
lifetimeUsed: number;
organisationId: string;
status: "low" | "healthy" | "depleted" | "negative" | "suspended";
suspendedAt: string | null;
suspendedReason: string | null;
updatedAt: string;
}>;Get credit balance Get the current credit balance for an organisation
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<{
balance: number;
createdAt: string;
id: string;
isSuspended: boolean;
lifetimeCredits: number;
lifetimeUsed: number;
organisationId: string;
status: "low" | "healthy" | "depleted" | "negative" | "suspended";
suspendedAt: string | null;
suspendedReason: string | null;
updatedAt: string;
}>
Operation Id#
getCreditBalance
getInvoice()#
getInvoice: (invoiceId: string, requestOptions?: RequestOptions) => Promise<{
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
}>;Get invoice Get a specific invoice by ID
Parameters#
| Parameter | Type |
|---|---|
invoiceId | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
}>
Operation Id#
getInvoice
listAiPackages()#
listAiPackages: (requestOptions?: RequestOptions) => Promise<{
baseCurrency: string;
basePrice: number;
credits: number;
discountPercent: number;
displayOrder: number;
finalPrice: number;
id: string;
isActive: boolean;
name: string;
}[]>;List AI credit packages List the AI-credit top-up packages available for purchase
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<{
baseCurrency: string;
basePrice: number;
credits: number;
discountPercent: number;
displayOrder: number;
finalPrice: number;
id: string;
isActive: boolean;
name: string;
}[]>
Operation Id#
listAiCreditPackages
listAiTransactions()#
listAiTransactions: (options?: {
limit?: string;
page?: string;
}, requestOptions?: RequestOptions) => Promise<{
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
}[]>;List AI credit transactions List the AI-credit wallet transaction history
Parameters#
| Parameter | Type |
|---|---|
options? | { limit?: string; page?: string; } |
options.limit? | string |
options.page? | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
}[]>
Operation Id#
listAiCreditTransactions
listInvoices()#
listInvoices: (options?: {
limit?: string;
page?: string;
status?: string;
}, requestOptions?: RequestOptions) => Promise<{
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
}[]>;List invoices List all invoices for an organisation
Parameters#
| Parameter | Type |
|---|---|
options? | { limit?: string; page?: string; status?: string; } |
options.limit? | string |
options.page? | string |
options.status? | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
amountDue: number;
amountPaid: number;
createdAt: string;
currency: string;
dueDate: string | null;
id: string;
invoiceNumber: string;
issueDate: string;
organisationId: string;
paidAt: string | null;
pdfUrl: string | null;
status: "open" | "draft" | "paid" | "void" | "uncollectible";
subtotal: number;
tax: number;
total: number;
type: "purchase" | "subscription" | "payg";
updatedAt: string;
}[]>
Operation Id#
listInvoices
listPackages()#
listPackages: (requestOptions?: RequestOptions) => Promise<{
baseCurrency: string;
basePrice: number;
credits: number;
discountPercent: string;
displayOrder: number;
finalPrice: number;
id: string;
isActive: boolean;
name: string;
}[]>;List credit packages List all available credit packages for purchase
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<{
baseCurrency: string;
basePrice: number;
credits: number;
discountPercent: string;
displayOrder: number;
finalPrice: number;
id: string;
isActive: boolean;
name: string;
}[]>
Operation Id#
listCreditPackages
listPaymentMethods()#
listPaymentMethods: (requestOptions?: RequestOptions) => Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}[]>;List payment methods List all saved payment methods for the organisation
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}[]>
Operation Id#
listPaymentMethods
listPayments()#
listPayments: (options?: {
limit?: string;
page?: string;
status?: string;
}, requestOptions?: RequestOptions) => Promise<{
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
}[]>;List billing payments List all billing payments for an organisation
Parameters#
| Parameter | Type |
|---|---|
options? | { limit?: string; page?: string; status?: string; } |
options.limit? | string |
options.page? | string |
options.status? | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
amount: number;
createdAt: string;
currency: string;
failedAt: string | null;
failureCode: string | null;
failureMessage: string | null;
id: string;
invoiceId: string | null;
method: string | null;
organisationId: string;
paidAt: string | null;
status: "succeeded" | "failed" | "cancelled" | "refunded" | "pending";
updatedAt: string;
}[]>
Operation Id#
listBillingPayments
listSubscriptions()#
listSubscriptions: (requestOptions?: RequestOptions) => Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}[]>;List subscriptions List all subscriptions for an organisation
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<{
cancelledAt: string | null;
createdAt: string;
credits: number;
currency: string;
currentPeriodEnd: string | null;
currentPeriodStart: string | null;
endedAt: string | null;
id: string;
interval: "month" | "year";
organisationId: string;
packageId: string;
price: number;
status: "cancelled" | "active" | "paused" | "past_due" | "ended";
updatedAt: string;
}[]>
Operation Id#
listSubscriptions
listTransactions()#
listTransactions: (options?: {
limit?: string;
page?: string;
type?: string;
}, requestOptions?: RequestOptions) => Promise<{
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
}[]>;List credit transactions List all credit transactions for an organisation
Parameters#
| Parameter | Type |
|---|---|
options? | { limit?: string; page?: string; type?: string; } |
options.limit? | string |
options.page? | string |
options.type? | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
amount: number;
balanceAfter: number;
balanceBefore: number;
createdAt: string;
description: string | null;
id: string;
invoiceId: string | null;
orderId: string | null;
organisationId: string;
subscriptionId: string | null;
type: | "initial"
| "purchase"
| "subscription"
| "ticket_sale"
| "adjustment"
| "refund";
}[]>
Operation Id#
listCreditTransactions
savePaymentMethod()#
savePaymentMethod: (request: {
paymentMethodId: string;
setAsDefault?: boolean;
}, requestOptions?: RequestOptions) => Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}>;Save payment method Save a payment method after Stripe confirms the setup intent
Parameters#
| Parameter | Type | Description |
|---|---|---|
request | { paymentMethodId: string; setAsDefault?: boolean; } | - |
request.paymentMethodId | string | Example pm_1234567890 |
request.setAsDefault? | boolean | Example true |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}>
Operation Id#
savePaymentMethod
setDefaultPaymentMethod()#
setDefaultPaymentMethod: (paymentMethodId: string, requestOptions?: RequestOptions) => Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}>;Set default payment method Set a payment method as the default for the organisation
Parameters#
| Parameter | Type |
|---|---|
paymentMethodId | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
card: {
brand: string;
expMonth: number;
expYear: number;
last4: string;
};
createdAt: string;
id: string;
isDefault: boolean;
type: "card";
}>
Operation Id#
setDefaultPaymentMethod
updateAutoTopup()#
updateAutoTopup: (request: {
enabled: boolean;
thresholdCredits: number;
topupPackageId: string;
}, requestOptions?: RequestOptions) => Promise<
| {
attemptsToday: number;
createdAt: string;
enabled: boolean;
id: string;
lastAttemptAt: string | null;
maxAttemptsPerDay: number;
organisationId: string;
thresholdCredits: number;
topupPackageId: string;
updatedAt: string;
}
| null>;Update auto top-up configuration Update the auto top-up configuration for an organisation
Parameters#
| Parameter | Type |
|---|---|
request | { enabled: boolean; thresholdCredits: number; topupPackageId: string; } |
request.enabled | boolean |
request.thresholdCredits? | number |
request.topupPackageId? | string |
requestOptions? | RequestOptions |
Returns#
Promise<
| {
attemptsToday: number;
createdAt: string;
enabled: boolean;
id: string;
lastAttemptAt: string | null;
maxAttemptsPerDay: number;
organisationId: string;
thresholdCredits: number;
topupPackageId: string;
updatedAt: string;
}
| null>
Operation Id#
updateAutoTopup