#mir_subscription-cancellation

1 messages ยท Page 1 of 1 (latest)

slender matrixBOT
#

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

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

winter oracle
#

Hey @slender matrix

upbeat geyser
winter oracle
#

i tried

#

It cancel trial but also cancel subscriptions

upbeat geyser
winter oracle
#

want to allow customers who are currently on a free trial for a subscription to end their trial early, start paying immediately, and continue their subscription with the same price plan. The goal is to charge the customer without canceling their subscription or affecting the recurring billing cycle.

winter oracle
#

And req_9vXAOQtMDIiob2

#

here it charge customer: req_9vXAOQtMDIiob2

here stripe cancel subscription : req_oCcJpabyLTjYpt

upbeat geyser
#

Taking a look

slender matrixBOT
winter oracle
#

This might help you to understand

What i Want:
Customer Decides to Pay Early: The customer decides they want to start using the "Pro Plan" immediately without waiting for the trial to end. They want to pay the $10 right now and start the monthly billing.

End Trial and Charge Immediately:

i want to end their free trial immediately, charge them $10 for the current month, and start their subscription.
The customer should be billed immediately for the full $10, and their subscription should continue to bill $10 per month thereafter, as if the trial never existed.
Subscription Continuity:

After this charge, the customer's subscription should remain active with the same price_id (no changes to the plan), and they should continue to be billed $10 per month on the regular billing cycle.

upbeat geyser
#

I tested this on my end, and passing trial_end: 'now', does not immediately delete the subscription. I'm looking if a setting is at play here, hang tight

honest crow
#

To be clear, the deletion is not from Stripe? Like that request you shared came from your code

#

mir_subscription-cancellation

winter oracle
#

Let me check

#

I think i found issue,

thank you guys

winter oracle
#

i figured it out.

#

I am using below code:

const updatedSubscription = await newStripe.subscriptions.update(
  subscription.id,
  {
    trial_end: 'now',
    billing_cycle_anchor: 'now',
    proration_behavior: 'create_prorations',
  }
);
honest crow
#

sure thing!

winter oracle
#

What should be ideal:

proration_behavior
and billing_cycle_anchor

values for my case?

#

THis is my usecase:

What i Want:
Customer Decides to Pay Early: The customer decides they want to start using the "Pro Plan" immediately without waiting for the trial to end. They want to pay the $10 right now and start the monthly billing.

End Trial and Charge Immediately:

i want to end their free trial immediately, charge them $10 for the current month, and start their subscription.
The customer should be billed immediately for the full $10, and their subscription should continue to bill $10 per month thereafter, as if the trial never existed.
Subscription Continuity:

After this charge, the customer's subscription should remain active with the same price_id (no changes to the plan), and they should continue to be billed $10 per month on the regular billing cycle.

honest crow
#

I mean what you have is totally fine? Just do not cancel that Subscription

honest crow
#

If you hit another error though I am happy to look but what you mentioned is correct

#

in a way you technically only need trial_end: 'now'

winter oracle
#

Okay, one last question: How can I verify if the charge was successful? Should I rely on a webhook to check this, or will I receive any confirmation in the response when I update the subscription?

honest crow
#

The Subscription has the latest_invoice property which is the id of the most recent Invoice. That Subscription is ending a trial so an Invoice would be issued.
It also has status which shows the current status of the Subscription such as trialing, active or past_due
So what you can do is look at status and also then look at the associated Invoice to see what happened.
And the Invoice itself has a PaymentIntent that would show succeeded or not in its own status.

winter oracle
#

I can do this:

expand: ['latest_invoice.payment_intent'],

right?

honest crow
#

exactly!

winter oracle
#

payment_intent.payment_intent status is success means payment done.

right?

honest crow
#

yes

winter oracle
#

having
"status": "paid" on pi

#

this is the object i receive