#bwestwood_api

1 messages ¡ Page 1 of 1 (latest)

opaque iglooBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1216987727598452757

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

neat kestrelBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

balmy nymph
#
    const stripeSession = await stripe.checkout.sessions.create({
      success_url: settings,
      cancel_url: settings,
      payment_method_collection: "always",
      mode: "subscription",
      customer_email: session.user.email ?? undefined,
      subscription_data: {
        trial_settings: {
          end_behavior: {
            missing_payment_method: "cancel",
          },
        },
        trial_period_days: 14,
      },
      line_items: [
        {
          price: process.env.STRIPE_PRICE_ID,
          quantity: 1,
        },
      ],
      metadata: {
        userId: session.user.id
      },
    });
#

Would this be the right syntax for the metadata and if so can I use it on the checkout.sessions.create?

neat kestrelBOT
vast verge
#

Stripe doesn't populate metadata from one object to another, i.e. metadata set on Checkout Session directly will not appear in Subscription object.

To have metadata on Subscription that is created from Checkout Session, the metadata should be set under subscription_data.metadata of a Checkout Session: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata

balmy nymph
#

Got it working thank you! For some reason I didnt find that when searching but thanks again