#dilruba_code

1 messages ยท Page 1 of 1 (latest)

formal forumBOT
#

๐Ÿ‘‹ 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/1402010874146979870

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

languid shell
#

Hello
Test mode and Sandbox accounts have different sets of API keys

#

So you would likely need to switch to Sandbox account's secret API key

#

You can consider Sandbox account as a separate Stripe account altogether

native egret
#

Do we have to create a sandbox in Stripe app-created account?

languid shell
native egret
#

https://docs.stripe.com/stripe-apps/api-authentication/oauth
i have created oath2 public app.
autherization works fine.
then exchange tokens shows this error.

[04-Aug-2025 18:39:35 UTC] [DEBUG] test
[04-Aug-2025 18:39:35 UTC] [DEBUG] Array
(
[code] => ac_So........
[user_id] => usr_K......
[account_id] => acct_1.....
[stripe_user_id] => acct_1RTzHE.....
[state] => eyJzaXRlIjoiaHR0cHM6XC9cL2RldjIuZmxvb3Bib3guY29tXC8/d2MtYXBpPXd0X3N0cmlwZV9vYXV0aF91cGRhdGUmbW9kZT10ZXN0Jm5hbWU9Z9
)

[04-Aug-2025 18:39:35 UTC] [DEBUG] Stripe OAuth verification started for mode: test
[04-Aug-2025 18:39:35 UTC] [DEBUG] {"error":"invalid_grant","error_description":"Authorization code provided does not belong to you"}

languid shell
#

Right.. The error is correct since you mentioned you're using the same sk_test_xxx key for test mode and sandbox both.

You need to use Sandbox's Secret API key with this if you're trying to exchange the token on a sandbox account

native egret
#

can you please share screenshot where can i see this sandbox API of the app created account?

languid shell
#

I can't share a screenshot but if you click on the link above, it has an inline hyperlink to where you'd find the keys

formal forumBOT
languid shell
#

which says

Use the Developer Dashboard within the sandbox to reveal, revoke, and create API keys. Learn more about API keys.

native egret
#

App created account is in test mode. so there are no sandbox mode ?

narrow fractal
#

I believe this is the managed sandbox mentioned earlier that is automatically created specifically for the purpose of testing your app

native egret
narrow fractal
#

Looking furhter in to what may be wrong here. Do you know what dashboard role you have with your account? I wonder if the issue may be your specific user not having sandbox access.

native egret
#

the public user?
This app works fine. but exchange tokens we use
curl -X POST https://api.stripe.com/v1/oauth/token
-u sk_test_:
-d code=ac_

-d grant_type=authorization_code
this response is error.
sk_test_ is stripe app created accounts key. but no default sandbox created. so I created separate sandbox and take the secret key. but there is no app in that sandbox

narrow fractal
#

So when you go to stripe.com and type in your username and password, that is connected to something called a User. Your user can be assosciated with one or more Stripe accounts and when you log in you can swap between those Stripe accounts through the dropdown in the upper left of your dashboard

#

So a potential explanation for what you are seeing now is that your user doesn't have the correct permissions to see your account's sandbox accounts.

#

I'm trying to spin up my own test but it is taking a bit

native egret
#

the account user can create separate sandbox in that account. the created app can't see there

#

Do you think seperate sandbox automatically create in app created account when sandbox enabled?

lime rock
#

Hi there ๐Ÿ‘‹ apologies for the delay. I'm going to be helping out here, but I'm admittedly not super familiar with this flow and will need a bit of time to get my bearings here.

formal forumBOT
lime rock
#

@native egret, when you're logged into your Stripe dashboard, do you see a banner across the top indicating you're logged into a Sandbox?

native egret
#

nop. shows Test mode .

#

can create sanboxes and manage it. but that sandbox has no apps

lime rock
formal forumBOT