#Sharvari96

1 messages · Page 1 of 1 (latest)

haughty kettleBOT
eternal wing
frigid monolith
#

thanks!

frigid monolith
#

Are events ordered in some way?
Can I take a given event Id and look for the next/previous event associated with it?

eternal wing
#

Do you mean webhook events?

#

Or different events?

frigid monolith
#

webhook events

eternal wing
#

They are on time order, but it's quite common you can have mutltiple events triggered by same action, and we can't guarantee their order in that case

frigid monolith
#

Ok

#

How do I add another line item to this invoice with its own price?

#

This is how I am creating invoice and sending it currently:

    product = stripe.Product.create(
        name=f"invoice product {invoice_request.order_id}",
        metadata={"project_id": invoice_request.order_id},
        default_price_data={"currency": "USD", "unit_amount": amount},
    )

    # Get the default price of the product
    price = product.default_price

    # Create an invoice with the customer ID and days until due
    invoice = stripe.Invoice.create(
        customer=invoice_request.customer_id,
        collection_method="send_invoice",
        days_until_due=invoice_request.days_until_due,
    )

    # Create an invoice item with the price and invoice ID
    stripe.InvoiceItem.create(
        customer=invoice_request.customer_id,
        price=price,
        invoice=invoice.id,
    )

    # Send the invoice
    invoice = stripe.Invoice.send_invoice(invoice.id)
eternal wing
#

Your code looks fine to me, and if you want to have more line item, you can call more of stripe.InvoiceItem.create( function

#

You can have an Invoice with 5 different InvoiceItem, each from different price

#

But this is only before finalizing the Invoice

frigid monolith
#

ok
got it

#

thanks!

#

will try it and ask if I have follow up questions

#

that worked thank you!
now I will be looking into Stripe Identiy to setup the identity verification for connect accounts.

I will have questions on that probably later on. You can close the thread if you want.