#aidasp-subscription-incomplete

1 messages · Page 1 of 1 (latest)

next solsticeBOT
wise dirge
#

and why would i ever use the client sided payment intent status check if the only thing that's importand are webhook events

lunar scarab
#

@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

wise dirge
#

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

lunar scarab
#

Sorry pause

wise dirge
#

customer.subscription.created/updated/deleted

lunar scarab
#

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

wise dirge
#

Okay - my apologies - i didn't realise there are any other ways to do this.

I'll do it step by step:

  1. User opens the subscription listing page
  2. User chooses the subscription they'd like to use
  3. The subscription gets created - client_secret and subscription_id get passed back to the client;
  4. Subscription gets marked as inactive on the customer.subscription.created webhook event;
  5. 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?
  6. 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

lunar scarab
#

What if user changes their mind and wants to not proceed with the subscription?
The best option is to use payment_behavior: 'default_incomplete' and that way the Subscription you create has status: '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

wise dirge