#nerder-direct-charges
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ it looks like you're trying to make a direct charge, and in that case you would use your platform's API key, and provide the connected account's ID in the stripeAccount parameter.
ok cool
but that's quite strange
because how can I put a price there?
const stripe = new Stripe(PLATFORM_SECRET_API_KEY, { apiVersion: '2020-08-27' });
const subscription = await stripe.subscriptions.create(
{
customer: customerId,
items: [
{
price: priceId, //of the price created in the connected account
},
],
application_fee_percent: 0.8,
expand: ['latest_invoice.payment_intent'],
},
{
stripeAccount: 'ACCOUNT_ID_OF_CONNECTED_ACCOUNT',
},
);
should be like this?
That looks right, is it not doing what you're expecting?
is not what we are actually doing
right now we are doing it like this
const stripe = new Stripe(CONNECTED_ACCOUNT_SECRET_API_KEY, { apiVersion: '2020-08-27' });
const subscription = await stripe.subscriptions.create(
{
customer: customerId,
items: [
{
price: priceId, //of the price created in the connected account
},
],
application_fee_percent: 0.8,
expand: ['latest_invoice.payment_intent'],
},
{
stripeAccount: 'ACCOUNT_ID_OF_PLATFORM',
},
);
Ah, so in that approach you're actually making the call as the connected account, which won't allow you to collect an application fee percent.
ok now I got it!
that's very interesting
because we put in place a whole structure to choose base on the caller which private key to use
but in this way it makes way more simpler
every account is connected to our, so we create the subscription using our secret key
i'll try that real quick, but it makes much sense it was like that
๐ glad to hear, let us know if it gives you any trouble though
๐ฅณ Woohoo!