#nikosalewski
1 messages · Page 1 of 1 (latest)
Hi there!
Which code is throwing that error? Also do you have a request ID (req_xxx)?
If you don't find the request, can you share your platform account ID and the connected account ID?
The error is coming from my createCheckoutSession function. Here's a snippet:
exports.createCheckoutSession = functions
.region("europe-west1")
.https.onRequest((request, response) => {
corsHandler(request, response, async () => {
const {
accountId,
priceId,
userDisplayName,
userEmail,
childName,
childAge,
} = request.body;
if (!priceId) {
response.status(400).send({error: "No priceId provided"});
return;
}
try {
const priceData = await stripe.prices.retrieve(priceId, {
stripeAccount: accountId,
});
const unitAmount = priceData.unit_amount || 0;
const applicationFee = Math.round(unitAmount * 0.1);
const session = await stripe.checkout.sessions.create(
{
payment_method_types: ["card"],
line_items: [
{
price: priceId,
quantity: 1,
},
],
payment_intent_data: {
application_fee_amount: applicationFee,
},
mode: "payment",
success_url: "...",
cancel_url: "...",
metadata: {
userDisplayName,
userEmail,
childName,
childAge,
},
},
{
stripeAccount: accountId,
},
);
I thought that I can add the accountId via the stripeAccount: accountId dynamically to the Stripe header
Can you share the request ID (req_xxx)? You can find it here https://dashboard.stripe.com/test/logs
I can't see it there
If you don't find the request, can you share your platform account ID and the connected account ID?
platform account id: acct_1HkrOVDtsBuOl1Lo
connected account id: acct_1NuWf9AoBEriQhEK
Thanks! Give me a few minutes to look into this.
Thank you!
Are you using your live API key to make the request?
Yes. I use the live secret key in my backend and the public key like this:
const stripePromise = loadStripe(
"...7"
);
Error processing request: The provided key '...' does not have access to account '...' (or that account does not exist). Application access may have been revoked.
Can you share the full error message, without replacing the ids with "..." ?
Error processing request: The provided key 'sk_live_*********************************************************************************************H5Sni6' does not have access to account 'acct_1NuWf9AoBEriQhEK' (or that account does not exist). Application access may have been revoked.
The two ids should be correct
No worries. Thank you!
I just checked your platform account acct_1HkrOVDtsBuOl1Lo, and the secret key you are using sk_live_***H5Sni6' doesn't match the one I see in your dashboard.
So you are using the wrong secret key.
Your live secret key should end with z7.
Maybe that's the secret key of the connected account? I only have one platform account and even wrote the secret key down the one time I saw it.
If you are using the Stripe-Account header (stripeAccount in your code), then you have to use the API key of the platform account.
And if you login in your Stripe dashboard, you can see here your API key: https://dashboard.stripe.com/apikeys, which ends with z7. In your error message it ends with i6.
Hm, don't know how I did that but thank you a lot for your help. Now it works!