#Joffrey
1 messages ยท Page 1 of 1 (latest)
So you want to top up some funds to platform? am I right?
Yes, in part.
I want to collect payment from clients to top up the platform's balance, to keep the funds. Once the mission is done: send the funds to the client minus the platform fees (10%). As I need to control the timing when it is sent to the person executing the mission.
By now, I'm charging clients with a checkout session with a payment_intent_data having a "transfer_group" label.
are you using direct charges or destination charges?
And then, I want to pay the persons (people executing missions) from these funds.
To pay the persons executing the missions: transfers.
https://stripe.com/docs/connect/charges I'd suggest you go through this doc and determine which charge works best for your business
Thanks for the guidance.
I've found this page that is matching my case:
https://stripe.com/docs/connect/separate-charges-and-transfers
I've already been through all of this.
To charge the clients (people who pay the mission), I'm using checkout sessions. It seems to work to charge them and make a transfer in development mode but not in live mode?
It is the code I use to generate a Checkout session to make the client pays the mission:
$stripe->checkout->sessions->create([
'customer_email' => $offer->ad->client->email,
'payment_method_types' => ['card'],
'line_items' => [
[
'price_data' => [
'currency' => 'eur',
'product_data' => [
'name' => 'LABEL',
],
'unit_amount' => [AMOUNT],
],
'quantity' => 1,
],
],
'payment_intent_data' => [
'transfer_group' => [OFFER_ID_TO_MATCH],
'metadata' => [
...
],
],
'mode' => 'payment',
'success_url' => [URL],
'cancel_url' => [CANCEL_URL],
]);
What problem did you get?
Here is the error message I get:
You have insufficient funds in your Stripe account. One likely reason you have insufficient funds is that your funds are automatically being paid out; try enabling manual payouts by going to https://dashboard.stripe.com/account/payouts.
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Yes sure, let me check.
req_94K2RnNAD5nQDz
Here it is.
Here is the full code I use to make the client pays and transfers to the missionner:
// To charge the client for the mission
$stripe->checkout->sessions->create([
'customer_email' => $offer->ad->client->email,
'payment_method_types' => ['card'],
'line_items' => [
[
'price_data' => [
'currency' => 'eur',
'product_data' => [
'name' => 'LABEL',
],
'unit_amount' => [AMOUNT],
],
'quantity' => 1,
],
],
'payment_intent_data' => [
'transfer_group' => [OFFER_ID_TO_MATCH],
'metadata' => [
...
],
],
'mode' => 'payment',
'success_url' => [URL],
'cancel_url' => [CANCEL_URL],
]);
// To transfer funds to the missionner:
$stripe->transfers->create([
'amount' => [AMOUNT_IN_CENTS_MINUS_PLATFORM_FEE],
'currency' => 'eur',
'destination' => [STRIPE_ACCOUNT_ID],
'transfer_group' => [OFFER_ID_TO_MATCH],
]);
Of course, I'm using the official PHP Stripe library.
This request is for transfer creation, not checkout session creation.
And as the response explained, the transfer is unsuccessfuly because you don't have enough balance.
You should develop and test in test mode, not live mode
I develop in test mode and it worked to charge the client and pay the missioner but before launching, we give it a test drive.
Yes, but it doesn't work as you said there isn't enough funds.
But in test mode, it worked.
I charge my client, hold the funds, when the mission is finished and validated, I transfer to my missionner minus the platform fees. But not funds...
It works in test mode, not in live mode.
Do you have enough funds in test mode?
Yes, it works.
Then it means there's enough balance in test mode for the transfer.
it failed in live mode because there's insufficient balance
Ok, but I use the same code for both. Why the behavior is different then?
As I explained many times, it's because of your Stripe balance. You have sufficient in test mode, but insufficient in live mode.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yes, I get that. But the balance is only fed by clients payments. That's why I don't understand.
Do you mind if I test again in test mode and come back to you afterwards?
Ok! I just tried it and it works in test mode with the 4000000000000077 card (funds added to balance directly).
I have one question, when I make people pay through a Checkout session, it is not directly added to my stripe balance?
it takes time for the funds to be availble in your balance
https://stripe.com/docs/testing#available-balance you can use these test cards to send the funds from a test transaction directly to your available balance
Oh ok! I just requested the balance through the API and yes, it is in pending...
Do you know how much time it takes approximately to be available? I thought CC payments were instant.
Also the API docs do not display in my browser.
https://stripe.com/docs/api/balance/balance_retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you take a screenshot and show me what you see?
Refresh it? or use a different browser?
Brave v1.58.129 - Chromium 117
I'm using Safari to browse it but it is not really convenient.
I guess there is a webhook to detect when funds are available?
Yup, listen to balance.available
Ok, I'll check that. Thanks a lot ๐