#Aman
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Can you share the event ID of the checkout.session.completed event that you're working with?
https://dashboard.stripe.com/test/events
that's a customer ID
event ID would start with evt_xxxx
so that is a customer.created event
You're looking for customer_email property on checkout.session.completed event right?
evt_1LlC4eEadYMztqHqfFYOrGii
that's asetup_intent.createdevent
The picture isn't super helpful. We'd need to take a look at exact events.
Also, there's no email field on the checkout session object.
It's either customer_email OR customer_details.email
If you look at this example event that I found in your account,
https://dashboard.stripe.com/test/events/evt_1LlBDoEadYMztqHqwcYXe8Lo
The email address is under customer_details.email
Is that what you're looking for?
Setup what exactly?
Are you sure you're looking at the right event here?
The customer ID you've shared above didn't complete the checkout session that was created.
In which case, there wouldn't be a checkout.session.completed event
okay please have a look this is a firestore extension where they used used the checkout_session
through this I guess checkout.session event has been executed and the image I post before this image that data has been created
but receiving null in the email field
can you share link to the docs you're following?
ya
are you looking at the customers collection here?
Its customer created event
sorry not checkout session
so while customer created event email field returns null
interesting..
I'm not seeing an email on the customer object in the first place
https://dashboard.stripe.com/test/logs/req_mNQLCIYMnqOsda
Seems like while creating the customer you didn't pass in email when sending the POST request
yes that the issue
how to set another field in metadata
as I am sending email via postman
I don't think it would go in the metadata though.
Can you share the request body here for the request that you're sending from Postman?
{
"pId": "price_1LkjYOEadYMztqHqQji1k",
"productId":"prod_MTIrF3",
"email":"abc@gmail.com",
"uid":"0x2db0a737e981e58d79875eacda3ebe07c"
}
actually ye event firebase extension itself call karta hai
looking into the source code to see if anything jumps out
https://github.com/stripe/stripe-firebase-extensions/blob/master/firestore-stripe-payments/functions/src/index.ts#L53
nvm
Is this the code that triggers your cloud function?
yes
actually
const createCustomerRecord = async ({
email,
uid,
phone,
}: {
email?: string;
phone?: string;
uid: string;
}) => {
try {
logs.creatingCustomer(uid);
const customerData: CustomerData = {
metadata: {
firebaseUID: uid,
},
};
if (email) customerData.email = email;
if (phone) customerData.phone = phone;
these code is from line 53-70
how can I pass the email field
because that all functionality has been done by firestor
how can I set email field with user collection
that's the main issue
can you try passing in customer_email field before line_items and see if you can trigger a different behavior
that will insert data into checkout_session collection
also can you print out currentUser and share what that looks like?
actually the herarchy is like in database
currentUser
{
stripeuid:
stripeLink:
email:null
checkout_session {
list items .....so onn
}
}
it looks like this
getting the stripe id and stripe link but didn't get the email
the reason I think is that as mention on github repo if(email) then set email
so I am unable to find the way to set email
so is there a way I can set it into stripe
Okay, It seems like I'd need some more time to reproduce this.
Can you write into our support team via support@stripe.com and mention that you spoke with hanzo on discord
I'll grab the ticket and will respond as soon as I'm able to find something regarding this
One other option that I can think of is to try
.doc(currentUser)
.add({email: 'someemail@email.com'})```
and see if that changes anything
@sleek willow let me know once you've had a chance to test the above and/or write in ๐
okay I will these
didn't work for me
as webhook executes over write the content and again set email to null
๐ข
what did you change your code to?
can you try passing customer_email field before line_items at the same time?
customer_email didn't it add into the checkout session collection but I need to add into user collection
I know but the reason webhook overwrites it is because the customer object created on Stripe doesn't have an email attached
if you complete the checkout session with the given customer, does that update the email address by any chance?
thst user code has not written by me as it call by firestore itself
I know, while I spin up my reproduction app I am just wondering if the webhook event updates the customer object on completion
nope
there is somewhere in stripe where I can set the email field
but I am unable to get that
I think
uhh okay. you can update the customer email via the dashboard
Definitely, appreciate your patience so far ๐
I'd recommend sending an email at support@stripe.com with all the information that you can provide (i.e. example code etc)
I'll grab the ticket and see what I can come up with
Actually I want to fix that issue as soon as possible
code is at production
level
Yes, I'm spinning up my reproduction app right now and will respond as soon as possible.
thanks
Hey @sleek willow , I haven't seen your ticket come in yet but I do have an update.
The email field that you're looking at on "user", comes from firebase authentication (currentUser) and not from any of our API parameters.
I'm not sure how you can authenticate a user via postman.
We have an example here in javascript that you can take a look at and build your integration around it ๐ I hope that helps
https://github.com/stripe-samples/firebase-subscription-payments