#Aman

1 messages ยท Page 1 of 1 (latest)

warped juniperBOT
ocean plank
sleek willow
#

oka

#

cus_MUAMUzI69tjwqR

#

I guess this would the eventId

ocean plank
#

that's a customer ID
event ID would start with evt_xxxx

sleek willow
#

evt_1LlC26EadYMztqHqhTlHWpnN

#

this one

ocean plank
#

so that is a customer.created event
You're looking for customer_email property on checkout.session.completed event right?

sleek willow
#

evt_1LlC4eEadYMztqHqfFYOrGii

#

ya looking for checkout.session.completed

ocean plank
#

evt_1LlC4eEadYMztqHqfFYOrGii
that's a setup_intent.created event

sleek willow
#

please have a look

#

getting null inot email

#

I am very much biggner with stripe

ocean plank
#

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?

sleek willow
#

yes

#

but how can I setup that

ocean plank
#

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

sleek willow
#

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

ocean plank
#

can you share link to the docs you're following?

sleek willow
#

ya

ocean plank
#

are you looking at the customers collection here?

sleek willow
#

Its customer created event

#

sorry not checkout session

#

so while customer created event email field returns null

ocean plank
sleek willow
#

yes that the issue

#

how to set another field in metadata

#

as I am sending email via postman

ocean plank
#

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?

sleek willow
#

{
"pId": "price_1LkjYOEadYMztqHqQji1k",
"productId":"prod_MTIrF3",
"email":"abc@gmail.com",
"uid":"0x2db0a737e981e58d79875eacda3ebe07c"
}

#

actually ye event firebase extension itself call karta hai

ocean plank
sleek willow
#

okay

#

thanks

ocean plank
#

nvm

ocean plank
sleek willow
#

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

ocean plank
#

can you try passing in customer_email field before line_items and see if you can trigger a different behavior

sleek willow
#

that will insert data into checkout_session collection

ocean plank
#

also can you print out currentUser and share what that looks like?

sleek willow
#

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

ocean plank
#

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 ๐Ÿ™‚

sleek willow
#

okay I will these

#

didn't work for me

#

as webhook executes over write the content and again set email to null

#

๐Ÿ˜ข

ocean plank
#

what did you change your code to?

#

can you try passing customer_email field before line_items at the same time?

sleek willow
#

customer_email didn't it add into the checkout session collection but I need to add into user collection

ocean plank
#

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?

sleek willow
#

thst user code has not written by me as it call by firestore itself

ocean plank
#

I know, while I spin up my reproduction app I am just wondering if the webhook event updates the customer object on completion

sleek willow
#

nope

#

there is somewhere in stripe where I can set the email field

#

but I am unable to get that

#

I think

ocean plank
#

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

sleek willow
#

Actually I want to fix that issue as soon as possible

#

code is at production

#

level

ocean plank
#

Yes, I'm spinning up my reproduction app right now and will respond as soon as possible.

sleek willow
#

thanks

ocean plank
#

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