#Yashish

1 messages · Page 1 of 1 (latest)

obsidian burrowBOT
tall haven
#

The Customer Portal cannot be used to make payments but you can have the update create a new Invoice and send your user to the Invoice's Stripe-hosted page

south yoke
#

in python would this be a correct way?

session = stripe.checkout.Session.create( customer=customer_id, payment_method_types=['card'], subscription_data={ 'items': [{ 'plan': new_plan_id, }], }, success_url='https://example.com/success', cancel_url='https://example.com/cancel', )

tall haven
#

You can't update plans with Checkout unfortunately. That would create a new subscription

south yoke
#

so if we want to update the plan and allow the user to make the payment by open the stripe session then how can we do that

tall haven
#
south yoke
#

can you please provide with some code example

tall haven
#

I don't think we have sample code that explicitly shows linking to the new invoice but it is pretty Straightforward

#

You would check the latest_invoice property on your subscription after you have updated it. That property will have an invoice ID (in_1234) that you can use to retrieve the invoice and send the user to that URL

south yoke
#

how we can do this

And then send your user to the new invoice's hosted_invoice_url

tall haven
#

You can either give them a link to it on your page or you can cause a redirect to that URL

#

Usually redirects are either done with Javascript or by having your server return a 303 redirect

#

So if you want the redirect to be manual from the user, you can give them a link or button to click on for it

#

If you want the redirect to be automatic after the user clicks to upgrade your subscription, you can have your server make the update, find the URL, and return a 303 redirect to it

south yoke
#

not abe to fully understand it.

tall haven
#

Which part do you understand? I can try to re-explain the rest