#Cédric Morelle
1 messages · Page 1 of 1 (latest)
Hi there!
Hello soma
Can you clarify exactly what is the issue? The PaymentIntent you shared is successful. Is this because the user didn't receive an email from Stripe?
All good for email. Just as you saw i response customer is null
Just as you saw i response customer is null
If you don't set a customer ID when creating the PaymentIntent, then it's expected that the customer will be null.
and I expect Stripe to provide me a an id for this customer
So you need to first create a customer object, and then when you create the PaymentIntent make sure to pass the customer ID in the request.
so before even creating
Stripe::PaymentIntent.create(
amount: calculate_order_amount(context_product[:product_id]),
currency: "eur",
automatic_payment_methods: {
enabled: true,
}``` I need to check if user exists or not at Stripe, basing on its mail, then create it, then associate it while creating PaymentIntent ?
Yes exactly
got it sorry for having bothered you, really you are making a fucking outstanding job on this Discord server!
Workflow of your doc are not always clear and paymentIntent is clearly different as our old workflow
tnx again
I have a question again
Let's say our customer, is not registered yet on our server
but you at stripe receive his mail,
that would make sense to have a customer created by your own as we can't create Stripe customer ourself as long as we don't have his mail @wanton sail
it is a question, is it possible to ask PaymentIntent to create customer while receiving Intent?
or does it means I have to update paymentIntent after we received payment confirmation?
No PaymentIntent cannot create a customer. You need to set an existing customer either when you create the PaymentIntent or when you update it.
'pi_3N8iPIAslfugMFd91R3kuANK',
{metadata: {customer_id: 'xxxx'}},
)``` ?
You could do this yes, but it's updating the metadata, not the customer https://stripe.com/docs/api/payment_intents/update#update_payment_intent-customer
I'm in front of this page but what is the syntax to update customer ?
Stripe::PaymentIntent.update(
'pi_3N8iPIAslfugMFd91R3kuANK',
{customer: stripeCustomer},
)```?
Stripe::PaymentIntent.update(
'pi_3N8iPIAslfugMFd91R3kuANK',
{customer: stripeCustomer.id},
)```
Yes something like this should work. Have you tried?
'pi_xxx',
{customer: "cus_xxx"},
)```