#praveen-soni_code

1 messages ยท Page 1 of 1 (latest)

peak pendantBOT
#

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

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

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

maiden heart
#

๐Ÿ‘‹ happy to help

balmy timber
#

Pause collection is not working on scheduled subscription

maiden heart
balmy timber
#

Any code?

#

No code available to understand

maiden heart
#

you pause the underlying subscription on the schedule

balmy timber
#

I don't understand

peak pendantBOT
maiden heart
balmy timber
#

I didn't understand... can you please share code

runic solstice
#

Hi @balmy timber as I mentioned yesterday, we can't write code for you here. Please refer to the documentation to build the solution yourself.

runic solstice
# maiden heart you pause the underlying subscription on the schedule

To clarify what was mentioned above, each SubscriptionSchedule has a Subscription attached to it. You can find this Subscription ID under the parameter that my colleague shared.
Instead of pausing the collection on SubscriptionSchedule itself, you can pause collection on the attached Subscription.

balmy timber
#

But it says you cannot update the subscription that has a scheduled attached.

runic solstice
#

It's possible that you can't pause collection on SubscriptionSchedules.

balmy timber
runic solstice
balmy timber
#

I understand but my client want to pause it and show the pause status on stripe too

runic solstice
balmy timber
#

Instead of this

#

Can we set 3 months durations of cancellation?

if (!empty($subscription->schedule)) {
                                    // scheduled downgrade subscription
                                    \Stripe\SubscriptionSchedule::update($subscription->schedule,['end_behavior' => 'cancel'] );
                                } else {
                                    // normal subscription
                                    \Stripe\Subscription::update($getsubscription->stripe_id, [
                                        'cancel_at_period_end' => true,
                               
     ]);
                                }
runic solstice
#

You want to cancel Subscription after 3 months, instead of the end of this billing cycle, right?

balmy timber
#

Yes my client's requirement is user's subscription can be paused and resumed within 3 months. After that it be permanently canceled.

runic solstice
balmy timber
#

it will work for both subscription and scheduled subscription?

#

Pause the subscription for 3 months

runic solstice
balmy timber
#

In this case payment will be collected

#

But the subscription needs to be paused for 3 months

#

and resumed again within 3 months

runic solstice
#

For Subscription you can pause collection as you did above.
But you can't pause collection for SubscriptionSchedules, as we found out today.
You will need to release the SubscriptionSchedule, and then treat it as regular Subscription.

balmy timber
runic solstice
#

What is "the downgrade subscription"?

balmy timber
#

I have scheduled downgrade subscription

runic solstice
#

Yes, you will loose this phase when you release SubscriptionSchedule.

balmy timber
#

Any other solution?

runic solstice
#

No, I don't think so. If the customer decides to resume, you will need to turn the Subscription back into a SubscriptionSchedule and add the downgrade phase.

balmy timber
#

\Stripe\Subscription::update($subscriptionId, [
'pause_collection' => [
'behavior' => 'mark_uncollectible',
],
]);

This will work right

runic solstice
#

Depending on what you want to achieve.

balmy timber
#

'end_behavior' => 'release'

#

Did you mean by this?