#rivzer
1 messages · Page 1 of 1 (latest)
Payment Intents don't have any concept of items. They just have an amount. See: https://stripe.com/docs/api/payment_intents/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
How are you placing orders? Are you using invoices? Those have items
No i'm making a payment link
and then after succes there is also a webhook and in that webhook i'm tying to get the items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The items will be on the checkout session object
If you're already doing that, then just retireve the line items from the checkout session object that comes in: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
{
id: 'pi_3NYruLErqXo2RifT0vt8WQid',
object: 'payment_intent',
amount: 999,
amount_capturable: 0,
amount_details: { tip: {} },
amount_received: 999,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic',
client_secret: 'pi_3NYruLErqXo2RifT0vt8WQid_secret_rXP2bmJ8qKJZKtLIL3E9bk9zv',
confirmation_method: 'automatic',
created: 1690555485,
currency: 'eur',
customer: null,
description: null,
invoice: null,
last_payment_error: null,
latest_charge: 'py_3NYruLErqXo2RifT0yvHHz4Z',
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: 'pm_1NYruKErqXo2RifTbqkOdYEK',
payment_method_options: { bancontact: { preferred_language: 'en' } },
payment_method_types: [ 'bancontact' ],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'succeeded',
transfer_data: null,
t
no line items
i tried that before
That's not the checkout session object
That's the payment intent object
You need to listen to checkout.session.completed, which gives you the checkout session object
oh ok from the session event
yep
session.line_items is nothing
const items = session.line_items.data.map(item => {
return {
id: item.price.product.id,
quantity: item.quantity,
};
});
data undefined
Ah yeah it's not included by default. See: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You'll need to retrieve the session by id and expand line_items