#Taylor
1 messages · Page 1 of 1 (latest)
how are you passing in that metadata?
- https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata, or
- https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
If you pass in the metadata in https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata, only the Checkout Session object will contain the metadata.
If you pass the metadata into subscription_data.metadata - the Subscription will contain that metadata, and so will the Invoice Line Items : https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I just add the userid in the frontend payment link with url parameters
ah, i got a bit confused and thought you were passing in info in the metadata. Yes, the client_reference_id can only be found on the Checkout Session object. So only checkout.* events have it
you can always make a subsequent request to update the metadata on other related objects upon receipt of the checkout.session.completed events
are you saying like updating a customers metadata with the user id?
yes, if you need the user id on a Customer object. Based off your code though, it looks like you want it on the Subscription object instead
So on checkout.subscription.completed I can do something like stripe.customers.update(session.id, { metadata: { clerkId: session.client_reference_id, } }) and then on the rest of the event types sent to my webhook I can grab the metadata: clerkId with the session.id and use that to update my clerk user data
would this work or am I missing something
i think you meant checkout.session.complete . Upon receipt of that event, you can get the Subscription id from : https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-subscription
You'll then do something like
'sub_1NsbqpJQtHgRImA7w2roaRjv',
{metadata: {some_id: session.client_reference_id}}
);```
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.