#SaileshKumar - Class Marketplace

1 messages ยท Page 1 of 1 (latest)

fervent terrace
#

This sounds like a use case for Separate Charges & Transfers. In that case you (the platform) create charges to the customer independent of paying out to the teachers.

#

In that case, when the class finishes you would initiate the Transfer to the teacher's Stripe account. Does that make sense?

balmy pagoda
#

Ah this looks promising

#

so would I create a transfer group for each class?

fervent terrace
#

That would be a sensible way to go about it. The transfer_group value is really used to help you keep track of which charges connect with which transfers

balmy pagoda
#

Makes sense, that way all people buying a class would have their funds in the class's transfer group

#

then the class can transfer the relevant funds to the teacher

#

So currently I use await stripe.checkout.sessions.create, I need to change from session to transfer?

#

or can i just pass in transfer group there

fervent terrace
#

Hold on, we need to back up a bit before we answer something like that.

Are you currently configured to use Stripe Connect?

balmy pagoda
#

Yes, stripe connect using express accounts

fervent terrace
#

Okay so Checkout Sessions create a Payment Intent as part of the process

balmy pagoda
#

Yea, currently I pass in:

payment_intent_data: {
      application_fee_amount: feeAmountCents,
      transfer_data: {
        destination:
          [TEACHER_STRIPE_ID],
      },
    },
#

instead can I pass in the transfer group for the destination?

fervent terrace
#

You can include the transfer group in the payment_intent_data

balmy pagoda
#

Got it - this is very helpful

#

It looks like in the docs it says to " create a transfer_group and assign the charge to the transfer_group", but in the code I'm not too sure which one is actually creating a transfer group. Is that happening under the hood?

fervent terrace
#

When you attach the transfer group to the payment intent is when it gets created.

balmy pagoda
#

So in this example, let's say Bob creates a class. Bob then has a stripe account ID, and the class has a stripe product. When Sally goes to checkout, we pass in the class ID as the transfer group, so all of her funds for the class are held in this transfer group. Do I then manually transfer the funds to Bob, or can I trigger that manually when the class ends?

#

Ah that's what

const transfer = await stripe.transfers.create({
  amount: 7000,
  currency: 'usd',
  destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
  transfer_group: '{ORDER10}',
});
#

is doing

fervent terrace
#

Yes, yes it is. Where the Destination is Bob's Stripe account ID

balmy pagoda
#

Incredible - i see in the docs it says "You can assign any value to the transfer_group string, but it must represent a single business action.". Does this mean that if 5 people pay for a class, they should each have a different transfer group string? Isn't that defeating the point?

fervent terrace
#

This is really just a recommendation for best practices. For your perspective the class is the business action, not the individual payments.

charred spade
#

FYI, recommendation from a Stripe user - I do exactly this

balmy pagoda
#

Thank you all. This was super helpful ๐Ÿ™‚

fervent terrace
#

Happy to help ๐Ÿ‘

balmy pagoda
#

where do I leave the 5 star review ๐Ÿ˜„

balmy pagoda
#

In this model, would the "take rate", just be what's left after making the transfers?

So Bob makes class, Sally pays for it. Sally's amount is in transfer group. Platform transfers amount to Bob, and whatever's left is the platform's take rate?

fervent terrace
#

What "take rate" are you referring to?

#

You would still determine the amount you Transfer to Bob for the class. So your implementation would determine what amount you want to hold on to.

balmy pagoda
#

Yea, what I mean is let's say the class cost 10$, and the platform keeps 3$ as its fee. When I transfer the 7 to Bob, do I need to transfer the remaining 3 somewhere else

fervent terrace
#

Nope, you (the platform) retain that balance and you can trigger a payout to your external bank account to collect the remaining $3

balmy pagoda
#

Got it. And can these transfers be made via Dashboard or only API?

#

as in based on the amount of the transfer group

fervent terrace
#

If you use the Dashboard to create a Transfer you won't have the transfer group assigned so it's less ideal

balmy pagoda
#

Got it

#

I'm thinking I'll make a quick tool for my non technical admin to use. That way he can click transfer for a class, it'll know the teacher, and calculate the take rate. I assume I can just query the transfer group to get the amount in there?

fervent terrace
#

Not exactly, it's a little more messy. You can auto-paginate all Payment Intents and search the returned objects for the correct transfer group

#

Wait wait wait. You can filter the Charges object by Transfer Group. This will work as Payment Intents generate Charge records and this will accurately reflect the charges associated with a single transfer group

balmy pagoda
#

Ah so I can just get all the charges for one transfer group, and then calculate the amount to transfer to teh teacher

#

the*

stone wadi
#

๐Ÿ‘‹ I stepped in for Snufkin who had to step away. That sounds reasonable, do you have everything you need to proceed from here?

balmy pagoda
oak sky
#

Hello! Yep, that's the one!

balmy pagoda
#

Awesome. Gonna build this out and will update here with my progress ๐Ÿ™‚

#

Ah wait another question - if my teacher makes their account in India for example, when I transfer the funds can I still list "usd" and have Stripe take care of converting and fees?

#

Or do I need to search up what their currency is?

#

Also is there a way to prevent a bug of accidentally transferring the same charge multiple times?

oak sky
balmy pagoda
#

ah not for payments, but for transferring

#

it sounds like i need to have a recurring system of transferring money for classes to their teacher after the class finishes

oak sky
#

I'm not sure I understand, can you provide more specific details?

balmy pagoda
#

Sure!

So a teacher creates a paid class, and students are paying for it before the class happens to reserve their spot essentially. To prevent the teacher from getting paid before the class actually happens, all the payments go to a transfer group. Once the class is done, we'll initiate a transfer.

We compute the amount to transfer using the charges API filtered by transfer group.

What I want to do, is after I finish the transfer, do something to mark the transfer group (or charges) as "complete", so there's no risk of accidentally transferring the money twice.

#

I think I'm worried since the transfer group is really just an alias, I'm not transferring money "from" the group to the teacher, but from my account itself. If it was "from" the group, then I can't transfer more than the group has

#

Does that make sense?

oak sky
balmy pagoda
#

I am, maybe I'm misunderstanding how transfer_group works

#
 await stripe.transfers.create({
    amount: amountForTeacher,
    currency: "usd",
    destination: teacherStripeId,
    transfer_group: classID,
  });
#

I thought the max amount I could transfer is what is in the account, NOT what it is in the transfer group. Is that incorrect?

charred spade
#

Hey, I'm doing some of this... my observation is that the "max amount" is up to the maximum available amount in the transfer_group (don't forget fees) - but the funds do have to be in your platform account

oak sky
#

No, you can transfer up to your available account balance, but if you're using transfer_group everywhere you should be able to use that to keep track of how much has been transferred per group.

balmy pagoda
#

Ah but if somehow my transfer function ran multiple times, it would in theory be taking money from the account that wasn't for said group?

oak sky
#

Yeah, if you're worried about that happening you should add logic to see how much has already been transferred.

balmy pagoda
#

Got it - is there anything on Stripe said to protect against this or it should all be done on my side?

#

Stripe side*

oak sky
#

The API will do what you tell it in general, so if you want to make sure you're not telling the API to do the wrong thing you should make sure of that on your end.

balmy pagoda
#

Yea I understand that, was more looking for a safety mechanism for the transfer group