#mathijsfrenken - subscription
1 messages · Page 1 of 1 (latest)
Hi, are you able to clarify why you'd expect to see an active subscription here after the subscription has been cancelled? Are you able to provide step by step on how I can reproduce this on my end to better assist?
What I have done:
-
Customer has chosen a subscription and I add the customer id and subscription id to my database from my webhook.
-
After that a customer can open the customer portal with the stripe customer id and I get a correct portal like the second image ("portal_when_active.png") shows.
-
I cancel the subscription in the stripe dashboard for said customer.
-
I get an customer deleted event. (Don't know how to correctly respond to this event)
-
Customer opens portal and it shows the first image ("portal_after_subscription.png"). It doesn't show renew subscription or chose a subscription.
My expectation:
A renew subscription button or being able to chose a subscription after a subscription has been canceled.
Got it, this is very helpful -- thank you.
Currently, we do not support this. We received some feedback on this from other users as well and the team is actively looking to add more features. Again, thank you for sharing this.
As for creating new subscription, the recommendation is to use Checkout for Subscription. You could redirect them to checkout for new subscriptions where you add one more button on the Customer Portal.
If I direct the customer to a new checkout session. Does this mean I create a new customer in stripe and the customer must pass his payment information again?
If a stripe customer exists in my database I currently do this:
session = stripe.billing_portal.Session.create( customer=customer_id )
The first time a customer opens checkout like so:
checkout_session = stripe.checkout.Session.create( success_url='https://loremipsum.com&session_id={CHECKOUT_SESSION_ID}', cancel_url='https://loremipsum.com', payment_method_types=['card', 'sepa_debit'], mode='subscription', automatic_tax={ "enabled": True, }, line_items=[{ 'price': price_id, # For metered billing, do not pass quantity 'quantity': 1 }], )
You do not need to create a new customer as you have not deleted the customer. The subscription is deleted but not the customer. So you can pass the customer parameter to the checkout. Now, on to the payment method question...
Checkout can surface any payment method that is already attached to the customer or your customer can choose to add a new payment method instead.
Alternatively, you could use the API call to create a subscription, https://stripe.com/docs/api/subscriptions/create and pass the default_payment_method parameter: https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.