#ayushh_webhooks

1 messages ยท Page 1 of 1 (latest)

formal wingBOT
#

๐Ÿ‘‹ 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/1340920186047565915

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

shadow turtle
#

I am first creating a payment intent and then a checkout session

#

Just FYI, the email is empty. I am not taking any email from the customers. I want to use the email they used in the checkout session that

gentle silo
#

checkout.session.completed is only for Checkout Session. You are calling stripe.subscriptions.create so yes customer.subscription.created is what to expect

#

It only has customer: "cus_RmwsURaVWny88W"

#

So you want to call Retrieve Customer API, passing this Id in

shadow turtle
#

Okay, lemme try it

#

the email is still null

#

"description": null,
"discount": null,
"email": null,
"id": "cus_RmwsURaVWny88W",

#

I want email from this checkout page

gentle silo
#

Has this Invoice been paid?

#

I think it's still open and waiting for confirmation

shadow turtle
gentle silo
shadow turtle
gentle silo
#

Did you input the card and pressed "Pay now" from the Payment Elements?

shadow turtle
#

yes

gentle silo
#

Maybe you used a different client secret? Because I don't see the PaymentIntent was confirmed

shadow turtle
gentle silo
#

Ok can you share that's PaymentIntent Id? pi_xxx

shadow turtle
#

ok wait

gentle silo
#

Take the log from here

console.log("Response data:", {
            hasClientSecret: !!responseData.clientSecret,
            error: responseData.error,
            details: responseData.details,
        });
shadow turtle
gentle silo
#

Oh sorry, okie can you give the PaymentIntent Id?

#

pi_xxx

shadow turtle
#

pi_3QtNavEcN4toC7LN0X84t4SY_secret_SegBXm0pr66ZrbpfHtrtGoZpk

gentle silo
#

This hasn't been paid yet

#

Have you pressed on "Pay" with a test card?

shadow turtle
#

I used the live keys

gentle silo
#

Please use the Test key and a test card, ie 4242

shadow turtle
#

I mean, the environment is live

gentle silo
#

Without the test key how do you test your website? You can't use a Live card because it generate real transaction

shadow turtle
#

lemme know what other debugging technique should i use?

gentle silo
#

You just need to pay the PaymentIntent, and a Test key would help.

shadow turtle
gentle silo
#

Yes. I see the PaymentIntent is still waiting

shadow turtle
#

is the code correct?

gentle silo
#

Seem to be correct, but you may want to expand the Payment Method's billing_details inside the PaymentIntent, which is only populated after the PaymentIntent is paid

shadow turtle
#

okay I am making a transaction

shadow turtle
#

I got success message

#

@gentle silo evt_1QtOCYEcN4toC7LNFJzo2cqT

#

can you check this event id?

gentle silo
#

Sure looking..

#

This is a customer.updated event

#

Do you have a PaymentIntent Id (pi_xxx)?

shadow turtle
#

pi_3QtOBqEcN4toC7LN0OvQAsvD_secret_4wTcDvfovUaGgE81Ek6dN2XuB

gentle silo
#

Thanks! This has a Payment Method

#

When you received payment_intent.succeeded, you can look at the payment_method field, it has an Id. Please call Retrieve Payment Intent and expand payment_method to see the email

shadow turtle
#


pi = stripe.PaymentIntent.retrieve("pi_3QtOBqEcN4toC7LN0OvQAsvD")


print(pi)
``` I want to see the email locally
#

is it possible?

gentle silo
#

You need the expand parameter

#

expand: ['payment_method']

shadow turtle
#

Ok

shadow turtle
#

hi

#

this works

#

thanks @gentle silo

#

This is for expanding

shadow turtle
gentle silo
#

Yes, what data do you want to see?

shadow turtle
#

I just want to extract email

#

when this payment_intent.succeeded event occurs

#

I created this for testing purposes only, I would like to handle the request through the nodejs webhook

#

should I just chane the

case "checkout.session.comleted"
``` to

case "payment_intent.succeeded
"

gentle silo
#

Yes

shadow turtle
#

cool. thanks. will check it out.