Documentation for the <standard checkout flow is p...
# support
k
Documentation for the standard checkout flow is provided. How does this change when using Stripe payment intents particularly in regards to the expectations of the order state machine? It seems the intention of stripe payment intents is to: 1. Create the intent on the backend 2. Pass the intent secret back to the frontend 3. Frontend attempts to confirm and charge the intent to Stripe directly. 4. Backend receives webhook for charge success.. 5. Anyting else (attaching payment method to customer to make reusable), etc.. How does this work with the standard Solidus state machine? When the payment is in the order transitions to the payment state, is an intent automatically created? What is the role of the confirm state? How payment intents changes the standard flow might be good to list in the documentation for the solidus_stripe gem.
Perhaps this documentation sorta hints at it: https://github.com/solidusio/solidus_stripe/tree/v4#readme Which is that: 1. When a payment is created in solidus backend then an intent is created. 2. When the order is moved confirm and the user confirms, then the completion action will attempt to capture the intent ... I'm not sure if this would move it to complete or if the webhook response would move the order to complete..
Ok studied code a bit more, seems that on confirmation, the payment is marked processing AND the order is marked complete.. but it seems like it's up to the webhook to determine if the payment is ultimately a success or not.
Why do we mark the order complete if the payment is only processing and could fail? Couldn't that result in an order being fulfilled when the payment actually fails?
a
Might be a question for @elia!
đź‘€ 1
e
Thanks for the ping @alessandro 🙏 @Kevin I this was confusing to me as well initially, but I think it can be clarified if we think of fulfillable orders those that were both “completed” and have no outstanding balance. The checkout process kind of fakes the need for a payment but technically an order could complete without one. If the payment fails then the order will keep having an outstanding balance and the order won’t be fulfillable. The extreme cases of this include banking related payments that can take several days before providing an answer. Hope this covers the initial questions, otherwise I’m happy to go into more detail 👍
k
Thanks for the feedback @elia. What scope do you typically use for determining if you should fulfill an order in this case? Additional questions, are there any limitations to which digital wallets can be used with the Stripe Web Elements payment element when using stripe_solidus with the two-step confirmation flow which the documentation says it's set up for by default?
e
From the code I think the scope would be
Spree::Order.where(state: 'complete', payment_state: 'paid')
are there any limitations to which digital wallets can be used […]
Not that I know of, and generally I think digital wallets will take care of collecting the necessary permissions upfront, but can’t say for each single combination of digital+underlying system, did you had some specific use case in mind? Additionally keep in mind the whole thing is tricky, and for some business would probably make sense to have users add a payment method to the wallet with setup intents first and then proceed with the checkout like amazon does, but that’s very business dependent and means asking the customer for permission to access their payment system at any time.