#Linq2

1 messages · Page 1 of 1 (latest)

obsidian pond
#

Hey there. What are you trying to achieve here? Why are you creating both a Charge and a Payment Intent?

tame remnant
#

I have onboarding Express connect accounts

Using Laravel, what I want to do, without adding any Items, Products to Stripe, is use my own products in our database, pass payment fees to our Main account and Pass the Remainder to the connect account..

Example on our site, an Item costs £10
the buyer pays £10 + 2% = £10.20
the Connect account pays 2% + 0.25% + 10p out of the £10.00
so £9.68 goes the the connect account and the remaining 0.52p goes to the Main Stripe account to cover payout fees ect..

#

at the moment, it is paying all into the main account, but then trowing the following error:

You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method.

obsidian pond
#

Well, yep. You need to pass a payment method to facilitate the payment

#

I can see you're passing a token when creating the Charge, but that's completely redundant code (you shouldn't use Charges)

#

You should be able to get the flow of funds you want:

tame remnant
#

right I have implemented the following:

$payment_intent = \Stripe\PaymentIntent::create([
'amount' => 1020,
'currency' => 'gbp',
'application_fee_amount' => 0052,
'transfer_data' => [
'destination' => 'connect_account_details',
],
]);

has gone through without errors, but has put the full amount in the main account and marked it as incomplete

#

{
"id": "pi_3Ksld.........",
"object": "payment_intent",
"last_payment_error": null,
"livemode": false,
"next_action": null,
"status": "requires_payment_method",
"amount": 1020,
"amount_capturable": 0,
"amount_details": {
"tip": {
"amount": null
}
},
"amount_received": 0,
"application": null,
"application_fee_amount": 42,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"charges": {
"object": "list",
"data": [
],
"has_more": false,
"total_count": 0,
"url": "/v1/charges?payment_intent=pi_3KsldI....."
},
"client_secret": "pi_3Ks......",
"confirmation_method": "automatic",
"created": 1650968916,
"currency": "gbp",
"customer": null,
"description": null,
"invoice": null,
"metadata": {
},
"on_behalf_of": null,
"payment_method": null,
"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,
"transfer_data": {
"destination": "connected_account_id"
},
"transfer_group": null
}

#

what do I need to add & where

obsidian pond
tame remnant
#

right so i pay the correct information back to the developer, they don't need the following:
$transfer = \Stripe\Transfer::create([

#

for the money to go in tobothaccounts.

obsidian pond
#

Looks like you've set it up for destination charges, with the transfer_data[destination] and application_fee_amount parameters

#

So generally a separate transfer wouldn't be needed, no!

tame remnant
#

ok I currently have the following:

#

$customer = \Stripe\Customer::create([
'name' => Auth::user()->name . ' '. Auth::user()->surname,
'email' => Auth::user()->email,
'description' => Auth::user()->name .' '. Auth::user()->surname,
]);

#

to create the customer, I will work through that to display everything, just wanted to make sure i was passing a customer object.

#

$payment_intent = \Stripe\PaymentIntent::create([
'amount' => 1020,
'currency' => 'gbp',
'on_behalf_of' => 'acct_.......', // Not sure if this required???
'transfer_data' => [
'amount' => 968,
'destination' => 'acct_.....',
],
'payment_method_data' =>[
'type' => 'card',
'card'=> [
'instalments' => null,
'mandate_options' => null,
'network' => null
'token' => $request->stripeToken,
]
],
'customer' => $customer->id,
// Adds customer details to Payment

      ]);
#

does that look right or am I still missing anything?

#

transferdate is actually transfer_data

obsidian pond
tame remnant
#

yes ours should follow the second flow, as we take the fees, to cover payout ect...

#

that is correct, transfer_data[amount] so what is left in the connect account they can draw that down without in-curing further fees?

obsidian pond
#

Yes, there's no fess imposed on payouts (to external accounts)

tame remnant
#

What our end goal is, the fees go in to the main account, to cover ALL stripe fees, then what is left in the Connected account is what that user can drawdown to their bank without incurring further fees, as I understand it, I need to use transfer_data[amount] method and remove from payment_intent 'on_behalf_of' => '',
thank way we get the fees, the connect account gets the remainder without further fees

obsidian pond
#

Yep, that's how it works! This is easy enough for you to test, too

#

That way you can try out scenarios and see how the funds flow between accounts

tame remnant
#

right, do you have access to my test account.

obsidian pond
#

Yep, I can

tame remnant
#

could you look and explain why the payments are marking as incomplete, even though I'm using the test card

obsidian pond
#

Can you share a Payment Intent ID pi_xxx

tame remnant
#

pi_3KsmRiBSmYxaSWkP0eri6ltP

proper mica
#

you have to confirm the PaymentIntent, just creating it doesn't complete or attempt the payment. You can see in the API the status is requires_confirmation and the state machine is documented at https://stripe.com/docs/payments/intents