#AlexisRt

1 messages Β· Page 1 of 1 (latest)

gray sonnetBOT
jade walrus
#

Can you share the pi_xx you're trying to confirm?

covert bluff
#

@jade walrus pi_3LiaIhIpRZHr64t02WtuNePb

#

For example this one, that has been set as failed.

jade walrus
#

Taking a look!

#

Hm, that screenshot can't be related to that Payment Intent. You shared an off_session: true PI so you'd never see 3DS confirmation flow (as the user isn't present to complete it). The test card you used (4000002760003184) always requires auth, so this is all expected

covert bluff
#

Oh, so the solution is to set the payment as on_session?

#

It’s an instant payment, don’t need the customer after that

jade walrus
#

Well, it depends. Is the customer on-session?

#

Equally, your integration needs to be able to handle these scenarios if you're likely to be processing off-session transactions. Bank can request auth in those instances, so you'd need to bring your customer back on-session to re-confirm the PI and handle 3DS/auth.

covert bluff
#

The customer is just completing a simple payment, and nothing more. So it’s more likely a on-session, yes

jade walrus
#

Sure then you should remove the off_session: true param from your PI creation and then you can handle the 3DS flow with Stripe.js

#

If 3DS is requested for an off-session payment it transitions to requires_payment_method as opposed to requires_action for on-session payments

covert bluff
#

Ok, that's done. Can you take a look at pi_3LiauBIpRZHr64t02ozBTzbm ?
This one is using on_session and it was with INCOMPLETE status..

#

But I have successfully clicked on COMPLETE AUTHENTICATION in the modal generated by Stripe.

jade walrus
#

Hmm, I don't see that on the PI (it has requires_action status meaning 3DS hasn't been attempted)

#

How are you displaying that 3DS modal?

covert bluff
#
        <form id="payment-form" data-secret="{{$payment_intent}}">
            @csrf
            <div wire:ignore id="card-element" style="border:1px solid var(--diag-gray-300);height: 42px;">
                <!-- Elements will create input elements here -->
            </div>

            <!-- We'll put the error messages in this element -->
            <div id="card-errors" role="alert"></div>
        </form>
#

Using

<script src="https://js.stripe.com/v3/"></script>
jade walrus
#

Can you try using an incognito window/different browser? I suspect something is preventing the callback

covert bluff
#

Yep, sure, I will try on Safari as PRIVATE MODE πŸ™‚

jade walrus
#

Or is there somewhere I can reproduce this?

covert bluff
#

Let me do this!

covert bluff
#

pi_3Lib5AIpRZHr64t007KiA1Jf on Safari with Private mode.

jade walrus
#

Are there any errors in the browser console?

covert bluff
#

Nothing.

#

Not related to Stripe.

jade walrus
#

Where's the confirmCardPayment code?

covert bluff
#

(he just fail to load some CSS assets on Stripe.. but that's not the problem, I think)

covert bluff
#

Did I need this ? I see that the previous developer has commented a part of the code:

        {{--stripe.confirmCardPayment('{{$payment_intent }}', {--}}
        {{--    payment_method: {--}}
        {{--        card: card,--}}
        {{--    },--}}

        stripe.confirmCardSetup('{{$payment_intent}}', {
            payment_method: {
                card: card,
                billing_details: {
                    name: ev.detail
                },
            },
        }).then([...])
jade walrus
#

Yeah you're using the wrong Stripe.js function. confirmCardSetup is for a Setup Intent

#

You need confirmCardPayment

#

Not even sure how that triggered the modal tbh

covert bluff
#

Ok, so by using confirmCardPayment instead of confirmCardSetup, I have re-try with this transaction: pi_3LibBXIpRZHr64t02Xt9qONO. It's the same.. status as incomplete.

#
        stripe.confirmCardPayment('{{$payment_intent}}', {
            payment_method: {
                card: card,
                billing_details: {
                    name: ev.detail
                },
            },
        }).then(function (result) {
            window.livewire.emit('__stripe_response', result);
        });
jade walrus
#

What's the value of {{$payment_intent}}?

#

Not the id or the full object

#

(please read the docs :))

#

Also, you should check the value of result in your Promise chain as it will likely contain an error key

covert bluff
#

It's already the client_secret:
seti_1LibFDIpRZHr64t0Cgg8DqB6_secret_MRUDAHi6cWBr7NcC1WLt9eJaRTSGh6R

#

But, with confirmCardPayment, I got the following error:

(index):1 Uncaught IntegrationError: Invalid value for stripe.confirmCardPayment intent secret: value should be a PaymentIntent client secret. You specified: a SetupIntent client secret.

jade walrus
#

I am confused. That's the client_secret of a Setup Intent

#

But you keep sharing me Payment Intent IDs

covert bluff
#

But, the error is explicite πŸ™‚

jade walrus
#

Are you using Payment Intents or Setup Intents?

covert bluff
#

I'm using Setup Intents, but I think I have to switch to Payment Intent..

#

That's the error tell me.

jade walrus
#

Well what are you actually trying to do?

covert bluff
#

(btw.. i'm sorry for all this confusing, I'm confused too. That's not my project, I'm just trying to debug it)

jade walrus
#

You keep sending me pi_xxx (Payment Intent) IDs though

#

So where is the seti_xxx secret from

covert bluff
#

The name of the variable is payment_intent.. but I just see that finally, it's a setup intent, lol.

jade walrus
#

Ok, but if you're looking to process a payment then you need a Payment Intent

#

On your account logs I can se both Setup and Payment Intents being created

covert bluff
#

Yep, that's because I'm making changes on code. Now I try to definitively switch to PaymentIntent and remove all setup-intent πŸ™‚

#

The code look really strange...

Actually, it create a SetupIntent and send the client_secret to the front. That's the '{{$payment_intent}}'... (don't tell me why this variable name, lol)

And when the payment is done (in the .then(..) callback), it create a PaymentIntent on the back with all informations.

jade walrus
#

Yeah that is a legitimate use case. For example, you could be saving/setting up the card initially (with the Setup Intent)

#

And then create a subsequent Payment Intent to charge the payment method the Setup Intent created

#

There's better way to do that though

#

But ultimately I can't really advise you until I know what exactly you're trying to build/do

covert bluff
#

I'm just trying to build a simple payment system. The user click on a reservation, he had a fixed price, he paid, and the reservation is done πŸ™‚

jade walrus
#

Ok, and do you want to save the payment method for future usage later?

covert bluff
#

No.

#

The customer will re-enter his card number for future usage.

#

And re-process to verifications steps, if needed.

jade walrus
#

Then return the Payment Intent from your backend to your front-end, and use the client_secret with confirmCardPayment

covert bluff
#

Yep, it's what I'm trying to do. I just have a little problem with that.

#

It require a 'payment_method' parameter.

#

Don't know what I need to fill in ?

#

On the doc it look optionnal.. but I got an exception.

jade walrus
#

Ok, so that's because you're passing confirm: true.

covert bluff
#

You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method.

jade walrus
#

You can't confirm it at that point because you don't have payment details. So you create the PI initially without confirm: true and then confirmCardPayment will handle confirmation

#

confirm: true is useful for when you have a pre-existing payment method (pm_xxx)

covert bluff
#

Good! It work πŸ™‚

#

pi_3LibdxIpRZHr64t02HHRZyIz

#

This transaction is with status SUCCEEDED

#

Can you just please confirm me that all is good and secure?

jade walrus
#

Looks like a successful payment to me, yep! 3DS was requested as expected, and it was successful

covert bluff
#

Niceee! Happy to see that πŸ™‚