#jojilede

1 messages ยท Page 1 of 1 (latest)

ornate tangleBOT
trail spade
ashen token
#

I see, how does it work? Do I call stripe.create.invoice then stripe.create.invoice item?

#

or can I do them both?

trail spade
#

you do each call separately, in the guide I shared above explains that step by step

ashen token
#

ah yes I saw it.

#

thanks for helping ๐Ÿ˜„

trail spade
#

Np!

ashen token
#

can I ask one more thing?

#

My invoice is not charging automatically:

  // Create an Invoice
  const invoice = await stripe.invoices.create({
    customer: req.body.customerId,
    collection_method: 'charge_automatically',
    auto_advance: true,
  });

  // Create an Invoice Item with the Price, and Customer you want to charge
  const invoiceItem = await stripe.invoiceItems.create({ 
    customer: req.body.customerId,
    price: req.body.oneTimePriceId,
    invoice: invoice.id,
    metadata: {
      initialQtyPaid: req.body.initialQtyPaid,
      subscriptionPriceId: req.body.subscriptionPriceId,
      lengthOfStaty: req.body.lengthOfStay,
      nextInvoiceDate: req.body.nextInvoiceDate,
      checkoutDate: req.body.checkoutDate,
    }
  });
};
storm umbra
#

Correct, you need to finalise it

ashen token
#

oh!

#

like this?:

const invoice = await stripe.invoices.create({
    customer: req.body.customerId,
    collection_method: 'charge_automatically',
    auto_advance: true,
  });

  // Create an Invoice Item with the Price, and Customer you want to charge
  const invoiceItem = await stripe.invoiceItems.create({ 
    customer: req.body.customerId,
    price: req.body.oneTimePriceId,
    invoice: invoice.id,
    metadata: {
      initialQtyPaid: req.body.initialQtyPaid,
      subscriptionPriceId: req.body.subscriptionPriceId,
      lengthOfStaty: req.body.lengthOfStay,
      nextInvoiceDate: req.body.nextInvoiceDate,
      checkoutDate: req.body.checkoutDate,
    }
  });

  const finalize = await stripe.invoices.finalizeInvoice(invoice.id);

storm umbra
#

Yep

ashen token
#

checking it now! ๐Ÿ˜„

#

may I know how long it stays open?

storm umbra
#

Depends, really. We can void/cancel them after X amount of failed payments if configured. Otherwise indefinitely until manually voided

ashen token
#

I mean, it says here it will be charged in 1 hr is that exactly 1 hr?

storm umbra
ashen token
#

alright, thanks!

ashen token
#

Hi may I know the timezone followed in stripe dashboard?

storm umbra
#

It'll be localised to your account/country timezone

ashen token
#

so, the time being referenced is set to the timezone of the person who set it up?

storm umbra
ashen token
#

I see.

#

here's my issue btw. I set a schedulesSubscription on Jun 1 and it's appearing as May 31 ๐Ÿ˜…

storm umbra
#

Can you share the sub_sched_xxx ID?

#

The API timestamps use UTC, so depending on the Dashboard setting it may show as a different date

ashen token
#

sure let me share it

#

sub_sched_1MQqvqDTISXyBnp6HudAp8ms

#

it shows this:

#

but i want june 01 and july 01

storm umbra
#

So you set it to 1685577600 via the API (which is 2023-06-01 00:00:00 UTC). I guess your Dashboard timezone is behind UTC

ashen token
#

yeah, how to make our dashboard in utc?

storm umbra
#

I sent you the link above

ashen token
#

ah!

#

gotcha

storm umbra
#

Kind of obvious from that screenshot, no? ๐Ÿ˜„

ashen token
#

yeah I just think with my hand on that part coz I got tired today ahha sorry

storm umbra
#

all good

ashen token
#

wow works like magic.

#

tysm!