I can't figure out why my request is failing, I'm trying to create a checkout session with subscription mode and collecting a fee. This is the error message i get returned from Stripe.
{message: Can only apply a subscription application_fee_percent when the Checkout Session is made on behalf of another account (using an OAuth key or the Stripe-Account header).}
I am NOT using my main platform accountID, I have created a new connected user using express. And I am passing the new users connected accountID to my server for creating a session.
Here is my server code:
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
line_items: [{
price: 'price_Xxxxxxxxxxxx',
quantity: 1,
}],
subscription_data: {
application_fee_percent: 10,
transfer_data: {
destination: accountId,
},
},
mode: 'subscription',
success_url: 'http://localhost:49430/stripesub?session_id={CHECKOUT_SESSION_ID}',
cancel_url: 'http://localhost:49430/stripesubcanceled',
});
res.status(200).json({
'sessionId': session.id
});
The subscription product or line_items -> price
is a product I have created with my main platform account, not the connected account created with express.
My mission is to create a service where businesses can register with express, choose a subscription tier, and have their users/members sign up to their platform by paying the subscription and gain access.
So after some time talking to Stripe support i found out that this is wrong:
subscription_data: {
application_fee_percent: 10,
transfer_data: {
destination: accountId,
},
},
and it should look like this:
subscription_data: {
transfer_data: {
amount_percent: 90,
destination: accountId,
},
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.