#Mael CHEMLA

1 messages ยท Page 1 of 1 (latest)

flint echoBOT
jovial grove
#

๐Ÿ‘‹

#

What API Version are you using?

#

And are you setting anything for pending_invoice_items_behavior?

#

Also in your screenshot it looks like you have 2 invoices and 2 invoice items

obsidian crystal
#

Hello, I create my invoice like that

public createInvoice = async (operation: Operation, stripeAccountId: string, stripeCustomerId: string): Promise<Stripe.Response<Stripe.Invoice>> => {
        await this.stripe.invoiceItems.create({
            description: operation.operationType.name,
            currency: "eur",
            quantity: 1,
            unit_amount: operation.amount * 100,
            customer: stripeCustomerId
        }, {
            stripeAccount: stripeAccountId
        });

        const invoiceDraft = await this.stripe.invoices.create({
            customer: stripeCustomerId,
            metadata: {
                operationId: operation.id
            },
        }, {
            stripeAccount: stripeAccountId
        });

        const invoicePaid = await this.stripe.invoices.pay(
            invoiceDraft.id,
            { paid_out_of_band: true },
            { stripeAccount: stripeAccountId }
        );

        return invoicePaid;
    };
jovial grove
#

Do you want the invoice to include the invoice item you previously created?

#

I'd assume so, if so try adding pending_invoice_items_behavior: 'include'

#

To your invoice creation request

obsidian crystal
#

yeah !

#

thanks I will do that

jovial grove
#

๐Ÿ‘