Class: BillingService
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:25
Extends
BaseService
Constructors
Constructor
new BillingService(
client):BillingService
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:12
Parameters
client
Returns
BillingService
Inherited from
BaseService.constructor
Properties
client
protectedclient:TanqoryClient
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:10
Inherited from
BaseService.client
Methods
addPaymentMethod()
addPaymentMethod(
storeId,data):Promise<{cardBrand:string;cardExpMonth:number;cardExpYear:number;cardLast4:string;createdAt:string;id:string;isDefault:boolean;paypalEmail:string;stripePaymentMethodId:string;type:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:74
Add a payment method
Parameters
storeId
string
data
isDefault?
boolean
paymentMethodId?
string
setAsDefault?
boolean
stripePaymentMethodId?
string
Returns
Promise<{ cardBrand: string; cardExpMonth: number; cardExpYear: number; cardLast4: string; createdAt: string; id: string; isDefault: boolean; paypalEmail: string; stripePaymentMethodId: string; type: string; }>
Deprecated
Use SubscriptionService.addPaymentMethod instead
addTaxId()
addTaxId(
storeId,data):Promise<{taxId:string;taxIdType:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:149
Add/Update store's tax ID information
Parameters
storeId
string
data
taxId
string
taxIdType?
string
Returns
Promise<{ taxId: string; taxIdType: string; }>
buildQuery()
protectedbuildQuery(options?):Record<string,any>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:26
Build query parameters
Parameters
options?
Returns
Record<string, any>
Inherited from
BaseService.buildQuery
generateIdempotencyKey()
protectedgenerateIdempotencyKey(prefix):string
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:19
Generate idempotency key
Parameters
prefix
string
Returns
string
Inherited from
BaseService.generateIdempotencyKey
getBillingPreferences()
getBillingPreferences(
storeId):Promise<{city:string;company:string;country:string;district:string;string;postalCode:string;province:string;state:string;street:string;subDistrict:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:116
Get store's billing preferences (email, company, address)
Parameters
storeId
string
Returns
Promise<{ city: string; company: string; country: string; district: string; email: string; postalCode: string; province: string; state: string; street: string; subDistrict: string; }>
getCurrentPlan()
getCurrentPlan(
storeId):Promise<{billingPeriod:string;currency:string;features:Record<string,unknown>;limits:Record<string,unknown>;nextBillingDate:string;planName:string;price:number;status:string;trialEndsAt:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:31
Get store's current plan details
Parameters
storeId
string
Returns
Promise<{ billingPeriod: string; currency: string; features: Record<string, unknown>; limits: Record<string, unknown>; nextBillingDate: string; planName: string; price: number; status: string; trialEndsAt: string; }>
getExportMimeType()
protectedgetExportMimeType(format):string
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:45
Get MIME type for export format
Parameters
format
string
Returns
string
Inherited from
BaseService.getExportMimeType
getInvoiceById()
getInvoiceById(
storeId,invoiceId):Promise<{createdAt:string;currency:string;discount:number;dueDate:string;hostedInvoiceUrl:string;id:string;invoiceDate:string;invoiceNumber:string;lineItems:object[];paidAt:string;pdfUrl:string;periodEnd:string;periodStart:string;status:string;stripeInvoiceId:string;subtotal:number;tax:number;totalAmount:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:191
Fetch a single invoice's full details (PDF URL, hosted URL, line items). API: GET /billing/stores/:storeId/invoices/:invoiceId
Parameters
storeId
string
invoiceId
string
Returns
Promise<{ createdAt: string; currency: string; discount: number; dueDate: string; hostedInvoiceUrl: string; id: string; invoiceDate: string; invoiceNumber: string; lineItems: object[]; paidAt: string; pdfUrl: string; periodEnd: string; periodStart: string; status: string; stripeInvoiceId: string; subtotal: number; tax: number; totalAmount: number; }>
getInvoices()
getInvoices(
storeId,params?):Promise<ListResponse<{createdAt:string;currency:string;discount:number;dueDate:string;hostedInvoiceUrl:string;id:string;invoiceDate:string;invoiceNumber:string;lineItems:object[];paidAt:string;pdfUrl:string;periodEnd:string;periodStart:string;status:string;stripeInvoiceId:string;subtotal:number;tax:number;totalAmount:number; }>>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:43
Get invoices for a store (paginated)
Parameters
storeId
string
params?
limit?
number
page?
number
Returns
Promise<ListResponse<{ createdAt: string; currency: string; discount: number; dueDate: string; hostedInvoiceUrl: string; id: string; invoiceDate: string; invoiceNumber: string; lineItems: object[]; paidAt: string; pdfUrl: string; periodEnd: string; periodStart: string; status: string; stripeInvoiceId: string; subtotal: number; tax: number; totalAmount: number; }>>
getTaxId()
getTaxId(
storeId):Promise<{taxId:string;taxIdType:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:142
Get store's tax ID information
Parameters
storeId
string
Returns
Promise<{ taxId: string; taxIdType: string; }>
getTaxIdFormat()
getTaxIdFormat(
storeId,countryCode):Promise<any>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:181
Get tax ID format for a specific country API: GET /billing/stores/:storeId/tax-id-format/:countryCode
Parameters
storeId
string
countryCode
string
Returns
Promise<any>
getUpcomingInvoice()
getUpcomingInvoice(
storeId):Promise<{createdAt:string;currency:string;discount:number;dueDate:string;hostedInvoiceUrl:string;id:string;invoiceDate:string;invoiceNumber:string;lineItems:object[];paidAt:string;pdfUrl:string;periodEnd:string;periodStart:string;status:string;stripeInvoiceId:string;subtotal:number;tax:number;totalAmount:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:202
Preview the next invoice for the active subscription. API: GET /billing/stores/:storeId/upcoming-invoice
Parameters
storeId
string
Returns
Promise<{ createdAt: string; currency: string; discount: number; dueDate: string; hostedInvoiceUrl: string; id: string; invoiceDate: string; invoiceNumber: string; lineItems: object[]; paidAt: string; pdfUrl: string; periodEnd: string; periodStart: string; status: string; stripeInvoiceId: string; subtotal: number; tax: number; totalAmount: number; }>
listPaymentMethods()
listPaymentMethods(
storeId):Promise<object[]>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:63
List payment methods for a store
Parameters
storeId
string
Returns
Promise<object[]>
Deprecated
Use SubscriptionService.listPaymentMethods instead
removePaymentMethod()
removePaymentMethod(
storeId,paymentMethodId):Promise<DeletedResponse>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:89
Remove a payment method
Parameters
storeId
string
paymentMethodId
string
Returns
Promise<DeletedResponse>
Deprecated
Use SubscriptionService.removePaymentMethod instead
setDefaultPaymentMethod()
setDefaultPaymentMethod(
storeId,data):Promise<{cardBrand:string;cardExpMonth:number;cardExpYear:number;cardLast4:string;createdAt:string;id:string;isDefault:boolean;paypalEmail:string;stripePaymentMethodId:string;type:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:100
Set default payment method
Parameters
storeId
string
data
paymentMethodId
string
Returns
Promise<{ cardBrand: string; cardExpMonth: number; cardExpYear: number; cardLast4: string; createdAt: string; id: string; isDefault: boolean; paypalEmail: string; stripePaymentMethodId: string; type: string; }>
Deprecated
Use SubscriptionService.setDefaultPaymentMethod instead
updateBillingPreferences()
updateBillingPreferences(
storeId,data):Promise<{city:string;company:string;country:string;district:string;string;postalCode:string;province:string;state:string;street:string;subDistrict:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:126
Update store's billing preferences
Parameters
storeId
string
data
city?
string
company?
string
country?
string
district?
string
email?
string
postalCode?
string
province?
string
state?
string
street?
string
subDistrict?
string
Returns
Promise<{ city: string; company: string; country: string; district: string; email: string; postalCode: string; province: string; state: string; street: string; subDistrict: string; }>
updateTaxId()
updateTaxId(
storeId,data):Promise<{taxId:string;taxIdType:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:158
Update store's tax ID information
Parameters
storeId
string
data
taxId
string
taxIdType
string
Returns
Promise<{ taxId: string; taxIdType: string; }>
validateTaxId()
validateTaxId(
storeId,data):Promise<{isValid:boolean;message:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/billing.ts:167
Validate tax ID format for a specific country
Parameters
storeId
string
data
countryCode
string
taxId
string
Returns
Promise<{ isValid: boolean; message: string; }>