#mboras-checkout-directcharges
1 messages ยท Page 1 of 1 (latest)
mboras-testdata-delete
@cosmic saffron https://stripe.com/docs/test-mode#delete-test-data
โค๏ธ
tnx
Can I get sanity check for my solution since I am making SaaS and this is my first time working with Stripe Connect.
Can I write question here and when you have time tell me if I'm missing something.
sure!
We are developing web/mobile app with Firebase. App is for sport facilities booking, online reservations, etc. We want to act as a middleman and the flow is:
- user creates payment of 20euros for example
- stripe takes XY percentage + XY fixed amount
- our platform takes XY percentage + XY fixed amount
Net amount is transferred to facility owner immediatelly.
so I've done following:
Facility owner ->
- stripe connect standard account (free plan)
- stripe connect link and entered all data for facility owner
Normal users ->
-
created checkout with
const session = await stripe.checkout.sessions.create({
mode: 'payment',
line_items,
payment_intent_data: {
transfer_group: stripeAccountId,
},
metadata -
in payment success webhook I do following
const paymentIntent: StripePaymentIntent = await stripe.paymentIntents.retrieve(payment_intent, { expand: ['latest_charge.balance_transaction'], });
/*Transfer money to the facility owner/
if (
typeof paymentIntent.latest_charge === 'string' ||
typeof paymentIntent.latest_charge?.balance_transaction === 'string'
) {
throw new Error('No latest charge found');
}
...
const stripeFee = paymentIntent.latest_charge?.balance_transaction?.fee;
const totalAmount = paymentIntent.amount;
const applicationFeeAmount = 50; // 50 cents, or 0.50โฌ
console.log({
stripeFee,
totalAmount,
applicationFeeAmount,
});
if (!stripeFee) {
throw new Error('No stripe fee found');
}
const netAmount = totalAmount - stripeFee;
const transferAmount = netAmount - applicationFeeAmount;
const transferGroup = paymentIntent.transfer_group;
console.log('Transfer amount', transferAmount);
console.log('Transfer group', transferGroup);
const transfer = await stripe.transfers.create({
amount: transferAmount,
currency: 'eur',
destination: transferGroup || '',
transfer_group: transferGroup || '',
});
console.log('Transfer', transfer);
this is the flow in shortest
(lots of people cam ein and that's a lot of text so will take me some time to read and reply but I'll follow up in a bit)
I'm not in hurry really
Please take your time
I won't change this logic ๐
since I need to add fiscalization in all of this
I can't use transfers like this with stripe standard connect account?
I see that now
okay back
Okay so first you are using Standard accounts. In that case you have to use Direct Charges: https://stripe.com/docs/connect/direct-charges
You should ~never use Separate Charges and Transfers
created standard account through dashboard and transfered to account on success webhook
So you basically have to change your whole integration if you stick to Standard accounts. It's crucial as otherwise you will be on the hook for all fees, negative balances, disputes, etc. Absolutely not what you want if you don't control onboarding of the account and what they do in their Dashboard
I am now confused. Why I can't create my stripe account, add some money on balance and then take payment from users and on payment success I know what is the fee of the Stripe and then I can calculate my fee.
I've now tested the logic above and please can you explain me what is the best for the following use case.
I am transfering money to facility owner after payment because I don't know what type of card user will choose and what is the Stripe fee
yeah sorry you are a bit lost and mixing up many fundamental things right now
The first step is for you to understand which flow of funds is allowed. This is fundamental before anything else happens
Okay so first you are using Standard accounts. In that case you have to use Direct Charges: https://stripe.com/docs/connect/direct-charges
You should ~never use Separate Charges and Transfers
So you basically have to change your whole integration if you stick to Standard accounts. It's crucial as otherwise you will be on the hook for all fees, negative balances, disputes, etc. Absolutely not what you want if you don't control onboarding of the account and what they do in their Dashboard
can you carefully read this and confirm you understand?
I am now reading it and yeah you're right this is what I need.
Okay so if you understand that, it's going to completely change the flow of funds for you (and solve your earlier problem about the balance)
so I can also in my payment success webhook transfer to facility owner net amount and specify my application fee
I am using stripe checkout for payment
You don't collect the funds yourself and later transfer them. This will not work with Standard accounts.
Please take a few minutes to watch https://www.youtube.com/watch?v=dCL9adgdP0A
can I use stripe checkout with direct charges
yes
but when should I create charge then
why should I create charge on checkout creation?
you don't create any charge
you use Checkout which is our hosted product that will collect payment method details and create all the relevant object.
where do I specifiy it
where do you specific "what"? What is "it?
yeah sorry you still seem totally lost ๐ฆ
There's no "transfer of money" with the Direct Charges flow. Did you watch the video? It explains in details the flow of funds, the two account(s) involved, etc.
You are a platform. You have a connected account acct_123 that you're helping accept payments. You create the Session on their account using the Stripe-Account header option documented in https://stripe.com/docs/connect/destination-charges and you configure the fee that you want as a share of the payment using https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-application_fee_amount
It's really the same as the video or https://stripe.com/docs/connect/direct-charges except those use a PaymentIntent but you use Checkout. Otherwise it works the same
mboras-checkout-directcharges
@quasi remnant adding you back to take over as I have to run soon. It's a long thread but you can mostly ignore the backlog.
Summary is that @cosmic saffron is building a Connect app where they faciliate payments for sport facilities/clubs and such. They use Standard accounts and were incorrectly using SCT but I explained they have to migrate to Direct Charges. They also use Checkout.
I explained above (last message) a clear summary of what to do but they might have more questions for you
acct_1ObTCmHnwNA3jJa6
pi_3ObTv6HnwNA3jJa61EYFB7u8
so now here I've taken 0.5 euros fee and stripe 0.4 euros
@orchid rain thank you very much for patience and explanation
Catching up, koopajah had to leave so I can help from here on out
I've started with direct charges and done everything like this first time but I don't know why I rejected this way
I thought that here stripe is taking fee from my fee
and if I set little amount stripe fee is larger than mine
....