#josula_api

1 messages ยท Page 1 of 1 (latest)

quaint quiverBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1334152510071640086

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

fiery idol
#

๐Ÿ‘‹ happy to help

#

are you manually creating the invoice?

timid spruce
#

Nope

#

all via API

#

our flow is:

  1. check if customer exists (via stripe id), if not create customer, else return stripe customer
  2. create invoice via API
  3. Add invoice items via API
  4. finalise invoice
fiery idol
#

what I meant by manually creating the invoice is mainly in relation to whether this is related or not to subscriptions

timid spruce
#

No

#

we do not have subs

timid spruce
#

its one time payments

#
    const invoice = await stripe.invoices.create({
      customer: stripeCustomer.id,
      collection_method: "send_invoice",
      auto_advance: false,
      currency: "eur",
      days_until_due: new Decimal(30).toNumber(),
      shipping_cost: {
        shipping_rate_data: {
          display_name: cart.shipping_methods?.[0]?.name || "Versand",
          type: "fixed_amount",
          fixed_amount: {
            amount: new Decimal(cart.shipping_methods?.[0]?.amount as number)
              .times(100)
              .toNumber(),
            currency: "eur",
          },
        },
      },
      custom_fields: [
        ...(cart.metadata?.internal_order_id
          ? [
              {
#

Does that make sense? See how we can only link it to a single customer via id? I would love to assign the customer but also set an invoice email here that takes precedence over the customer's email but the invoice should be still linked to the customer object.

fiery idol
#

I know what you mean

timid spruce
#

Is there a best practice for that? ๐Ÿ˜…

fiery idol
#

unfortunately that's not possible today ๐Ÿ˜ฆ

timid spruce
#

So what would you do? Update the customer's email every single time?

#

Or create a new customer object?

#

both seems very error prone

fiery idol
#

I agree with you

#

but we don't have any other solutions today for that

#

this is really good feedback to submit to https://support.stripe.com/?contact=true