#SaileshKumar - Class Marketplace
1 messages ยท Page 1 of 1 (latest)
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?
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
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
Hold on, we need to back up a bit before we answer something like that.
Are you currently configured to use Stripe Connect?
Yes, stripe connect using express accounts
Okay so Checkout Sessions create a Payment Intent as part of the process
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?
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?
When you attach the transfer group to the payment intent is when it gets created.
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
Yes, yes it is. Where the Destination is Bob's Stripe account ID
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?
This is really just a recommendation for best practices. For your perspective the class is the business action, not the individual payments.
FYI, recommendation from a Stripe user - I do exactly this
Thank you all. This was super helpful ๐
Happy to help ๐
where do I leave the 5 star review ๐
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?
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.
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
Nope, you (the platform) retain that balance and you can trigger a payout to your external bank account to collect the remaining $3
Got it. And can these transfers be made via Dashboard or only API?
as in based on the amount of the transfer group
If you use the Dashboard to create a Transfer you won't have the transfer group assigned so it's less ideal
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?
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
Ah so I can just get all the charges for one transfer group, and then calculate the amount to transfer to teh teacher
the*
๐ I stepped in for Snufkin who had to step away. That sounds reasonable, do you have everything you need to proceed from here?
I believe so! https://stripe.com/docs/api/charges is the API for getting charges right
Hello! Yep, that's the one!
Specifically you can list Charges by transfer_group: https://stripe.com/docs/api/charges/list#list_charges-transfer_group
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?
Stripe will handle currency conversion for you, yes: https://stripe.com/docs/currencies/conversions
If you're using Payment Intents they can only be confirmed successfully once, so that should take care of multiple accidental payments. If you're using older APIs you should implement idempotency: https://stripe.com/docs/idempotency#sending-idempotency-keys
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
I'm not sure I understand, can you provide more specific details?
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?
So are you not specifying transfer_group when creating the Transfer? https://stripe.com/docs/api/transfers/create#create_transfer-transfer_group
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?
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
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.
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?
Yeah, if you're worried about that happening you should add logic to see how much has already been transferred.
Got it - is there anything on Stripe said to protect against this or it should all be done on my side?
Stripe side*
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.
Yea I understand that, was more looking for a safety mechanism for the transfer group