#rasparac-subscriptions
1 messages · Page 1 of 1 (latest)
hi! no, there is not, the Subscription will create an Invoice on the billing period it's set to, and that will invoice will fail to be paid if the customer doesn't have a payment method configured(at which point you could for instance detect that with webhooks and withdraw access to your service until the customer rectifies it and pays the invoice).
Problem i have is that when user opens the checkout page we create a subscription and we return setup_intent secret and after the user enter credit card details we proceed with the payment through stripe js sdk. But if user leaves the checkout page, there will be subscription without payment method attached. User does not have access to our service if he did not enter the credit card details. So main problem is that we create subscription before user even entered credit card details.
Not sure how to resolve this. Should i control everything on backend?
yeah that is common feedback with the way our recommended integration works since it creates the Subscription before the card is accepted.
if you don't want that behaviour there's two real options :
a) use our hosted Checkout page instead of your own direct usage of the Subscriptions API + Elements, Checkout always collects the card details for trials upfront . https://stripe.com/docs/billing/subscriptions/checkout
b) change your integration so you collect the card first(via a SetupIntent) and then only create the trial Subscription after that succeeds(this is opposite to what our docs recommend but you can do it).
option b) is not an option :).
Is there a way just to listen for webhook that trial will expire and if there is no payment method just delete that subscription and in that case stripe will not try to bill?
curious why it's not! how about a then?
But yes, you can do exactly what you say if you want!
there's a customer.subscription.trial_will_end event. https://stripe.com/docs/api/events/types#event_types-customer.subscription.trial_will_end
I didn't mention that option because the other two were much easier and cleaner, but you can do that one too yep
ok. Thanks
Did not find a way to collect credit card details via SetupIntent.
This two examples, but don know how to connect setupintent with subscription.
https://stripe.com/docs/api/setup_intents/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hey, taking over from @drowsy moss – let me catch-up
Specifically regarding Setup Intents, this guide outlines how you'd create the SI and capture payment details before confirming: https://site-admin.stripe.com/docs/payments/save-and-reuse
The result of that, assuming successful 3DS/auth by your customer, is an authenticated Payment Method object (pm_xxx) that can be used when creating the Subscription