#bilal0739
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
Hi! What's your question?
I have some problems in db I am storing the ids of stripe accounts and some stripe id get created using the test key so it starts giving me err when I perform some operation says "The account acct_1LCZYmJYb9j665Hx was a test account created with a testmode key, and therefore can only be used with testmode keys."
so i decided to delete those keys from my stripe test and also from my db and create new stripe accounts.
I wrote an api but here the problem is on some user accounts first i check account and if it gives err in catch block i check the pertiular error "The account acct_1LCZYmJYb9j665Hx was a test account created with a testmode key, and therefore can only be used with testmode keys."
and then try to delete it but when i try to delete it it gives me this error "Only live keys can access this method."
router.get('/stripeChangeIds',async function(req,res){
const data = await authDB.getNotaries()
for (let index = 0; index < data.length; index++) {
const element = data[index];
console.log(element.id);
if (element.stripe_id) {
try {
const account = await stripe.accounts.retrieve(element.stripe_id);
} catch (error) {
console.log(error);
if(error.statusCode == 400 && error.rawType == "invalid_request_error" && error.message == `The account ${element.stripe_id} was a test account created with a testmode key, and therefore can only be used with testmode keys.`){
try{
const deleted = await testStripe.accounts.del(element.stripe_id);
if(deleted){
// await stripe.customers.create({ email:element.email }, { stripeAccount: notary[0].stripe_id });
await memberDB.updateUserStripeId(element.id);
}
} catch(err){
console.log("===============>",err);
}
}
}
}
}
res.send("done");
});
when i try to retrieve it shows the account created with test key but when i tried to delete i can't delete the account
how i can perform that
delete function
Can you share the ID (req_xxx) of the failing API request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_IEbM8nbVgIrrBP
req_8riom72kXyTJ51
req_KTeYb7UKc13bL4
req_qMWXytjWRRfbt0
these above id and many other failed
some are successfully deleted ids below
req_3gvOqoyDjmoJrA
req_TV9pQ322Lvk7MG
Thinking
if on retriving the acconts are not created with test then why it is showing "account created with test key" and if it is showing then why it is not deleting and if that fdel function is only for live mode and cannot del account created using test then why it is del some of them.
here in dashboard some are del and some gave err
On this request: https://dashboard.stripe.com/test/logs/req_qMWXytjWRRfbt0
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Can you try and omit the Stripe-Account header from the request?
how can i remove it? I did not understand
Where is your code that makes the API call to delete the account?
i shared above
these are the headers
headers: {
server: 'nginx',
date: 'Mon, 18 Dec 2023 12:20:07 GMT',
'content-type': 'application/json',
'content-length': '233',
connection: 'keep-alive',
'access-control-allow-credentials': 'true',
'access-control-allow-methods': 'GET,HEAD,PUT,PATCH,POST,DELETE',
'access-control-allow-origin': '*',
'access-control-expose-headers': 'Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required',
'access-control-max-age': '300',
'cache-control': 'no-cache, no-store',
'content-security-policy': "report-uri https://q.stripe.com/csp-report?p=v1%2Faccounts%2F%3Aaccount; block-all-mixed-content; default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'",
'request-id': 'req_xYgz3hBfprXy7e',
'stripe-account': 'acct_1LO4kDAamNC0OSWr',
'stripe-version': '2019-10-17',
vary: 'Origin',
'x-stripe-routing-context-priority-tier': 'api-testmode',
'strict-transport-security': 'max-age=63072000; includeSubDomains; preload'
},
router.get('/stripeChangeIds',async function(req,res){
const data = await authDB.getNotaries()
for (let index = 0; index < data.length; index++) {
const element = data[index];
console.log(element.id);
if (element.stripe_id) {
try {
const account = await stripe.accounts.retrieve(element.stripe_id);
} catch (error) {
console.log(error);
if(error.statusCode == 400 && error.rawType == "invalid_request_error" && error.message == `The account ${element.stripe_id} was a test account created with a testmode key, and therefore can only be used with testmode keys.`){
try{
const deleted = await testStripe.accounts.del(element.stripe_id);
if(deleted){
// await stripe.customers.create({ email:element.email }, { stripeAccount: notary[0].stripe_id });
await memberDB.updateUserStripeId(element.id);
}
} catch(err){
console.log("===============>",err);
}
}
}
}
}
res.send("done");
});
res.removeHeader("...."); WHich do ypu want me to delete
should i run the code again after removing the header
Hmm, I don't understand how Stripe-Account header is there when you're not passing stripeAccount in your API request
Yeah please do
see this
What am I looking at?
Its the request and responses
discord did not allowed me to send it
router.get('/checkit',async function (req,res) {
const account = await testStripe.accounts.retrieve('acct_1LO4kDAamNC0OSWr');
console.log("1",account);
const deleted = await testStripe.accounts.del("acct_1LO4kDAamNC0OSWr");
if(deleted){
console.log("2",deleted);
}
res.json(account);
})
In first console
{
id: 'acct_1LO4kDAamNC0OSWr',
object: 'account',
capabilities: {
acss_debit_payments: 'active',
affirm_payments: 'inactive',
afterpay_clearpay_payments: 'active',
bancontact_payments: 'active',
card_payments: 'active',
cashapp_payments: 'active',
eps_payments: 'active',
giropay_payments: 'active',
ideal_payments: 'active',
klarna_payments: 'active',
link_payments: 'active',
p24_payments: 'active',
sepa_debit_payments: 'active',
sofort_payments: 'active',
transfers: 'active',
us_bank_account_ach_payments: 'active'
},
charges_enabled: true,
country: 'US',
created: 1658431966,
default_currency: 'usd',
details_submitted: true,
future_requirements: {
alternatives: [],
current_deadline: null,
currently_due: [],
disabled_reason: null,
errors: [],
eventually_due: [],
past_due: [],
pending_verification: []
},
payouts_enabled: true,
...
requirements: {
alternatives: [],
current_deadline: null,
currently_due: [],
disabled_reason: null,
errors: [],
eventually_due: [],
past_due: [],
pending_verification: []
},
settings: {
bacs_debit_payments: { display_name: null, service_user_number: null },
branding: {
icon: null,
logo: null,
primary_color: null,
secondary_color: null
},
card_issuing: { tos_acceptance: [Object] },
card_payments: {
decline_on: [Object],
statement_descriptor_prefix: 'NOTARY ',
statement_descriptor_prefix_kana: null,
statement_descriptor_prefix_kanji: null
},
dashboard: { display_name: 'Facebook', timezone: 'Etc/UTC' },
payments: {
statement_descriptor: 'JRIGG’S NOTARY SERVICE',
statement_descriptor_kana: null,
statement_descriptor_kanji: null
},
payouts: {
debit_negative_balances: true,
schedule: [Object],
statement_descriptor: null
},
sepa_debit_payments: {}
},
type: 'standard'
}
Ok, checking on this
In second console:
error
message: 'Only live keys can access this method.',
request_log_url: 'https://dashboard.stripe.com/acct_1LO4kDAamNC0OSWr/test/logs/req_J1S5Qt8nbZe0nC?t=1702902600',
type: 'invalid_request_error',
We can see all the logs, you don't need to keep repeating the same info
ok
on some ids I also get this
The provided key 'sk_live_Uf****************************4b18' does not have access to account 'acct_1AmGBZFC4Hb8cBUD' (or that account does not exist). Application access may have been revoked.
I think this err is because the key has been changed may be.
Alright, we took a look at this and we believe the reason that this errors intermittently on different accounts is because some of them have additional connections to other platforms. For example, acct_1LO4kDAamNC0OSWr has a live-mode connection to Calendly. That would prevent deletion via test mode keys
Equally, you can't delete it via your live mode keys as your platform only has a test mode connection
I suspect on the accounts where deletion worked, they didn't have live-mode connections to other parties (like Calendly)
ok so can you tell me what i can do to delete them
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
ok
You can delete the accounts that have Test mode connection with your test keys, and the same with Live mode.
no its not happening
when i try to delete account of test mode it gives error and the old person told me
Alright, we took a look at this and we believe the reason that this errors intermittently on different accounts is because some of them have additional connections to other platforms. For example, acct_1LO4kDAamNC0OSWr has a live-mode connection to Calendly. That would prevent deletion via test mode keys
Equally, you can't delete it via your live mode keys as your platform only has a test mode connection
I suspect on the accounts where deletion worked, they didn't have live-mode connections to other parties (like Calendly)
now my question is what i do to delete them.
You could try to disconnect the live mode connection via OAuth: https://stripe.com/docs/connect/oauth-reference#post-deauthorize
But I would recommend you to reach out to Stripe Support, so my engineering team can take a better look at this: https://support.stripe.com/?contact=true