#GazalaM - subscripiton updates

1 messages ยท Page 1 of 1 (latest)

naive coyote
#

HI ๐Ÿ‘‹
That's a lot of text. Give me a sec

keen haven
naive coyote
#

Okay, looking at that first invoice

#

Hmmm I'm having trouble identifying where that second Invoice Item is coming from. Did you have a one-off invoice item created for the customer?

#

A new invoice will sweep up outstanding invoice items for a specific customer

keen haven
#

Nope, no one-off invoice items. It may just be a quirk of the test clock and the price which is not exclusively meant for test clocks?

naive coyote
#

As long as the Customer and Subscription are Test Clock specific then the price shouldn't be an issue.

keen haven
#

My basic concern is how the timestamps should be - I'm just using UTC timestamps, but my account is in CET. Should I be worried about Daylight savings time, or does stripe calculate billing only in epoch UTC time?

naive coyote
#

Stripe billing is UTC. So you should be good there

#

All the invoices I am seeing are for the 2,008 total.

#

Except that first one with the one-off invoice item

keen haven
#

Good point, the last one is still an upcoming invoice, let me try to advance the clock another month to make it a real invoice.

#

Yup, this last invoice is with a lower amount: in_1LJJzyHfRoBp5g8K8xTbj1Uk

keen haven
naive coyote
#

I'm seeing one field that suggests a credit note may have been generated and the price prorated. Still trying to track down how that happened.

keen haven
#

Woah, this is also happening with a non-clock test customer: in_1LJKOoHfRoBp5g8KByaX1Vz1

naive coyote
#

You mean the one-off charges?

#

Oh...it's a proration

#

kind proration

#

Okay so I think something wonky is going on with the timestamps being used here.

#

The extra invoice item is a proration on the recurring price object.

#

With the following attributes:

proration_end    2022-07-08 16:51:25 +0000 (1657299085.0, 9 minutes ago)
proration_start    2022-07-08 00:00:00 +0000 (1657238400.0, 17 hours ago)
time_fraction    0.02265718339307049
#

So during the initial creation it appears your user is getting a prorated bill for an additional ~17 hours of the service. High price for a fancy car.

keen haven
#

Ah yes, and I cannot use proration=None since some of the backdates are weeks ago (which we want to charge them for).
I tried a workaround that I used before by setting the billing cycle anchor to the next month, and this avoids the extra few hours of prorations!

#

Thanks so much for your help! I'm happy with this workaround, we can close the thread here.
Fix for future readers: Use billing cycle anchor set to the next moth.
{ "backdate_start_date": "1657238400", "billing_cycle_anchor": "1659916800", "customer": "cus_LvDh95SJKwL9jD", "items": { "0": { "price": "price_1LJE80HfRoBp5g8KKaU64J6u" } }, "cancel_at": "1673136000" }

naive coyote
#

Okay great! Honestly testing subscriptions with sub schedules, back dates and such is one of the most complex topics at Stripe.