#sadeed-metadata
1 messages · Page 1 of 1 (latest)
hi there, can you share a request id [0] where you've created the Checkout Session? it'd look like req_xxx
[0] https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_SsDSxWCPmTgwMo
the payment_intent_data is only for for Checkout Sessions in payment mode : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data
right now you're creating mode=subscription
you have a format issue with your code, but even if you fixed it, the PaymentIntent metadata wouldn't be passed in
can you share more on why do you need the metadata on the PaymentIntent?
I am trying to fetch the invoice using PaymentIntent object but the created session always returns null for payment intent hence I cant obtain it from there.
im usin the metadata to send some pk's from our db so I can create an object after the session has completed
what are pk's?
primary keys
couldn't you add the metadata to the Checkout Session object and use the checkout.session.completed event instead?
or alternatively, if you want the metadata to live on the Subscription object instead, you can use https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
that works but since I dont get the payment intent id when a checkout session is created (it returns null for some reason) I have to use the payment_intent.succeeded event hence the metadata problem
i think my question is why do you need the PaymentIntent event specifically?
there're multiple other events which you can use instead
for example checkout.session.completed or invoice.paid or customer.subscription.created
I just need a way to retrieve the invoice but I am unable to find a straightforward way to do it. That is why im using payment intents to get the invoice.
I will look into the ones recommended above.
i'd suggest listening for invoice.paid then - there's a subscription parameter which you can use to identify which Subscription it's for : https://stripe.com/docs/api/invoices/object#invoice_object-subscription
if you need to know why the invoice is created, you can refer to the billing_reason : https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason