#jacob-checkout-metadata
1 messages · Page 1 of 1 (latest)
jacob-checkout-metadata
Hey @fallen knot ! First I recommend to not use redirectToCheckout(). It was deprecated multiple years ago and is discouraged even if it works. You should redirect server-side instead
As for the metadata, you have to use https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
Interesting, I will try the redirect on the server-side.
checkout_session = stripe.checkout.Session.create(
line_items=[
{
'price': price,
'quantity': 1,
},
],
mode='subscription',
success_url="http://localhost:5173" + '/success',
cancel_url="http://localhost:5173" + '/cancel',
metadata={
"user_id": user.user_id
},
subscription_data={
"metadata": {
"user_id": user.user_id
}
}
)
does this look correct for the subscription_data metadata?
I see the outer metadata field, but not the subscription_data when i output the checkout _session
that's expected, that will apply to the resulting Subscription but it's not exposed on the Checkout Session resource, it's just a parameter
Thank you! this is working now, besides redirect.