#Matt11

1 messages ยท Page 1 of 1 (latest)

topaz wolfBOT
analog dew
raven siren
#

perfect, with the confirmSetup function right?

analog dew
#

Yup!

raven siren
#

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?

analog dew
raven siren
#

exactly

analog dew
#

Yes, additional API call currently

raven siren
#

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

analog dew
#

Yes, you'd need to create a Setup Intent before calling confirmSetup with the client_secret from the SI

raven siren
#

๐Ÿ˜ฆ

analog dew
#

What's the problem?

raven siren
#

that I need keep creating new SIs every time the customer enters the page

analog dew
#

Why do you need to do that? Just create it when they click 'update'

raven siren
#

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

karmic jewel
#

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

raven siren
#

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?

karmic jewel
raven siren
#

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?

karmic jewel
#

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).

raven siren
#

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?

karmic jewel
raven siren
#

oh ok

#

So I need a card to test the previous flow

karmic jewel
#

For example use card 4000002760003184 (always authenticate) or 4000002500003155 (Authenticate unless set up) depending on what you need.

strong temple
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

raven siren
#

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

strong temple
#

taking a look

raven siren
#

thanks!

strong temple
raven siren
#

req_rMMRhuULczBe8t

strong temple
#

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

raven siren
#

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?

strong temple
#

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

raven siren
#

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?

strong temple
#

is this a recurring payment?

raven siren
#

yes

#

but if the customer selected a plan with a trial period, it can be also a first PI creation after a SI

strong temple
#

why aren't you using Stripe Subscriptions?

raven siren
#

we moved from stripe subscriptions to payment intent to have everything inside our database

#

so we cannot use subscriptions

strong temple
#

what was the issue with you using Stripe Subscriptions?

#

maybe I could give some insights on how to better use the product

raven siren
#

the customer doesn't want stripe subscriptions

strong temple
#

to suite your needs

raven siren
#

doesn't want webhooks

strong temple
#

any reasons why? this feedback might help us improve our flows in the future

raven siren
#

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?

strong temple
#

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

raven siren
#

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

strong temple
#

that's necessary if your using Stripe Billing which you said you didn't want to use without really explaining why

strong temple
#

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

raven siren
#

I tried a lot of times to tell them to use subscriptions without any result, so I need to adapt ๐Ÿ˜„

strong temple
#

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

strong temple
#

props

raven siren
strong temple
#

yes true