#jkimling

1 messages ยท Page 1 of 1 (latest)

gray urchinBOT
acoustic heart
#

Ok i read the thread about the subscription schedule you're trying to make. If you're having an issue with Connect now, did you get all the schedule setup working like you wanted?

#

Whats the issue you're having with Connect?

dreamy stump
#

Both scripts can be run with node. Script 1, stripe-subscription-schedule-issue-setup.js is to create the subscription, test clock, prices, and customer. Script 2, stripe-subscription-schedule-issue-recreate.js is to is to recreate the actual issue I'm seeing where I set dates for a subscription schedule update, but those dates don't seem to register when I advance the test clock

#

@acoustic heart the issue was always with updating a subscription schedule within a connect account

acoustic heart
#

Gotcha -- ok then to clarify: are you having trouble with the connect parts of what youre trying to do, or the details of the schedule?

acoustic heart
#

Unless there is some unexpected connect-related bug or limitation, these should be separate/unrelated

dreamy stump
acoustic heart
#

Got it, ok thanks. I'm looking over it now, but can you explain what part is not turning out as you expect?

dreamy stump
#

The last 3 print statements at the end of the second script show the new dates for 3 phases that I tried to update. I want phase 1 to last from Dec 6 to Dec 7, phase to to go from Dec 7 to Jan 7, and phase 3 to go to Nov 7 2023. But, when I go to the portal, it says my next invoice will send on Jan 6 and every month after that the 6th (I would like them to send on the 7th)

acoustic heart
#

Hmm ok, let me take a look

#

I think i can run these after replacing with my own custom connected account

acoustic heart
#

ok, it all ran

#

aside, i enjoy how much your test script reflect my own ๐Ÿ˜„

#
import testKey from '../.private/stripekeys.js';
import Stripe from 'stripe';
const stripe = new Stripe(testKey)

const timeout = ms => new Promise(res => setTimeout(res, ms));
const sleep = async seconds => {
  console.log(`Sleeping for ${seconds} second(s)...`);
  await timeout(seconds * 1000);
  console.log(`Done sleeping.`);
}

let stripeAccount
stripeAccount = 'acct_1123'

const runAsync = async () => {


}

runAsync();

#

I see the phases as expected and as you described

#

I think what I'm misunderstanding is what you're expecting with the upcoming invoices

dreamy stump
#

I expect that the second phase, which starts on Dec 7 and goes to Jan 7, sends an invoice immediately on Dec 7, so this would be my upcoming invoice. Then, invoices are sent monthly on the 7th starting on Jan 7

acoustic heart
#

when i get the upcoming invoice for the subscription as it exists after your scripts, its for invoicing Jan 6-Feb 6

#

THat's what you see too?

dreamy stump
#

Yeah that's what I see too

#

I want it to be for Dec 7-Jan 7

acoustic heart
#

My suspicion is that this is limited to the upcoming invoice behaviour, and that the invoice will behave as you intend according to the schedule

#

ie, this is not the real behaviour, but is the upcoming invoice endpoint responding with what it would produce being unaware of the scheduled changes

dreamy stump
#

But if I advance the test clock, I get the behavior indicated by the Upcoming Invoice field. Invoices are created on the 6th of the month (whereas I had scheduled the phases to start on the 7th)

#

I just advanced this subscription, which was created with my scripts sub_1MC76MQ6GyZ7WetFPhsM0k94 and I see this for invoices

acoustic heart
#

i was about to ask what happens when you advance

acoustic heart
#

oooooooooook

#

i think i've cracked it

#

i missed this because of a mismatch between the setup and update

#

when you first create the schedule, you're using billing_cycle_anchor: 'phase_start' on the second phase, as you should

#

but i think you have accidentally omitted the billing cycle anchor parameter when you update the schedule

#

so when the phase changes, the anchor stays on the 6th (which it can because both prices are monthly, the BCA reset is not mandatory)

#

you need to add billing_cycle_anchor: 'phase_start', into phase[1] in the subscriptionSchedules.update

dreamy stump
#

Beautiful, that did it. Thank you so much!

#

It's always just one line ๐Ÿ™ƒ

acoustic heart
#

excellent

#

yep, and a subtle one, too

#

i was looking for it earlier

#

found it in the create call, and dismissed it