#Typedef-react
1 messages · Page 1 of 1 (latest)
ahh is there a way to attach customer id in frontend
I think when you create a PaymentIntent backend, it's the timing to include the Customer Id
i can just do customer: customerId ?
before returning PaymentIntent's secret to client
in payment intent backend
yeah
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency: 'usd',
metadata: {
integration_check: 'accept_a_payment'
},
receipt_email: email,
customer: curUser.customerId
})
I did this on backend
payment method on front end is still null
Where do you see it's null?
customer
After confirming call?
sorry, in a MTG and will be back in 10-15 mins
No worries, thank you!!
🔙
Okie quick question: What do you do after createPaymentMethod? Will you use it to confirm a PaymentIntent?
At the timing of creating PaymentMethod, it's true that you still can't attach it to a Customer yet. But when you use it to confirm a PaymentIntent, which is tighted to a Customer, they will all connect: the PaymentIntent, the Customer, and the PaymentMethod
yep I confirmCardPayment
oh so it attaches after the payment method
yeah!
Did you pass Customer Id on PaymentIntent creation?
yep
i checked if it was null also
it is succesfully settings the customer in paymentintents tho
just logged it
oh i think it worked now
is there a way to delete guest customers
Did it... just work?
Yea Im not sure why it created this guest customer
i had customer key the whole time in paymentintent
I think you would also want setup_future_usage
When both setup_future_usage and a customer are provided on a PaymentIntent, the payment details are automatically saved to the customer once the payment is confirmed. You can also supply this parameter when creating the PaymentIntent on your server.
i wonder why it created guest account but it knows that it is related to a customer haha
Sorry I think you can't delete guest customers. Please just ignore them
But I think if you specify both customer and setup_future_usage, it shouldn't create a Guest customer in the first place. LMK if you see diffirent
sounds good thanks!
I am stepping down for the day. If you need more help, feel free to open another thread!