#senpai

1 messages · Page 1 of 1 (latest)

lean frostBOT
late brook
#

hello! can you provide the corresponding object id e.g. PaymentIntent id? event id?

drowsy rose
#

is that what you're talking about?

#

evt_3Msy2bD0bhfBuB7Q1G86BAiQ

late brook
#

yep, that works, gimme a second to look at it

drowsy rose
#

i think i found the error for price and email, should I be using amount_received and receipt_email?

late brook
#

based off your code, you're trying to get the product from the event.data.object.metadata.product;

#

but you didn't pass or set that anywhere from what i'm seeing

drowsy rose
#

the event ID is sent from a paid invoice, idk if that mattered or not, I just created the new webhook to listen to the payment_intent.succeeded event today so I don't have an event where a product was checked out

#

but the code is based off this checkout.session.completed event
evt_1Msu7VD0bhfBuB7QLYZZVnIe

#

idk if I was supposed to add that too within the webhook and/or code

late brook
#

i'm a bit confused right now - are you using Invoices or are you using Checkout Sessions to collect payments?

drowsy rose
#

both, but I'm using the payment_intent.succeeded event within my code to listen to payments captured from both invoices and checkout sessions

late brook
#

why use both? can you explain more about the usecase for using both Invoices and Checkout?

drowsy rose
#

for invoices, i have a discord bot within my discord server that actively generates invoices and for checkout I have a website thats connected to the stripe platform

late brook
#

couldn't you generate a Checkout Session in discord also? Or use a Payment Link instead?

#

the reason why i'm mentioning this is because Invoice and Checkout Sessions are different objects and have different parameters

drowsy rose
#

i used invoices because it isn't a static product, its a dynamic price, but mainly I'm focused on checkout sessions rather than invoices

late brook
#

there's going to need to be some differences in how you handle them

#

what's a dynamic price?

drowsy rose
#

as in there's not preset/default price, i set the price depending on what the invoice will be used for

late brook
#

you can use Checkout Sessions for that too

drowsy rose
#

understood, but to be fairly honest, I don't blame on doing a complete rewrite on the invoicing system to switch to checkout session, like i mentioned before I'm more focused, if not only care about the checkout session for checkouts on products rather than invoices

#

not trying to be rude or anything if it came off rude!

late brook
#

no worries. Anyway, going back to your original question - i mentioned that the PaymentIntent event doesn't have the Product

drowsy rose
#

should I switch it to checkout.session.completed and/or checkout.session.async_payment_succeeded?

late brook
#

ummm, maybe i misunderstood this

#

wasn't that payment via an invoice?

#

the invoice wouldn't have any checkout session events

#

or did you mean that you were willing to switch to using Checkout Sessions thoughout for payment?

drowsy rose
#

oh, my apologize, the event I sent you is an invent from a paid invoice, but I meant I want it for the checkout session from this event
evt_1Msu7VD0bhfBuB7QLYZZVnIe

lean frostBOT
late brook
#

alright, then have you updated your logic to accomodate checkout.session.completed and checkout.session.async_payment_succeeded events?

#

cause right now in that code you shared it's just for event.type === 'payment_intent.succeeded'

drowsy rose
#

i figured it out, all I had to do was access the customer_details via
event.data.object.customer_details

then require the specific fields

const email = customerDetails.email