#dilruba_code
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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
Do we have to create a sandbox in Stripe app-created account?
Stripe automatically creates a sandbox when you upload a public app - https://docs.stripe.com/stripe-apps/enable-sandbox-support#managed-sandbox
So if your app is a public app then you don't need to create a separate account afaik, just go ahead with Step 3 instead: https://docs.stripe.com/stripe-apps/enable-sandbox-support#enable-sandbox-installs-for-your-public-app
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"}
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
can you please share screenshot where can i see this sandbox API of the app created account?
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
That "managed sandbox keys" link takes you to - https://docs.stripe.com/sandboxes/dashboard/manage-access#manage-api-keys
which says
Use the Developer Dashboard within the sandbox to reveal, revoke, and create API keys. Learn more about API keys.
App created account is in test mode. so there are no sandbox mode ?
I believe this is the managed sandbox mentioned earlier that is automatically created specifically for the purpose of testing your app
i cant see any sanboxes for app created stripe account. app is sandbox enabled.
https://marketplace.stripe.com/oauth/v2/authorize?client_id=ca_Siis0RlyMJdBuO5GPMRSQ8YcKBkQUkQH&redirect_uri=https://verify-stripe.themehigh.com/wp-json/wt-stripe/v1/oauth
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.
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
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
Users have roles https://docs.stripe.com/get-started/account/teams/roles
And our sandbox docs mention that access to sandboxes is a user level permission
https://docs.stripe.com/sandboxes/dashboard/manage-access#grant-users-access-to-a-specific-sandbox
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
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?
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.
@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?
nop. shows Test mode .
can create sanboxes and manage it. but that sandbox has no apps
Hm, I don't think we need to see an app, just get the API keys from the Sandbox account. Are you able to switch to the Sandbox Account that starts with com.example., and then view this page to see the API keys for that Sandbox:
https://dashboard.stripe.com/acct_1RnHQJHKzyaepukk/test/apikeys ?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.