#luanvdw-Subscription
1 messages ยท Page 1 of 1 (latest)
Hi there, I don't quite understand your question. Can you explain your business logic?
Hi Jack, sure thing!
Currently we are creating subscriptions in the following manner
-
ensure that a user has a default payment method (we save a card with a setup intent in another flow)
-
create a subscription for the user with charge_automatically
-
Stripe then uses the default payment method for the first charge on the subscription (this is automated by Stripe)
-
if the first payment fails then the subscription goes into
incompleteand we enter the realm of payment recovery
What would be the best way to capture payment upfront upon which if successful, we will only then process to subscribe a user. If not then we are dealing with card errors such as a declined card.
So basically you want to charge your customer upfront to reduce the number of card declines?
There's a possibility that the card will get declined even though the first paymentIntent was succeeded. So my opinion is that your current flow is good enough and you shouldn't complicate the logic by introducing another upfront payment.
our current flow however does not cater well for 3DS so I am looking to make modifications to it in any case, so I would appreciate your advice on how to best deal with that
so in a completely separate flow we are capturing card details (with no payments) this is just a "Add card" modal that I then store as the user's default payment with setupIntents and Stripe Elements
Now we have a default payment Method
The act of creating a subscription allows Stripe to do its charge_automatically bit on the back. My question however now becomes with this charge_automatic bit how would I best cater if a customer has some 3DS requirement at this stage.
If it comes up during the flow of simply adding a card, then Stripe Elements will cater for it... great!
But with the second flow... how would this be handled?
Or how would I need to rework the flows to better cater for this?
If you are using SetupIntent and PaymentElements, the customer will experience the 3DS flow during the payment_method collection flow and may not be asked for 3DS authorization in the future recurring payments. However, we can't 100% guarantee that the customer will not encounter 3DS again as the issuing bank may request 3DS if it believes the transaction is risky.
So your application shall always be prepared to handle the 3DS flow (i.e., when the PI status is requires_action)
Ok thank you for this, so just to confirm
currently we are only using setupIntent in flow A and then creating a subscription in flow B (without the use of paymentIntents, we just have charge_automatically on the subscription create)
So in order to rely on the status of a payment intent, we would need to update flow B to create subscriptions with the use of paymentIntent(s)
You should listen to invoice.payment_action_required (https://stripe.com/docs/api/events/types?lang=curl#event_types-invoice.payment_action_required) this event fires when a invoice payment requires action (i.e., when the invoices's PI status is requires_action)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You can find more details here https://stripe.com/docs/billing/subscriptions/webhooks
Ah I see, oki thanks!
Final question just to ensure I understand the various paths to implementation correctly.
If I take a payment X for $20 and it succeeds (through a paymentIntent + confirmPaymentIntent)
Is it possible to link this payment to a subscription on subscrption create
For example,
- Capture payment
- Link captured payment on subscription create, for example something like stripe.subscription.create({ paymentIntent: })
// I know the above example does not exist, but is there a way to link an already captured payment to a subscription at this point?
I think what you want is to save the payment_method that you collected in the 1st payment, and reuse it in the subscription, is my understanding correct?
That already works, when setting it to defaultPayment method that is what Stripe will use.
I am more thinking of if our subscription prices are fixed... and I create a paymentIntent for $20 and capture it
With a random payment having been captured (that is not linked to anything) is it then possible to link it to a subscription when creating said subscription
I won't recommend this approach, a few reasons
- Not scalable, what if you decide to change the subscription price later? how do you handle trials
- Not a great user experience, your customer get charged twice (1st is the paymentIntent, 2nd is the first invoice of the subscription)
- Hard to handle proration, there's no proration logic for ad-hoc paymentIntent