#ashish_api

1 messages · Page 1 of 1 (latest)

sterile isleBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1234896036145664031

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

haughty sundialBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

hallow aspen
#

This is my full code:

const session = await stripe.checkout.sessions.create({
        ui_mode: 'embedded',
        line_items: [
        {
            // Provide the exact Price ID (for example, pr_1234) of the product you want to sell
            price: 'priceID',
            quantity: 1,
        },
        ],
        mode: req.query.mode === "once" ? "payment" : "subscription", // mode: payment | subscription
        customer_creation: "always",
        return_url: `${myDomain}/complete?session_id={CHECKOUT_SESSION_ID}`,
    });
coarse stone
#

I see a Customer being created for that event. They have an ID and everything --> cus_Q1LfvVpPkiOpJD

hallow aspen
#

Yeah, but when the webhook for checkout.sessions.create is sent to me, i receieve no customer data. same with retrieving the session from sessionID. I only get customer_email and status

#

what i get when retrieving the session from session ID

coarse stone
#

Do you have the Event ID for the checkout.session.created event you're referring to?

#

I'm not surprised. You should be listening to checkout.session.completed, since that's what fires when the customer actually fills out the form and Stripe creates the Customer

hallow aspen
#

I'm sorry, i am listening for checkout.session.completed. I send an error to myself when an error happens using a discord bot, and event.data.customer is undefined as well (for the checkout.session.complete)

coarse stone
#

Okay. What's the Event ID that caused the error?

hallow aspen
#

This is the event that sends the checkout.sessions.complete evt_1PBIyRAaUAsw03BSqi3khEhs

coarse stone
#

Have you looked up the Event ID in the Stripe Dashboard?

hallow aspen
#

yea

#

Also, if it may help, i am using test mode, but I don't think that should be an issue

#

Let me try again and see what's happening one more time, but I'll log the whole event object i receieve

coarse stone
#

Okay, when you look at the Even object you should be able to see a Customer ID, no?

hallow aspen
coarse stone
#

Yes! It should be present in the payload, so you probably have a conditional somewhere that's wonky

#

What does your webhook handler code look like?

hallow aspen
#

Wait a minute, something looks different

#

The checkout page, initially i just pressed "pay with link" but this time it's asking me to enter details

coarse stone
hallow aspen
#

Okay i managed to find the issue for the webhook not sending me the customer, it had to be event.data.object.customer.

However, i'm still stumped on why the session is not giving me full details. It's only giving me customer_email and status

#

Oh my goodness, I feel like i've wasted your time

coarse stone
#

Nah, it's never a waste when you arrive at the right solution

#

Did you figure it out?

hallow aspen
#

I'm so sorry, I was following the guide for embedded checkout, and just saw why i only received two values, it was because the guide suggests me to create an endpoint for me to get the values. And i'm the one that's only returning email and status (and not the other data)

#

This is what the guide suggests, and I completely forgot that I had to pass more values, if I wanted more values when returning a response 🤦 I feel so stupid, and I really apologize for wasting your time

coarse stone
#

Ahhhhhh, okay. No worries! It happens all the time. Like I said, it's only a bad use of time if we never find a solution or path forward.

#

Glad to hear you unblocked yourself!

hallow aspen
#

Thank you so much for the help and your time! You may close the thread