Environment : NodeJS
Language : Typescript
I am trying to add Tax Rates to my InvoiceItems, but it seems that the Stripe package does not follow the API doc.
Here is my code :
newInvoiceItem = await this.stripe.invoiceItems.create({
customer: billingUser.billingData.customerID,
currency: this.settings.currency.toLocaleLowerCase(),
amount: Math.round(transaction.stop.roundedPrice * 100),
description: description,
tax_rates: defaultTax
}, {
idempotency_key: idemPotencyKey.keyNewInvoiceItem
});
Documentation says a tax_rates
field is available, but this field isn't in Stripe package.
Triggered error:
TS2769: No overload matches this call.
Overload 1 of 2, '(data: InvoiceItemCreationOptions, options: HeaderOptions, response?: IResponseFn<InvoiceItem>): Promise<InvoiceItem>', gave the following error. Argument of type '{ customer: string; currency: string; amount: number; description: string; tax_rates: ITaxRate; }' is not assignable to parameter of type 'InvoiceItemCreationOptions'. Object literal may only specify known properties, and 'tax_rates' does not exist in type 'InvoiceItemCreationOptions'.
Overload 2 of 2, '(data: InvoiceItemCreationOptions, response?: IResponseFn<InvoiceItem>): Promise<InvoiceItem>', gave the following error. Argument of type '{ customer: string; currency: string; amount: number; description: string; tax_rates: ITaxRate; }' is not assignable to parameter of type 'InvoiceItemCreationOptions'. Object literal may only specify known properties, and 'tax_rates' does not exist in type 'InvoiceItemCreationOptions'
Available fields in InvoiceItemCreationOptions
seen in module Stripe (index.d.ts):
amount?: number;
currency: string;
customer: string;
description?: string;
discountable?: boolean;
invoice?: string;
quantity?: number;
subscription?: string;
unit_amount?: number;
My current Stripe module version is 7.13.19 (latest version from npm i @types/stripe
)
Is the documentation erroneous or am I doing wrong ?