#mboras-checkout-directcharges

1 messages ยท Page 1 of 1 (latest)

winter mistBOT
orchid rain
#

mboras-testdata-delete

cosmic saffron
#

โค๏ธ

#

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.

orchid rain
#

sure!

cosmic saffron
#

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

orchid rain
#

(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)

cosmic saffron
#

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

orchid rain
#

okay back

cosmic saffron
#

or I can

#

I've now tested this

orchid rain
cosmic saffron
#

created standard account through dashboard and transfered to account on success webhook

orchid rain
#

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

winter mistBOT
cosmic saffron
#

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.

orchid rain
cosmic saffron
#

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

orchid rain
#

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

cosmic saffron
#

pi_3ObTItABvR2sPGgd13v027e9
acct_1ObTCmHnwNA3jJa6

#

ok I'm listening

orchid rain
#

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?

cosmic saffron
#

I am now reading it and yeah you're right this is what I need.

orchid rain
#

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)

cosmic saffron
#

so I can also in my payment success webhook transfer to facility owner net amount and specify my application fee

orchid rain
#

no

#

you're really misunderstanding still ๐Ÿ™‚

cosmic saffron
#

I am using stripe checkout for payment

orchid rain
#

You don't collect the funds yourself and later transfer them. This will not work with Standard accounts.

cosmic saffron
#

can I use stripe checkout with direct charges

orchid rain
#

yes

cosmic saffron
#

but when should I create charge then

#

why should I create charge on checkout creation?

orchid rain
#

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.

cosmic saffron
#

where do I specifiy it

orchid rain
#

where do you specific "what"? What is "it?

cosmic saffron
#

what is the fee of our platform on every payment

#

and to who to transfer money

orchid rain
#

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.

cosmic saffron
#

sorry

#

wait
I'll watch full video

#

sorry

orchid rain
#

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

cosmic saffron
#

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

quasi remnant
#

Catching up, koopajah had to leave so I can help from here on out

cosmic saffron
#

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

#

....

quasi remnant
#

Stripe does not take an additional fee from your application fee unless taking that fee causes a currency conversion in some way

#

What was rejected? It looks like that intent succeeded on the first payment attempt

cosmic saffron
#

i've deleted all test data first time

#

neverthless once again thans to @orchid rain

#

thanks

#

if I want to have automatic tax enabled with direct charges I need to set stripe tax on connected account?

#

yeah

#

thanks

#

๐Ÿ˜„