#lucas

1 messages ยท Page 1 of 1 (latest)

tidal magnetBOT
near pier
#

Hello ๐Ÿ‘‹
Did you use test clocks with the scheduled subscription?

maiden lintel
#

the subscription in question - sub_1NAzbjEk6sr5GyDhSMtYCOE0

i make a subscription schedule with two phases in order to move the "seam" between the phases so the invoice sends earlier or later based on a customer or support request. i also move the billing anchor to the phase start of the second phase so it tracks along.

somehow this subscription got "stuck" and no matter what i do, it thinks the next invoice date should be june 2nd.

two screenshots shared, one with a subscription schedule applied to attempt to move the next invoice, one where i remove the schedule to demonstrate that june 2nd is still the supposed next invoice date

how do i reset it to the usual recurrence window based on the product price recurrences when removing the schedule, and why isnt adding the schedule moving the next invoice date accordingly?

#

๐Ÿค” i dont thiiiink so, is i didnt, but my QA may have. is there a way to check for sure?

near pier
#

yeah its not a test clock subscription, I checked.

maiden lintel
#

here's the snippet im using for the schedule, for reference

  return stripe.subscriptionSchedules.update(subSchedule.id, {
    end_behavior: 'release',
    phases: [
      {
        items: subModItems,
        start_date: subSchedule.current_phase.start_date,
        end_date: dayjs(date).utc().unix(),
        proration_behavior: 'none',
      },
      {
        items: subModItems,
        start_date: dayjs(date).utc().unix(),
        proration_behavior: 'none',
        billing_cycle_anchor: 'phase_start',
      },
    ],
  });
near pier
maiden lintel
#

okay im not explaining very well, if you focus on the screenshot with the phase applied, my main question here is why is the next invoice june 2nd when i sent that phase update with the attempt to move the next invoice date to june 14th? i want to move june 2nd -> june 14th

near pier
#

Oh my bad, I looked at the second screenshot and thought your question was why the phase isn't showing anymore ๐Ÿ˜… sorry

maiden lintel
#

no worries!

near pier
#

What are you seeing when you call Upcoming invoice API?

#

Do you see the same date? June 2nd?

maiden lintel
#

yeah june 2nd for the period end on stripe invoices upcoming --customer=cus_NwtA0Xyr8lu3wq

#

ive been messing with this one subscription quite a lot as you noticed, so i wouldnt be surprised if i set something whack at some point, but it makes me nervous since i intend on eventually releasing that phase approach above to our customer base especially if i dont even know how to reset it back to normal ๐Ÿ˜ฉ

near pier
#

I see the billing cycle anchor on the subscription is still June 2nd

#

I wonder if its due to the subscription phase still being "pending"

maiden lintel
#

do you think im setting the billing anchor wrong when i pass the phases? ah

near pier
#

Like in your phase, you're setting start date on 2023-05-26 13:41:12

maiden lintel
#

yeah - that was honestly the only thing the api liked, if you dont pass it, the api call balks. passing it with the current phase start date was the recommended approach from the last time i chatted with another support staff

#

but let me know if youd like me to try other approaches... going into some meetings but want to keep the convo going

near pier
#

Can you share the request ID where updating the current phase returned an error?
I believe what's happening here is,

You have a new phase starting on 2023-05-26 13:41:12 that sets the anchor to June 14 but since it isn't the current phase, it still has the previous date June 2nd as the billing date

If you update the "current" phase, it should update the underlying subscription too
https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating

tidal magnetBOT
maiden lintel
#

ah okay

#

just to rephrase so i know what you're asking, you want me to try the phase update without passing a start_date for the first phase, correct?

summer fiber
#

I don't think that was the suggestion, hanzo was talking about the next phases start but I am still trying to catch up on the context.

#

Would you mind restating what you are trying to do with this subscription. Move the next phase to start on Jun 14 instead of starting on June 2?

maiden lintel
#

yeah to restate -

10k ft view im trying to move the next invoice date to any arbitrary date, no proration, always aligning the billing anchor. we ship physical products on certain dates so once we get a successful invoice we pluck products off and send to pharmacy fulfillment

this particular subscription ive been using the linked subscription/phases approach earlier to attempt to move that next invoice, however, now when i add new subscription phases the next upcoming invoice date does not move, also when i remove the schedule/phases entirely, it still doesnt move (my expectation here is that when the schedule is removed, the billing anchor would reset to the regular cadence)

#

so yeah in the previous screen, 10000ft i want the upcoming invoice updated to june 14th instead of june 2nd, however thats implemented

summer fiber
#

Gotcha, so one thing to keep in mind here is that the subscription object itself does not know about the schedule that is managing it (outside of knowing its ID)

#

So even if in practice the phase will change and delay the next invoice from being sent, a lot of things in our system will still show the next invoice's timestamp as when the subscription would cycle without the schedule

#

Have you tested this with a test clock to see if an invoice is actually sent on the right date?

#

We can figure out how to make sure your integration knows the actual next date of the invoice, but I think it would be good to test your schedule with a test clock first to confirm when the next invoice will actually be sent

maiden lintel
#

sure yeah, bout to go into a meeting but will attempt soon

#

thats really interesting, so even if the supposed next invoice date in the stripe UI says june 2nd, the schedule and phases are the source of truth, meaning, if there is an update in phases saying the billing cycle will reset on june 14th instead, june 14th will be the "true" next invoice

summer fiber
#

Yeah, so you would need to add custom logic to check if your subscription has a schedule and if so if your next update is intended to push back the cycle date