pythonflaskstripe-paymentsstripes

In stripe update subscription plan without using customer portal


In my application i am using our pricing table so that the customer can choose which plan he wants to upgrade to, for upgrading the subscription i had done something like this:

modified_subscription = stripe.Subscription.modify( subscription, payment_behavior='default_incomplete', items=[{'id': sub_id['data'][0]['items']['data'][0]['id'], 'price': price.id}], collection_method="send_invoice", proration_behavior='always_invoice', days_until_due=1, cancel_at=datetime.utcnow() + timedelta(days=365), )

here i had given collection_method="send_invoice", which will invoice the customer when he wants to upgrade the subscription and days_until_due=1 is provided till when the customer can do the payment, but the issue i am facing is that i want the customer to first pay for the new subscription and then upgrade him to the new subscription. can anyone help me with this so that i can proceed ?

How can I modify my subscription upgrade process to ensure that customers pay for the new subscription before being upgraded to it?


Solution

  • You can create an one-off invoice for your customer, and only update the subscription when the invoice is paid successfully. You can also apply a coupon to the subscription and give them a discount for the amount that they already paid for the one-off invoice.