#amepro

1 messages · Page 1 of 1 (latest)

fallow otterBOT
ornate juniper
#

Can you share any example payment IDs? pi_xxx

vocal owl
#

yes one moment

#

acct_xxxxxxxxx

ornate juniper
#

That works too

vocal owl
#

ok but why does it tell me that I have no funds? shouldn't it use the funds from the customer's payment?

#

Or is this because I'm using the test credit cards that Stripe provides?

ornate juniper
#

If you share an ID I can look at I can see what's going on

vocal owl
#

which id? mine or that of the express courier that I generated via connect?

ornate juniper
ornate juniper
vocal owl
#

i'm in test mode

#

one moment

ornate juniper
#

Can you paste that here

vocal owl
#

pi_3MExdvLKgAwrDGTa05kd1lrz

#

it's ok?

ornate juniper
#

Taking a look

vocal owl
#

ok thanks

ornate juniper
#

Where does it tell you you have no funds?

vocal owl
#

after sending the test credit card payment

#

it gives me a response with that error

ornate juniper
#

What gives you a response?

#

Are you making an API request that returns an error?

vocal owl
#

yes i'm using laravel

ornate juniper
vocal owl
#

ok one moment

#

this the log

[2022-12-19 09:54:05] local.INFO: Stripe_Event ["payment_intent.succeeded",{"Stripe\StripeObject":{"order":"29"}},{"Stripe\Event":{"id":"evt_3MGg2pLKgAwrDGTa0sqhJl9z","object":"event","api_version":"2022-11-15","created":1671443644,"data":{"object":{"id":"pi_3MGg2pLKgAwrDGTa0ycAzBSh","object":"payment_intent","amount":1400,"amount_capturable":0,"amount_details":{"tip":[]},"amount_received":1400,"application":null,"application_fee_amount":null,"automatic_payment_methods":null,"canceled_at":null,"cancellation_reason":null,"capture_method":"automatic","client_secret":"pi_3MGg2pLKgAwrDGTa0ycAzBSh_secret_kqukT860m47VatF8lYSm5kM79","confirmation_method":"automatic","created":1671443643,"currency":"eur","customer":null,"description":null,"invoice":null,"last_payment_error":null,"latest_charge":"ch_3MGg2pLKgAwrDGTa0s7HMFZv","livemode":false,"metadata":{"order":"29"},"next_action":null,"on_behalf_of":null,"payment_method":"pm_1MGg2oLKgAwrDGTa2ru5MRVE","payment_method_options":{"card":{"installments":null,"mandate_options":null,"network":null,"request_three_d_secure":"automatic"}},"payment_method_types":["card"],"processing":null,"receipt_email":null,"review":null,"setup_future_usage":null,"shipping":null,"source":null,"statement_descriptor":null,"statement_descriptor_suffix":null,"status":"succeeded","transfer_data":null,"transfer_group":"29"}},"livemode":false,"pending_webhooks":2,"request":{"id":"req_aQrwzXLzL6SEzd","idempotency_key":"9dc06e5f-53b6-431d-9791-aaf784d61f4a"},"type":"payment_intent.succeeded"}}]

ornate juniper
#

I'm not seeing an error there. That's just a Payment Intent object from an Event

vocal owl
#

I always use these test credit cards

ornate juniper
#

The specific available balances ones, like 4000000000000077?

#

pi_3MGg2pLKgAwrDGTa0ycAzBSh used the 4242 card

#

Those funds won't be available immediately, they're in a pending state (like a normal card payment)

#

You need to use the available balance cards I've linked

vocal owl
#

ok I did as you told me but in the connect account I still can't find anything, while in my dashboard I found the payment for the product and the shipping money seems to have disappeared

ornate juniper
#

How are you transferring funds to the connected account? There's no parameters on that Payment Intent that would send a balance to any connected accounts

vocal owl
#

in this way

Stripe::setApiKey(env('STRIPE_SECRET'));
                    // Create a Transfer to a connected account
                    $transfer = Transfer::create([
                        'amount' => number_format($orderCourier->shipment_price, 2, '', ''),
                        'currency' => 'eur',
                        'destination' => env('STRIPE_COURIER_ID'),
                        'transfer_group' => $order->id,
                    ]);
ornate juniper
#

Can you share an example req_xxx for one of those API requests?

vocal owl
#

where can i find req_xxx

#

??

ornate juniper
vocal owl
#

req_ttGQ2A5QhsjSSB

ornate juniper
#

That's not an API request for the transfer, that's for the original payment

#

What is it you're trying to do exactly?

vocal owl
#

I buy a product that costs $10 and shipping costs $5

$10 must end up in my account while the $5 for shipping automatically goes to the courier

ornate juniper
#

Looks like you're using Checkout? Then you can just pass these params when you create your session to automate the transfer: payment_intent_data.application_fee_amount & payment_intent_data.transfer_data[destination]

https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data

vocal owl
#

ok I'll try and let you know

#

can i use in Transfer::create the payment_intent_data ?

ornate juniper
#

I don't understand the question

vocal owl
#

i've tried in this way:

            $intent = [
                'transfer_group' => $order->id,
                'metadata' => ['order' => $order->id],
            ] ;

            if ($this->order['shipment'] == true){

                $intent['transfer_data'] = [
                    'destination' => env('STRIPE_COURIER_ID'),
                    'amount' => number_format($this->order['shipment_price'], 2, '', ''),
                ];
            }



            $payment = $stripe->checkout->sessions->create([
                'mode' => 'payment',
                'success_url' => route('tpage', ['orderid' => $order->id]),
                'cancel_url' => 'https://example.com/cancel', //TODO
                'line_items' => $products,
                'payment_intent_data' => $intent,
            ]);

but doesn't work

ornate juniper
#

What do you mean by 'doesn't work'? Did it return an error?

vocal owl
#

it does nothing

#

is it the correct way?

ornate juniper
#

Can you share the cs_xxx ID that API call created?

vocal owl
#

the problem is the shipment can be more then products cost

#

how can i manage this problems?

#

req_Ryt33Zviks0qbU?t=1671449734

stable fossil
#

I don't really follow, you passed an amount of 14 EUR but try to transfer 277 EUR so that naturally won't work. You can look at the log in the dashboard to see what your code passed.

vocal owl
#

my bad