#Joffrey

1 messages ยท Page 1 of 1 (latest)

sonic muskBOT
deft sandal
#

So you want to top up some funds to platform? am I right?

cobalt galleon
#

Yes, in part.

deft sandal
cobalt galleon
#

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.

deft sandal
#

are you using direct charges or destination charges?

cobalt galleon
#

And then, I want to pay the persons (people executing missions) from these funds.

cobalt galleon
deft sandal
#

https://stripe.com/docs/connect/charges I'd suggest you go through this doc and determine which charge works best for your business

Learn how to create a charge and split payments between your platform and your sellers or service providers when you accept payments.

cobalt galleon
#

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?

Learn how to use Connect to create charges on your platform account on behalf of connected accounts, perform transfers separately, and retain funds in the process.

#

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],
]);
deft sandal
#

What problem did you get?

cobalt galleon
#

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.
deft sandal
cobalt galleon
#

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.

deft sandal
#

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

cobalt galleon
#

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.

cobalt galleon
deft sandal
#

Do you have enough funds in test mode?

cobalt galleon
#

Yes, it works.

deft sandal
#

Then it means there's enough balance in test mode for the transfer.

#

it failed in live mode because there's insufficient balance

cobalt galleon
#

Ok, but I use the same code for both. Why the behavior is different then?

deft sandal
#

As I explained many times, it's because of your Stripe balance. You have sufficient in test mode, but insufficient in live mode.

cobalt galleon
#

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?

cobalt galleon
#

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?

deft sandal
#

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

Use test cards to validate your Stripe integration without moving real money. Test a variety of international scenarios, including successful and declined payments, card errors, disputes, and bank authentication. You can also test non-card payment methods and redirects.

cobalt galleon
#

Do you know how much time it takes approximately to be available? I thought CC payments were instant.

deft sandal
cobalt galleon
deft sandal
#

Can you take a screenshot and show me what you see?

cobalt galleon
deft sandal
#

Refresh it? or use a different browser?

cobalt galleon
#

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?

deft sandal
#

Yup, listen to balance.available

cobalt galleon
#

Ok, I'll check that. Thanks a lot ๐Ÿ™

sonic muskBOT