#TheKents

1 messages ยท Page 1 of 1 (latest)

deft streamBOT
graceful plume
#

after completing the payment, the payment tab looks like this

glossy bough
graceful plume
#

how do i do that

#

and do i need to update paymentIntent after LinkAuthenticationElement is no longer in focus?

#

or at which point

glossy bough
graceful plume
#

what about if i dont have users email before checkout

#

only time they insert their email is in LinkAuthenticationElement

glossy bough
#

Here's my suggestions

  1. listen to payment_intent.suceeded event
  2. Get the email address from the latest's charge's billing_details, use it to create a customer
  3. Update the PaymentIntent with the newly created customer
graceful plume
#

hasnt the paymentIntent already completed by then?

glossy bough
#

You can still update a PaymentIntent with a customer even if it's already suceeded.

graceful plume
#

how can i update that specific one?

#

the receiptEmail is null btw, for now

#

oh

#

the event id is the paymentIntent id

#

so probably like await stripe.paymentIntents.update(event.id, customer...)

#

Can i also ask another question here or do i need to create another ticket?

graceful plume
#

since "Stripe automatically sends email receipts after a successful payment or refund when you provide an email address", but the payment intent already succeeded without customer

glossy bough
#

Let me think

#

In the event handler, you can send a request to you backend so that you can create a customer with this email address and then associate it to the PaymentIntent.

graceful plume
#

yeah, thats what i was thinking, but doesnt it fire off multiple times? like when user types one letter it fires? or only when user clicks out of focus

glossy bough
#

The onChange handler fires whenever the user updates the email field, or when a saved customer email is auto-filled.

#

It won't fire when the customer is still typing

graceful plume
#

okay good

#

i guess that solves it then

#

can i ask another question here?

glossy bough
#

Sure

graceful plume
#

how can i handle payment Intent success return url to get order details to custom success page

#

like when customer pays for the order

#

for now i have this
confirmParams: {
// Make sure to change this to your payment completion page
return_url: 'http://localhost:3000',
},

deft streamBOT
graceful plume
#

can i manipulate the url like "api/checkout/success?true&session_id={SESSION_ID}&alias_id=${aliasId}`"

lost otter
#

Hey! Taking over for my colleague. You can set the return_url with the parameter you want... but {SESSION_ID} won't work as this is not a checkout session, you can simply hardcode these values in the url..

graceful plume
#

what about webcrawlers and such?

#

if the url is hardcoded with user data?

#

its unsafe right?

lost otter
graceful plume
#

yeah i mean if i want to show customer info, like phone numbers and address for example

#

couldnt someone go thru all those urls

#

if for example i would have DOMAIN/orderid=ordernumber

lost otter
#

You'll be creating the return url dynamically... and these pages are displayed only if the customer is authenticated or they filled their details...

graceful plume
#

interesting

#

so if someone would enter the exact url, they would get an error page or smth?

lost otter
#

They can reach to the page but they can't intercept the params....as the url and its params are built after the customer enter your page and fills their data

fading oracle
#

@lost otter am not able to send you message privately

graceful plume
#

could they send the order comformation url to their friend for example, and their friend could open the link and see all the details there

lost otter
graceful plume
#

hmm, okay

#

i think that i can go from this now

#

thanks for the help

#

have a nice day

lost otter
#

Welcome!

graceful plume
#

one more thing

graceful plume
#

@lost otter should i use this to get paymentintent id? stripe.retrievePaymentIntent(clientSecret).then(({ paymentIntent }) => {

lost otter
graceful plume
#

thanks