#nick-paymentintent-customer

1 messages ยท Page 1 of 1 (latest)

edgy glacierBOT
spare ridge
#

You'd want to do that before, though IIRC you can set the customer after too

#

For customers with saved payment methods you wish to use, you must indicate the customer to go with that payment method

fair estuary
#

I am attempting to attach it before, however it doesn't seem to be accepting the customer id when sending the request over to Stripe

#

I believe I am sending the customer object within the payment intent object, and then the update payment intent never executes because of it.

spare ridge
#

Can you share an example failing request id?

fair estuary
#

req_ChINbism3hVT8F

#

This is the most recent payment intent, but the function of passing the customer id to the payment intent is being executed in my code. I can show an example of my code if need be as well

spare ridge
#

This is a confirm request though

#

Do you have an example of the custoemr causing a failure like you described?

fair estuary
#

Okay give a moment

#

No I don't have an example of the customer causing the failure,

#

I am trying to figure out the easiest/ best way of attaching the customer id to the payment intent object without having break my entire code lol\

edgy glacierBOT
fair estuary
#

Hello! I can ask my questions again if you'd like!

spare ridge
#

It sounds like you need to figure out where in your code to set/send the customer, right?

#

So far, it looks like that hasn't been included in payment intent requests

fair estuary
#

Yes, I can show you what I am working with so this can be a little clearer on both ends

stuck pebble
#

๐Ÿ‘‹ taking over but will take me some time to catch up

#

nick-paymentintent-customer

#

those files you shared are weird binary files

#

please just share the exact code for the call to the Update PaymentIntent as text here (nothing else)

#

you can wrap code between ```

fair estuary
#

one moment let change the extention

stuck pebble
#

sorry that's a big picture of code

#

Please, as the developer, read your code and share the exact part that updates the PaymentIntent. nothing else and not as a picture

stuck pebble
#

perfect. So now your code is doing this customer: customerId, // Attach the customer to the payment intent

#

This is likely null. As the developer, you go and add logs to it before using it and confirm. Then it comes from your client so you go and confirm what the client sends.

#

And then you should be able to quickly fix it

#

Also: you should never have a Customer id come from the client, so this is likely designed incorrectly. Otherwise anyone could steal someone else's cus_123 to have them pay

fair estuary
#

I am getting this type of error now: v3:1 Uncaught (in promise) IntegrationError: elements.submit() must be called before stripe.confirmPayment(). Call elements.submit() as soon as your customer presses pay, prior to any asynchronous work. Integration guide: https://stripe.com/docs/payments/accept-a-payment-deferred
at Hi (v3:1:302195)
at e._handleMessage (v3:1:307420)
at e._handleMessage (v3:1:89629)
at v3:1:305326

stuck pebble
#

So did you call elements.submit() first?

fair estuary
#

I did not

#

i called stripe,confirmPayment() only

stuck pebble
#

Do you know you are using a beta though? Like its integration path is different. So you need to carefully read the docs and follow the recommendations in the right order

fair estuary
#

No I didn't know that

#

that link came from the error

stuck pebble
#

okay so what doc are you following exactly?

fair estuary
#

This update payment intent

stuck pebble
#

I mean this is a server-side call, it's completely unrelated to the client-side error.

#

Like what are you really trying to do. Which exact end to end guide are you following to accept a payment?

#

because updating a PaymentIntent server-side, is unrelated to the logic of client-side confirming it. And you seem to have 2 completely separate errors/questions but I'm not really following you

fair estuary
#

I am trying to follow the link above when accepting a payment with Stripe Payment Element

stuck pebble
#

Okay, so you have 2 separate errors though
1/ You can't seem to update the PaymentIntent's customer properly -> I explained how to fix this and you're looking into it
2/ You get that error about confirmPayment() -> This is likely because you have a mistake in the code that calls confirmPayment(). Can you share that part?

#

Looking at the picture of your code from earlier, a colleague of mine noticed you are passing clientSecret to the confirmPayment() call, which is not correct. That's why you get that error

fair estuary
stuck pebble
#

yeah look at that code, and remove what I said

#
    const { error, paymentIntent } = await stripe.confirmPayment({
      clientSecret: clientSecret,```
this last line should **not** be here and is causing the error
fair estuary
#

I removed it, one moment

stuck pebble
#

sure!

fair estuary
#

Thank you for your help so far, I really appreciate it! I am going to continue this tomorrow morning, and if I have any questions I'll be sure to ask again. Thank you