#aidasp-subscription-incomplete
1 messages · Page 1 of 1 (latest)
and why would i ever use the client sided payment intent status check if the only thing that's importand are webhook events
@wise dirge 👋 Can you provide a lot more details about your integration and what is blocking you because I don't follow the problem right now
well basically - a user chooses a subscription - to render the elements ui i create a new subscription on the backend
and then listen for webhook events for
Sorry pause
customer.subscription.created/updated/deleted
Please write a clear question in one clear message. Not many short sentences. I help a lot of people in parallel and it's tough to help with train of thoughts questions like this.
Try to make your entire question self contained in one clear message
Okay - my apologies - i didn't realise there are any other ways to do this.
I'll do it step by step:
- User opens the subscription listing page
- User chooses the subscription they'd like to use
- The subscription gets created - client_secret and subscription_id get passed back to the client;
- Subscription gets marked as inactive on the customer.subscription.created webhook event;
- What if user changes their mind and wants to not proceed with the subscription? Or, even more interesting scenario - what if they choose a different subscription to purchase?
- Let's say a user can only be subscribed to a single subscription at a time too.
More over, i don't understand what is the point of stripe.retrievePaymentIntent for the redirect back after <...>.confirmPayment(). Surely you'd rather listen for webhook events and notify the client with a websocket or other communication channel of sorts to say that the purchase actually went through and got processed?
Do i setup a daily job to just delete inactive subscriptions that are older than x hours?
Been soaring the docs for days - can't find any answers to my questions
What if user changes their mind and wants to not proceed with the subscription?
The best option is to usepayment_behavior: 'default_incomplete'and that way the Subscription you create hasstatus: 'incomplete'and it will be automatically canceled/expired after 23 hours if the payment isn't done. See https://stripe.com/docs/billing/subscriptions/overview#payment-window
In that case you don't really need to cleanup anything.
Or, even more interesting scenario - what if they choose a different subscription to purchase?
That one is quite tricky sadly because you can't modify/mutate a Subscription after its creation. So the only solution in that case is to create a new one and cancel the other one.
One approach that works better is our "deferred intent" integration that we shipped a few months ago. The idea is that you can render PaymentElement upfront and collect payment method details and only after they click "pay" you can make a request to your server to create the Subscription and attempt the first payment. This minimizes the cases where you create a Subscription early but it stays incomplete.
We have docs for this here: https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription
aidasp-subscription-incomplete
this is exactly what i needed! Thank you so much!