#ajivrajani_api

1 messages ยท Page 1 of 1 (latest)

elder boneBOT
#

๐Ÿ‘‹ 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/1270128219009585262

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

silk bear
#

Hi there

broken blade
#

Hello! ๐Ÿ‘‹

#

Here's how I am appending a new phase to the subscription schedule:

        // append new phase to existing phases
    phasesForUpdate = append(phasesForUpdate, &stripe.SubscriptionSchedulePhaseParams{
        ProrationBehavior: stripe.String(string(stripe.SubscriptionSchedulePhaseProrationBehaviorAlwaysInvoice)),
        Items: []*stripe.SubscriptionSchedulePhaseItemParams{
            {
                Price: stripe.String(increasedPriceID),
                // quantity remains unchanged 
                Quantity: stripe.Int64(schedule.Phases[numberOfPhases-1].Items[0].Quantity),
            },
        },
        EndDate: stripe.Int64(newPhaseEndDateTime),
    })

    finalUpdatedSchedule, err := sClient.SubscriptionSchedules.Update(schedule.ID, &stripe.SubscriptionScheduleParams{
        Phases: phasesForUpdate,
    })
silk bear
#

Hmm

#

I see the underlying Subscription currently has collection_method: 'send_invoice'

broken blade
#

yes, it does

silk bear
#

Okay, I think this is a known issue. Give me a few more minutes

broken blade
#

Thank you ๐Ÿ™

silk bear
#

Okay, so the Subscription Schedule's default_settings use collection_method: 'charge_automatically, so I think we're pulling this value for the phase you're adding

#

If you pass collection_method: 'send_invoice' for the new phase you're creating, do you get the same error?

broken blade
#

I am not sure. I need to try. Do you mind leaving this thread open for a few minutes and I can try that?

silk bear
#

Sure thing!

broken blade
#

Thank you!

#

Okay I am going to include collection method in the request now:

#

Looks like I need to specify the days until due as well:

#

Wohoo! That worked - req_VhwZfOoDNwUmMD. Thanks @silk bear ! If you don't mind, can you sanity check the request I created?

silk bear
#

Great! Yep, this looks right

broken blade
#

Awesome - thanks a lot! Have a wonderful rest of your week ๐Ÿ™‚