#fatcat_api

1 messages ¡ Page 1 of 1 (latest)

sharp iglooBOT
eternal phoenixBOT
#

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.

sharp 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/1272608371819806782

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

lyric hearth
#

here's what im getting back from session line items, I can see customer information but need their customer ID, trying to update metadata on the confirmation hook

stoic laurel
stoic laurel
#

Correct

sharp iglooBOT
lyric hearth
#

Doesn't seem to work, I get "customer creation can only be used in payment mode"

#

I'm in subscription mode

floral fox
#

Can you send me the ID of the completed session with a subscription but no customer? Subscriptions require customers, so my current guess is that the subscription will have a customer ID set if you check it, but that ID isn't assosciated with the session itself.

lyric hearth
#

OK

#

FYI here is my session code:

#
    const session = await stripe.checkout.sessions.create({
      mode: "subscription",
      subscription_data: {
        trial_end: expireTimestamp,
      },
      line_items: [
        {
          price: price,
          quantity: 1,
        },
      ],
      success_url: href + "/confirm?session_id={CHECKOUT_SESSION_ID}",
      cancel_url: href,
      metadata: {
        firebaseUID: ssrUser?.uid,
      },
      customer_email: ssrUser?.email || null,
    })```
#

just completed it, here is checkout session ID:

#

cs_test_a1lx8mP55eyrLVtj4E9yPBmBYAVN8VkfBdAkWweAhKr9ectlr4Vt4vMyOF

floral fox
#

I actually do see a customer ID directly assosciated with that Checkout Session cus_QeMHYt1kp69f0I

#

If you retrieve the session via the API or listen to the checkout.session.completed event, the ID should show up there.

lyric hearth
#

strange I see it now too

floral fox
#

For the first screenshot, was that immediately after the session was created? We don't create the customer until after the payment details are submitted so it would be expected to not be there at first

lyric hearth
#

The first screenshot was this page, success_url: href + "/confirm?session_id={CHECKOUT_SESSION_ID}",

#

so it only goes there after payment, possibly a race condition?

#

it's basically my success redirect

floral fox
#

Ah, that is strange. Sounds like it could be a race condition. Do you know if the session came back with a complete status or if it was open still?

lyric hearth
#

well the most recent one came back complete

#

I lost my logs from earlier because I got pulled into a meeting

#

so I guess loop this just in case, or use a webhook instead to be 100% safe?

floral fox
#

Yep yep, definitely do the webhook and looping makes sense. You definitely want to check that the payment did actually happen but if you can get a stale version of the session object it would make sense to retry before reporting that the payment didn't happen