#orderandchaos-at-work_api

1 messages · Page 1 of 1 (latest)

gentle pelicanBOT
#

👋 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/1398331621660164228

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

turbid jacinth
#

Hi, no you can't mix live and test mode data like you imagined.

gentle pelicanBOT
magic cargo
#

To be clear, in production, we only should onboard live accounts and we create test mode data by switching the to the test mode key.

But, we cannot do the same to view the test mode data in embedded components?

Is there something I'm missing, or are you saying it's just not possible to view the test mode data in embedded components in production?

round raptor
#

Hi hi! I’m going to be taking over for my colleague here.

Are you switching the Publishable Key in your frontend code to the testmode key as well?

magic cargo
#

ah I'll check

#

Yes

#
    const newStripeConnectInstance = loadConnectAndInitialize({
      publishableKey: isTestMode
        ? process.env.NEXT_PUBLIC_STRIPE_TEST_PUBLISHABLE_KEY!
        : process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!,
      fetchClientSecret: fetchClientSecret,
      appearance: {
        variables: {
          fontFamily:
            'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
        },
      },
    });
#

I've double checked the envs too, they're all there. Though right now I'm using test mode keys in local development so maybe I just have issues here.

#
[Error: You tried to create a test mode Account Session for an account that was created in live mode.] {
  type: 'StripeInvalidRequestError',
  raw: [Object],
  rawType: 'invalid_request_error',
  code: undefined,
  doc_url: undefined,
  param: undefined,
  detail: undefined,
  headers: [Object],
  requestId: 'req_LDQRjhfz77u0u7',
  statusCode: 400,
  charge: undefined,
  decline_code: undefined,
  payment_intent: undefined,
  payment_method: undefined,
  payment_method_type: undefined,
  setup_intent: undefined,
  source: undefined
}

I'm getting this error which seems odd as I only have test keys

round raptor
#

The Account was created in Livemode, so you can't create an Account Session for it in testmode.

magic cargo
#

So in production all accounts are livemode, so we can't use embedded components to view the accounts test mode data?

#

I'd expected this to work like creating test mode data by swapping keys

round raptor
#

Correct. Live and Test are effectively two different Accounts, and they can't interact.

magic cargo
#

That's not true for creating test mode data though

round raptor
#

What do you mean?

magic cargo
#

We onboard live connected accounts, when we want to create test mode data for those accounts we just use our test mode keys. That all works fine.

I'd expected this to follow the same pattern.

#

So we use live keys for the live data and test mode keys for test mode data. All on live accounts.

round raptor
#

Can you share the Request ID for that error?

magic cargo
#

req_5SYxi2VrOOQruj

#

this should all be test mode it's from my local environment

#

I have no idea how I've got a live account here, but that's a separate concern really.

round raptor
#

You're making an Account Sessions creation request for a live Standard Account - which doesn't make sense - using their testmode API keys - which separately doesn't make sense.

What exactly are you trying to accomplish here?

magic cargo
#

Using testmode keys for creating live standard account data absolutely makes sense. As that creates data in that accounts test mode.

However here we're trying to create an account session for the same accounts test mode.

#

We have a view that shows the embedded components in live mode or test mode. While in test mode we'd like to show the accounts test mode data

round raptor
#

Thuis isn't creating testmode data. This is asking Stripe to create a thing that's meant to access Express accounts, for a Standard Account.

The fundamental thing you're trying to do here will not work with this type of Connected Account.

magic cargo
#

Perfect, that's all I wanted to know. We're limited to showing live mode data

round raptor
#

No, you're not.

magic cargo
#

ah ok

round raptor
#

You just can't use an OAuth-connected Standard Account with Account Sessions, no matter whether you try to do it in live or testmode.

magic cargo
#

ah interesting

#

That explains the other issues I've been having

#

well this one too by the sound of it

round raptor
#

You're asking Stripe to open a 'view hole' into a wholly seprate entity, over which your Platform has no control.

If you were doing this with an Express Account, which is meant to have a 'view hole,' it would work.

magic cargo
#

I see so these embedded components only work for Express accounts (I'd guess Custom too)?

round raptor
#

Correct.

magic cargo
#

I need to go and check something, I'm almost certain we're using embedded components with connected standard accounts on another project.

#

I believe this is an account session req id for a live standard account session token: req_U6nj4OiTKPigud

#

The view works fine in live mode

#

But we have the same issue that we can't view test mode

#

Sorry has been a long week, gave you the wrong id this one is a request for an account session for a standard account: req_d77Rk64et4AXBy

round raptor
#

No worries - samesies. We made it though. :high-five: Let me peek at that one.

magic cargo
#

The live mode for the embedded component dashboard works fine, but never solved test mode

#

If we can't it get that's fine

#

Just wanted to know if we'd missed something

round raptor
#

My understanding was you couldn't use these with Standard Accounts. I'm triyng to find an answer; give me a moment.

magic cargo
#

Sure no worries, evidence would suggest otherwise haha

#

I didn't see any mention in the docs about it excluding Standard Accounts

round raptor
#

req_d77Rk64et4AXBy is in Livemode. I didn't expect it to work, but it does - and that makes sense.

You can't do this in testmode with an account that was created in Livemode, just as the error says.

If you want to 'test' this with a Livemode standard account, you'd have to use the livemode keys.

magic cargo
#

Yeah looks that way

#

Thanks for walking through this with me

#

Have a good weekend!