#Matt11
1 messages ยท Page 1 of 1 (latest)
Sure, you'd use a Setup Intent: https://stripe.com/docs/payments/save-and-reuse?platform=web
perfect, with the confirmSetup function right?
Yup!
thanks ๐
but if I need to set it as default PM I need to do another API call right?
isn't it possible to do it at the same time as SI confirm?
Default PM for the Customer?
exactly
Yes, additional API call currently
sorry but i think that confirmSetup JS is not what I need.
Basically I have the Account page of the customer and, at the bottom, the possibility to update the credit card.
confirmSetup assumes that I have already a available SI right?
I would like instead to create the SI only when the customer request the card update.
Otherwise every time the customer enter the page a new SI is created
Yes, you'd need to create a Setup Intent before calling confirmSetup with the client_secret from the SI
๐ฆ
What's the problem?
that I need keep creating new SIs every time the customer enters the page
Why do you need to do that? Just create it when they click 'update'
because I want to do the 3ds check on client side with stripe elements
so when I enter the page I need the SI already set up
Hi! I'm taking over this thread.
I'm not sure I understand the issue. When user click on "update", make a call to your server to dynamically create a new SetupIntent, then collect the payment details, and confirm the 3DS to go though 3DS if needed.
Like ynnoj said:
you'd need to create a Setup Intent before calling confirmSetup with the client_secret from the SI
yes that's ok I'll figure out how to do it
another question please, is there a card that return me a 'requires_actions' status?
Yes, you can find them here: https://stripe.com/docs/testing#regulatory-cards
thanks!
I would like to add a card (without confirming) and run a background job to create a PI to see if the customer ends up in the 3ds page when logs in. is it possible?
I'm not sure I follow. If you want to save a card into stripe, you have to confirm it (and it may or may not require 3DS, depending on the bank). Then later you can try to reuse it, and again you will have to confirm it (and it may or may not require 3DS, depending on the bank).
yes but I would like to test this flow with stripe test cards:
- during checkout enter a card and confirm 3ds
- run a backgroud job that created a PI and return 'requires_actions' status (not 'authentication_required')
is it something I can achieve?
What do you mean by "not 'authentication_required'"? PaymentIntent don't have a authentication_required status.
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
For example use card 4000002760003184 (always authenticate) or 4000002500003155 (Authenticate unless set up) depending on what you need.
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
yes please. This is what I'm trying to do:
- this customer cus_NPR3q9LUsr0T0g has a PI (pi_3MecxkApMCw5clA31PWkHdqD) with a 'authentication_required' error message
- with stripe elements I'm trying to confirm the payment with 4000002760003184 card (that is already present into customer payment methods)
If I proceed the payment goes well every time with a different payment method ID.
So, after the success confirmPayment I do this:
::Stripe::Customer.update(
current_user.stripe_customer_id,
"invoice_settings": {
"default_payment_method": stripe_payment_intent['payment_method']
}
)
but I receive this error:
The customer does not have a payment method with the ID pm_etc_etc_etc. The payment method must be attached to the customer
you can see this in previous PIs went well
taking a look
thanks!
where did you see that error? would you mind sharing a request ID? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_rMMRhuULczBe8t
you didn't add the setup_future_usage: "off_session" param when creating the PI
so the resulting pm_xxx is not attached to the customer
I created it with the off_session: true. Do I need to add always also setup_future_usage='off_session'?
I tried and I cannot put off_session: true with setup_future_usage='off_session'.
If I use setup_future_usage='off_session', when I need to use off_session:true? how does it works?
off_session: true is used after setting up the PM for setup_future_usage: 'off_session'
once the pm is saved and you need to charge your customer without them being "on_session" then you would create the PI with off_session: true
this is the problem!
This is my flow:
1- during checkout I create a PI with setup_future_usage: 'off_session' flag
2- after 1 year, the background job creates a new PI with off_session: true flag
If the card returns requires_payment_method, inside customer account I use stripe elements + confirmPayment to try to confirm again the same PI.
But this PI was created with off_session: true and then I cannot update the PM to the customer.
Is it something I need to change in the flow?
is this a recurring payment?
yes
but if the customer selected a plan with a trial period, it can be also a first PI creation after a SI
why aren't you using Stripe Subscriptions?
we moved from stripe subscriptions to payment intent to have everything inside our database
so we cannot use subscriptions
I'm not sure if it's a really good idea
what was the issue with you using Stripe Subscriptions?
maybe I could give some insights on how to better use the product
the customer doesn't want stripe subscriptions
to suite your needs
doesn't want webhooks
any reasons why? this feedback might help us improve our flows in the future
currently everything is working fine with PIs and SIs. I'm refactoring from old stripe tokens to new confirmSetup and confirmPayment
so with this new requests there are some issues with PMs during recurring jobs
so I need to find a solution with PIs as said in previous messages
is it something I can achieve?
I think that the issue here is more regarding the card your testing, which in fact might be something that your workflow should handle in all cases
if you're not using Stripe Billing this code is useless
"default_payment_method": stripe_payment_intent['payment_method']
}```
you don't need it to be honest
what you need to do is the following
yesterday your colleague told me to do that but that's ok
I just need to setup the PM as default for the next recurring payment
that's necessary if your using Stripe Billing which you said you didn't want to use without really explaining why
when you say that to any colleague without the full context, they will assume you are using Stripe Billing and then would suggest updating this property
as you can see from its name invoice_settings.d_p_m means the default payment method Stripe uses by default for invoicing
let's go back to your issue now
I don't have all the aswers, I'm only a developer that need to do things after the client ask them ๐
I tried a lot of times to tell them to use subscriptions without any result, so I need to adapt ๐
the way to handle your use case is to update the PI with off_session: false and setup_future_usage: 'off_session' after the PI fails with a requires_payment_method status
it's always good to challenge hierarchies on technical decisions
props
I need to do this after the failure and before the confirmPayment right?
yes true