#bibek_code

1 messages ยท Page 1 of 1 (latest)

acoustic nebulaBOT
#

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

๐Ÿ“ 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.

onyx halo
#

Hi, let me help you with this.

#

How were the 2 Invoices generated?

lunar stirrup
#

after the date is modified from stripe dashboard using simulation, and when checked in the invoices there were two invoice generated

#

could you check for this customer or subscription sub_1QCtwJGiCCUNo8Cbuex4fgCr and cus_R544S5ZxeM1KRH

onyx halo
#

How did you pick the end date of the current phase?

lunar stirrup
#

this is how i create the ScheduleSubscription :
`schedule = stripe.SubscriptionSchedule.create(
from_subscription=current_subscription.id,
)

                    first_phase = {
                        'items': [{
                            'price': schedule.phases[0].get('items')[0].price,
                            'quantity': schedule.phases[0].get('items')[0].quantity,
                        }],
                        'start_date': schedule.phases[0].start_date,
                        'end_date': schedule.phases[0].end_date,
                    }

                    if current_subscription.status == 'trialing':
                        first_phase['trial_end'] = schedule.phases[0].end_date

                    second_phase = {
                        'items': [{
                            'price_data': {
                                'currency': price.currency.code_for_stripe,
                                'product': current_app.config['STRIPE_PRODUCTS']['tier-product'],
                                'recurring': {
                                    'interval': interval
                                },
                                'unit_amount': price.price,
                            },
                        }],
                    }

                    stripe.SubscriptionSchedule.modify(
                        schedule.id,
                        phases=[first_phase, second_phase],
                    )`
onyx halo
#

Still looking...

#

Where do you see the 2 Invoices?

acoustic nebulaBOT
lunar stirrup
#

there are the invoices 1CAC733B-0003 and 1CAC733B-0002

onyx halo
#

Could you please share the Invoice IDs? in_xxx

lunar stirrup
glass orbit
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

#

when you click on one of them

lunar stirrup
glass orbit
#

please give me a minute

lunar stirrup
#

sure

glass orbit
#

I'm terribly sorry for keeping you waiting

glass orbit
# lunar stirrup

on the dashboard were exactly are you seeing this screenshot? could you send me the URL?

glass orbit
#

no not these URLs

#

I'm talking about the dashboard URL where you took this screenshot from

glass orbit
#

let's step back for a second here

#

are you creating a Customer Billing Portal Session for your customer to choose if they want to downgrade?

lunar stirrup
#

No

glass orbit
#

how the downgrade is being requested by the customer?

lunar stirrup
#

there is just a button from front end part after clicking it calls this code
`schedule = stripe.SubscriptionSchedule.create(
from_subscription=current_subscription.id,
)

                    first_phase = {
                        'items': [{
                            'price': schedule.phases[0].get('items')[0].price,
                            'quantity': schedule.phases[0].get('items')[0].quantity,
                        }],
                        'start_date': schedule.phases[0].start_date,
                        'end_date': schedule.phases[0].end_date,
                    }

                    if current_subscription.status == 'trialing':
                        first_phase['trial_end'] = schedule.phases[0].end_date

                    second_phase = {
                        'items': [{
                            'price_data': {
                                'currency': price.currency.code_for_stripe,
                                'product': current_app.config['STRIPE_PRODUCTS']['tier-product'],
                                'recurring': {
                                    'interval': interval
                                },
                                'unit_amount': price.price,
                            },
                        }],
                    }

                    stripe.SubscriptionSchedule.modify(
                        schedule.id,
                        phases=[first_phase, second_phase],
                    )`
glass orbit
#

this user has 2 different subscriptions

#
#

that's why you can see 2 different invoices

lunar stirrup
#

isn't that due to the downgrade ?

glass orbit
#

no

lunar stirrup
#

it means downgrade functional part is okey.

glass orbit
#

you need to use test clocks to advance the time and see how the subscription is changed after a month

lunar stirrup
#

the downgrade plan which is in the 2nd item of the phase will last forever until the subscription is canceled right ?

glass orbit
#

yes

#

and you can set the end_behavior of the subscription schedule to be release so that you no longer need to deal with that type of object in the future

lunar stirrup
#

if i set end_behavior to release and no iterations set what will happen, does it will return to initial subscription type and schedule is canceled or something else ?

acoustic nebulaBOT
opal gale
#

hi! I'm taking over this thread.

#

the Schedule will stop, and the Subscription itself will continue with no changes

#

I recommend testing this in test mode to see how this works.

lunar stirrup
#

if there is no iteration in the last phase after how much time interval it will release ?