#baris_api

1 messages ยท Page 1 of 1 (latest)

midnight caveBOT
#

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

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

knotty ridge
#

So it looks like you're creating the charge using the Connect Account's API key, as opposed to using one of the other methods for making requests on behalf of the connected account. You need to make the request as the platform using one of these methods: https://docs.stripe.com/connect/authentication

Learn how to add the right information to your API calls so you can make calls for your connected accounts.

worthy hare
#

Hi, Im actually using the secretkey of my Platform Account. And Im using the { stripeAccount: connectedAccountId, } header with the Account ID of my Connect Account.

#

This is actually my Server implementation:

const functions = require('firebase-functions');
const stripe = require('stripe')(functions.config().stripe.secret_key);

exports.createPaymentIntent = functions.https.onRequest(async (req, res) => {
functions.logger.info("Request received", { structuredData: true });
const { amount, currency, connectedAccountId } = req.body;

if (!amount || !currency || !connectedAccountId) {
const errorMessage = "Missing required parameters";
functions.logger.error(errorMessage, { amount, currency, connectedAccountId });
return res.status(400).send({ error: errorMessage });
}

functions.logger.info("Request received With AccountID", connectedAccountId);
functions.logger.info("Request received With Currency", currency);
functions.logger.info("Request received With amount", amount);

try {
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
automatic_payment_methods: {
enabled: true,
},
application_fee_amount: 123,
},{
stripeAccount: connectedAccountId,
});

res.json({ 
  clientSecret: paymentIntent.client_secret, 
  publishableKey: 'pk_test_51P8nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 
});

} catch (error) {
functions.logger.error("Error creating PaymentIntent", { error });
res.status(500).send({ error: error.message });
}
});

knotty ridge
#

So that's the code for creating a Payment Intent, which seems to be working as expected: https://dashboard.stripe.com/test/logs/iar_FIepzd7EvRrQKe

You need to find the code that's confirming the Payment Intent. That's where the account header is not being used. An example of what that looks like for a client-side app is here: https://docs.stripe.com/connect/authentication?create-client=react-native#adding-the-connected-account-id-to-a-client-side-application

Learn how to add the right information to your API calls so you can make calls for your connected accounts.

sick stoneBOT
worthy hare
#

https://dashboard.stripe.com/test/logs/iar_FIepzd7EvRrQKe did not work as aspected as we get that response after creating payment Intent: req_3hsZhEH7cBCnrY. The thing is if we create a payment intent without application_fee_amount parameter, it works fine. As said in documentation we added in our App.tsx : <StripeProvider
publishableKey='pk_test_51P8nGUJm0jxED7xccLh2ldqA53de1Z2K2c37XFjZGlElmbcdP5kv2eJTyY5trxxxx '
stripeAccountId='acct_1P8nGUJm0jxED7xc'
urlScheme='MyApp' // required for 3D Secure and bank redirects

>

// other Components
</StripeProvider> where publishableKey and stripeAccountId belong to plattform account. Is that correct?

cunning brook
#

๐Ÿ‘‹ stepping in here as two-shoes needed to step away

#

Yep so you are doing it correctly above but it looks like you mixed up your account IDs

#

acct_1P8nGUJm0jxED7xc looks to be the acocunt of your platform

#

Not your Connected Account

#

You need to pass in the Connected Account ID there

worthy hare
#

Hi bismarck ๐Ÿ‘‹ And publishableKey should be the public key of our platform account or also the connected account's?

cunning brook
#

Platform

#

You always use your Platform keys

#

You just pass the Connected Account ID both sever-side and client-side when making requests on their accounts