#jacob-checkout-metadata

1 messages · Page 1 of 1 (latest)

placid echoBOT
raw cipher
#

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

fallen knot
#

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

raw cipher
#

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

fallen knot
#

Thank you! this is working now, besides redirect.