#AlexisRt
1 messages Β· Page 1 of 1 (latest)
Can you share the pi_xx you're trying to confirm?
@jade walrus pi_3LiaIhIpRZHr64t02WtuNePb
For example this one, that has been set as failed.
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
Oh, so the solution is to set the payment as on_session?
Itβs an instant payment, donβt need the customer after that
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.
The customer is just completing a simple payment, and nothing more. So itβs more likely a on-session, yes
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
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.
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?
pi_3LiayGIpRZHr64t00aYtO7Gx
<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>
Can you try using an incognito window/different browser? I suspect something is preventing the callback
Yep, sure, I will try on Safari as PRIVATE MODE π
Or is there somewhere I can reproduce this?
Let me do this!
hmm, nop.. i'm was in local mode sorry.
pi_3Lib5AIpRZHr64t007KiA1Jf on Safari with Private mode.
Are there any errors in the browser console?
Where's the confirmCardPayment code?
(he just fail to load some CSS assets on Stripe.. but that's not the problem, I think)
I haven't.
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([...])
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
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);
});
What's the value of {{$payment_intent}}?
It needs to be the client_secret of the Payment Intent: https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-clientSecret
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
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.
I am confused. That's the client_secret of a Setup Intent
But you keep sharing me Payment Intent IDs
But, the error is explicite π
Are you using Payment Intents or Setup Intents?
I'm using Setup Intents, but I think I have to switch to Payment Intent..
That's the error tell me.
Well what are you actually trying to do?
(btw.. i'm sorry for all this confusing, I'm confused too. That's not my project, I'm just trying to debug it)
You keep sending me pi_xxx (Payment Intent) IDs though
So where is the seti_xxx secret from
The name of the variable is payment_intent.. but I just see that finally, it's a setup intent, lol.
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
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.
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
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 π
Ok, and do you want to save the payment method for future usage later?
No.
The customer will re-enter his card number for future usage.
And re-process to verifications steps, if needed.
Ok, then ditch the Setup Intent and just create a Payment Intent like you have been: https://dashboard.stripe.com/test/logs/req_oxLGxl6SxO1euD
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Then return the Payment Intent from your backend to your front-end, and use the client_secret with confirmCardPayment
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.
Ok, so that's because you're passing confirm: true.
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.
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)
Good! It work π
pi_3LibdxIpRZHr64t02HHRZyIz
This transaction is with status SUCCEEDED
Can you just please confirm me that all is good and secure?
Looks like a successful payment to me, yep! 3DS was requested as expected, and it was successful
Niceee! Happy to see that π