#mr-kapow_api

1 messages · Page 1 of 1 (latest)

small tartanBOT
#

👋 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/1365168835782770759

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

empty thistle
#

Yes so how was the Update Subscription API, with reseting billing_cycle_anchor to now?

drowsy cedar
#

That would result in the new subscription being from 1/24/25 to 1/24/26 which is not what I want.

I want to treat this as a inline upgrade where the month they paid for acts as the first month of their new annual plan.

#

I really want billing_cycle_anchor: subscription.current_period_start

But that's not possible on a subscription update or subscriptionSchedule

empty thistle
#

Ah I see

drowsy cedar
#

hmm just tried that, problem seems to be that phase1 still results in 4/24/25 to 4/24/26.

Here's what I tried:

[
      {
        items: [
          {
            price: oldPlan.id,
          },
        ],
        start_date: subscription.current_period_start,
        end_date: "now",
      },
      {
        items: [
          {
            price: newPlan.id,
          },
        ],
        start_date: "now",
        end_date: end_date, // 4/1/26 in our case
      },
      {
        items: [
          {
            price: newPlan.id,
          },
        ],
        start_date: end_date,
      },
    ]
#

Seems stripe hijacks things when it notices a change to the billing interval.

small tartanBOT
drowsy cedar
#

OK. I think the only solution is to cancel current subscription and create a new one and use backdate_start_date and billing_cycle_anchor

#

This'll work for me, though it's less ideal having to cancel the subscription and create a new one. It'd be nice to continue to use the same subscriptionId for customer consistency in dashboard.

next spindle
#

Hi @drowsy cedar I'm taking over this thread

#

Hmm looks like youset the start_date of the 2nd phase, and the end_date of the 1st phase to "now",

#

Can you change both of them to April 1 next year and try again?

drowsy cedar
#

well they are currently on the monthly plan, so the first phase I have there is from start of monthly period to "now". Note phase 1 is using oldPlan.id and not the new one.

next spindle
#

If you set both of them to now, it will start the 2nd phase immeidately, resulting the subscription to start with the annual plan on 4/24/25. Is thi what you want to achieve?

drowsy cedar
#

No, I want the new annual plan to have a start date of subscription.current_period_start (april 1st 2025) and an end date of 4/1/2026

next spindle
#

Exactly, and that's why I told you to set start_date of the 2nd phase, and the end_date of the 1st phase to April 1 next year

drowsy cedar
#

If I understand you right, you are suggesting:

phases: [
  {
    items: [
      {
        price: oldPlan.id,
      },
    ],
    start_date: subscription.current_period_start,
    end_date: periodStartPlusOneYear,
  },
  {
    items: [
      {
        price: newPlan.id,
      },
    ],
    start_date: periodStartPlusOneYear,
  },
],
#

oooh you're setting the monthly plan (oldPlan) to be the full year.

Hmmmm that could work.

Not sure how that plays out if this also includes a tier upgrade. Like tier 1 monthly -> tier 2 annual.

#

let me try this as is though

#

no that didn't seem to work.. and I actually want them to be on the newPlan.id priceId right away.

next spindle
#

Ah, sorry I misread your requirements . Hmm I don’t think you can backdate an existing subscription

drowsy cedar
#

right, nor update the current subscription from month -> year without stripe changing the billing cycle

#

I've got a working solution where I cancel the existing subscription and backdate the new one. Less than perfect but should suffice.

#

Thanks for going down this rabbit hole with me