#senpai
1 messages · Page 1 of 1 (latest)
hello! can you provide the corresponding object id e.g. PaymentIntent id? event id?
yep, that works, gimme a second to look at it
i think i found the error for price and email, should I be using amount_received and receipt_email?
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
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
i'm a bit confused right now - are you using Invoices or are you using Checkout Sessions to collect payments?
both, but I'm using the payment_intent.succeeded event within my code to listen to payments captured from both invoices and checkout sessions
why use both? can you explain more about the usecase for using both Invoices and Checkout?
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
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
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
there's going to need to be some differences in how you handle them
what's a dynamic price?
as in there's not preset/default price, i set the price depending on what the invoice will be used for
you can use Checkout Sessions for that too
by generating the price in-line : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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!
no worries. Anyway, going back to your original question - i mentioned that the PaymentIntent event doesn't have the Product
should I switch it to checkout.session.completed and/or checkout.session.async_payment_succeeded?
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?
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
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'
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