#ionu_unexpected

1 messages ยท Page 1 of 1 (latest)

woeful pythonBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1318189398986194954

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

strange rover
bright portal
#

ok, but why in some cases the use_stripe_sdk type is returned? The code is the same in all situations

strange rover
#

Got some example intents?

bright portal
#

sure

#

pi_3QWcwQG5NORjrd4m0XxrKxS4 this comes with : [next_action] => Stripe\StripeObject Object
(
[type] => use_stripe_sdk
[use_stripe_sdk] => Stripe\StripeObject Object
pi_3QWc4RG5NORjrd4m0dMaNzvS this comes with: [next_action] => Stripe\StripeObject Object
(
[redirect_to_url] => Stripe\StripeObject Object
[type] => redirect_to_url

strange rover
#

I meant some pi_xxx IDs

bright portal
#

pi_3QWcwQG5NORjrd4m0XxrKxS4 - sdk
pi_3QWc4RG5NORjrd4m0dMaNzvS - redirect

#

I noticed that it the redirect happens always at the second or more attempt with the same card details

strange rover
#

It's because the CT has Klarna context too meaning the intent can still be paid via Klarna

#

The other intent uses a card PM so you can redirect directly for 3DS if you wish (like I linked)

#

If you're using any non-card PMs then the recommendation is to always use Stripe.js to confirm/redirect. Otherwise you can handle 3DS yourself as the link noted

bright portal
#

even if the actual pm is done via cc already ?
The thing is that we already have an integration for credit cards sca on our own page with the "popup" with normal createToken and payment intent in the backend.

#

I really need to use the backend php to confirm the payment. So stripe.js is not an option for me

strange rover
#

I'm not sure what you're asking me. What is you're trying to do exactly? Add non-card PMs without using Stripe.js?

bright portal
#

so the only difference is related to klarna

strange rover
#

Well, non-card PMs that require redirects yes

bright portal
#

I have something like this:
createConfirmationToken in the front end (where payment methods types can be payment_method_types: ['card', 'revolut_pay', 'klarna'],)
With the returned token I do a createPaymentIntent in the backend (php)

Based on the returned object, if there is a next_action related to sca we are going to a page where we do what shows in the screenshot.
But this "popup" works only if the next_action type is use_stripe_sdk. If not, it redirects to stripe.com

#

So I would need to have this popup in all the "sca" card cases

#

if possible, of course ๐Ÿ™‚

strange rover
#

Yes, if next_action[type]: 'use_stripe_sdk' then you can't throw it into a custom modal/dialog

bright portal
#

the screenshot is in the case of use_stripe_sdk. And my problem is that that is not always the case.

#

I have pi_3QWdgEG5NORjrd4m0EIRfIVs which has [payment_method_types] => Array
(
[0] => card
[1] => revolut_pay
[2] => klarna
)
and I still get [type] => use_stripe_sdk

strange rover
#

I don't understand what the problem is then I'm afraid

#

But this "popup" works only if the next_action type is use_stripe_sdk. If not, it redirects to stripe.com
You must be using Stripe.js via confirmPayment then, right?

bright portal
#

no, I am using \Stripe\PaymentIntent::create() in php
with the parameters 'confirm' => true, 'confirmation_token' from the stripe.js createConfirmationToken
My problem is that I would like the \Stripe\PaymentIntent::create() to always return "use_stripe_sdk" in the case of sca (klarna obviously will return a redirect url).
Or to understand why sometimes I get the use_stripe_sdk and sometimes I get the redirect_to_url using the same card

strange rover
bright portal
#

ok, but you said that is because of having klarna as a payment method in the one with redirect_to_url, right ? Sorry if I am understanding it wrongly

strange rover
#

That pm_xxx ID is of type: 'card'

bright portal
strange rover
#

Yes I guess it just works differently with Confirmation Tokens

bright portal
#

ok, now I think I get it. I am sorry I did not realize it .... The one with confirmation token works with the sdk, but if I send the pm, it gets redirected

#

so I guess sending the saved pm, will always generate the next_action as redirect_to_url ?

strange rover
#

Only if it's a card PM I believe because of the 3DS control

bright portal
#

Understood. Thanks for your patience with me ๐Ÿ™‚

strange rover
#

Sure, np

bright portal
#

I appreciate the help. Have a nice day

strange rover
#

you too!