#dulcehc-sub-payment
1 messages · Page 1 of 1 (latest)
Hi there, mostly you can't. You always need to be prepared for a decline and then to bring your customer back on-session to collect new card details. That said, how are you collecting card details currently? What is the flow?
I asked for the card info, I tried to create a subscription. I checked the status if it's equal to "active", then I create a policy (the product the customer is purchasing).
Does your Subscription have a trial? Or are you attempting to pay the initial PaymentIntent when you are collecting these card details?
Can you provide me an example Subscription ID that I can look at?
This is the payment that failed https://dashboard.stripe.com/payments/pi_3Klc6eDhWLhOvPtT1issLKuK. This is an example of an active subscription https://dashboard.stripe.com/subscriptions/sub_1Kw2pZDhWLhOvPtTN91EnRTm
Thanks, give me a moment to look
Sorry for the delay. Are you sure that is the right PaymentIntent ID? I'm not finding it
Ah never mind
Bad copy paste
Okay so this PaymentIntent was actually blocked by a Radar rule you have in place.
You are blocking on CVC failure
yes, but it seems that it wasn't validated immediately because the subscription was created
Ah I think you are misunderstanding how Sub creation works. The Subscription will always be created in an "incomplete" state. Then if payment is successful, it will move to "active". I recommend taking a read through: https://stripe.com/docs/billing/subscriptions/overview#how-payments-work-subscriptions
yes, actually I verified the status, I have this in mi code
if (!effectiveDate && subscription.status !== "active") {
throw new InputError("The payment failed");
}
but it's passing
does this could work? change the Stripe subscription create call to set collection_method=charge_automatically, which I think means it will process the payment at the same time as creating the sub (and presumably return an error on failure)
No the Sub will be created regardless
That is how default_incomplete works. If you don't want this then you change the payment_behavior when you create the Sub: https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_behavior
So if you use error_if_incomplete then the Sub won't be created on payment failuire
thanks, I will review the docs and try that