#peterbuilt
1 messages · Page 1 of 1 (latest)
hello! Are you using Checkout Sessions?
yes
well I have two webhooks, listening payment_intent.succeeded which feels like an anitpattern
but I need to create a user when they initially purchase and do something different when they just purchase more additional things
you can retrieve the Checkout Session with the PaymentIntent id : https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-payment_intent and make sure to expand the line_items parameter when retrieving : https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
can I fetch the product w/ the paymentId?
no you can't
{
"id": "prod_NvNH8Xy57HwOGo",
"object": "product",
"active": true,
"created": 1684515118,
"default_price": "price_1N9WX5B8eFyY2JODNKjUtTQN",
"description": "Create fun, unique coloring pages with the help of artificial intelligence.",
"images": [],
"livemode": false,
"metadata": {
"TYPE": "INITIAL_PAYMENT_USER_CREATION"
},
"name": "Gold Special",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": "AvatarArt.ai",
"tax_code": "txcd_10000000",
"unit_label": null,
"updated": 1685586948,
"url": null
}```
I am trying to gate my logic off the metadata object
@river storm what does the line_items key offer me ?
the line_items would allow you to see what Product was used in the Checkout Session
by product id ?
yes the product id should be there, you should try it out and see if it provides the information you need