I use Stripe Connect to charge users credit card and transfer to a customer with a commission. I'd like to implement a 'Ride-sharing' functionality type on my app. The idea is to split the amount charged among a number of N people and still transfer to one customer, i.e. a many-to-one transaction.
What is the best way to implement that ? I didn't find any tutorial or docs for many-to-one transactions (only the other way around)
- One way is to create as many transfers as charges but it is not ideal for the customer because it can split the payout for one business transaction
- The other way, it seems, is to use 'Creating Separate Charges and Transfers' with several charges and one transfer thanks to a transfer_group.
But when I tried :
$charge1 = \Stripe\Charge::create(array(
"amount" => 500, "currency" => "eur", "customer" => "cus_1",
"transfer_group" => "mytransfergroup_1"
));
$charge2 = \Stripe\Charge::create(array(
"amount" => 500, "currency" => "eur", "customer" => "cus_2",
"transfer_group" => "mytransfergroup_1"
));
$transfer = \Stripe\Transfer::create(array(
"amount" => 800, "currency" => "eur", "destination" => "{CONNECTED_STRIPE_ACCOUNT_ID}",
"transfer_group" => "mytransfergroup_1",
));
I got the message
"Insufficient funds in Stripe account. In test mode, you can add funds to your available balance (bypassing your pending balance) by creating a charge with 4000 0000 0000 0077 as the card number."
Ok I am on test mode but in live, should I run a cron job every day to launch the transfer of my untransfered charges, so way after the time of the transaction ?
And even if the balance is enough, I am going to transfer money from older transactions for a more recent one. The problem is when the payout is due for the older transactions, I will not have enough on my balance to payout the right amount for my old transactions.
Hope I am clear.
Thanks for your help.