#linq2-connect

1 messages · Page 1 of 1 (latest)

halcyon niche
#

hi, reading..

queen veldt
#

thanks, it's not my code, someone I asked to do a simple booking system has done the code from line 111 for last 6 weeks they have been at it.

halcyon niche
#

so the code is a bit confusing since it's using both the legacy approach (posting a Token to your server and using Stripe\Charge::create ) and the current approach(using Stripe\PaymentIntent )

#

the code also creates an Express account and then uses it for a Direct Charge, which is not recommended either(you generally use Destination Charges for Express)

queen veldt
#

I did the code up to line 111 for express onboarding, I know this works to create the partner, I take it that bit is still correct?

halcyon niche
#

that seems fine I think

#

I didn't realise you're able to create a Person object for Express but I guess it's possible if the code work when you run it!

queen veldt
#

thanks the end goal is, to have partners use the onboarding, then for members to book fishing pegs, the payment goes to the partner, minus admin fees

#

which goes to the main account

halcyon niche
#

which is that you should either use Checkout(the PHP code creates a CheckoutSession and redirects the browser to it), or PaymentIntents(the PHP code creates a PaymentIntent and then passes it to frontend Javascript to display a card input and process the payment)

#

the 'old way' that code uses of accepting a token from a POST request should not be used anymore, the links above are the correct way to use Stripe to process payments

queen veldt
#

<form action="/create-checkout-session" method="POST">

#

so does that relate to $session = \Stripe\Checkout\Session::create([

halcyon niche
#

yes

queen veldt
#

so when you click submit, it then runs that code and pushes the data to the connect account?

#

sorry for been a bit thick, i usually learn visually as slightly dyslexic

pastel stump
#

Hi! I'm taking over karllekko.

#

When clicking on the submit button, the customer is redirected to a stripe hosted page called Checkout Session, where they have to enter their payment details.

#

And once they submit the Checkout Session, then the payment is made to both the platform account and the connected account.

queen veldt
#

ok so in the code I submitted, if I get rid of everything from line 111

#

then on my checkout form, do I have to pass any hidden fields?

#

like you used to?

pastel stump
queen veldt
#

sorry, hidden fields in the form, they used to pass params via hidden fields in the form...

pastel stump
#

Who is "they"? And what information would you like to pass to the form?

queen veldt
#

such as this

#

<input type="hidden" name="main_amount" value="<?php echo number_format((float)$main_amount, 2, '.', ''); ?>" />

#

pass from the html form to the stripe session

pastel stump
#

To clarify: when using Checkout Session, you no longer need to create a payment form, Stripe will do that for you!

#

To set the amount on the Checkout page, we recommend using a price object. So first you create a price object (either in the dashboard or with the API), and then you pass the price ID when creating the Checkout Session: price: "price_xxx".

queen veldt
#

the price, will be coming from our database, not stripe..

#

just so i don't get confused again! the documents links sent are as follows:

docs/connect/collect-then-transfer-guide - this transfers all the money to the connected account, then takes 'application_fee_amount' and places that in the main stripe account.

pastel stump
queen veldt
#

docs/connect/enable-payment-acceptance-guide - this take payment to the main account and then passes the remainder to the connect account?

pastel stump
#

docs/connect/collect-then-transfer-guide - this transfers all the money to the connected account, then takes 'application_fee_amount' and places that in the main stripe account.
All money is sent to the platform account, and then a transfer is made to the connected account. In the end the platform only keeps the application fee, and the rest is for the connected account. This image is a good summary:

queen veldt
#

right got it... so we need to follow this guide docs/connect/collect-then-transfer-guide
which charges the whole monies to the Platform account, then transfers all the monies to the connected account, the transfers the Application fees (which will cover all stripe fees including withdrawal payments)?

pastel stump
#

Yes, you need to create a Checkout Session like this, and then once the customer fills the payment form, Stripe will automatically take care of sending the funds to your platform and connected account.

queen veldt
#

with the following, as we don't store items on stripe,
'line_items' => [
[
'price' => 10.00,
'quantity' => 2,
],
Could we add a description of the item

#

if so what would that param be?

#

or some id so we could Identify what it is?

pastel stump
#

Could we add a description of the item
Yes in product_data there is name and description

queen veldt
#

one last question

#

we have 2 fees, one for the user and one for the connected account

example a peg booking is £10.00
user we add 2% booking fee
total £10.20 to the user
we charge charge the partner 2% plus 0.25% + 10p (this covers all stripe transaction fees)

how do I take the payment to of £10.20 but only send £10.00 to the connected account and then retrieve the application fees from the connected account?

pastel stump
#

When creating the checkout sessions you have to set two things:

  • The price the customer pays: price_data.unit_amount
  • And the application fee the platform receive application_fee
#

It's up to you how you set these two amounts.

queen veldt
#

the booking fee we don't want the partner to see that, that is why I ask

pastel stump
#

Here "partner" is the connected account?

#

When using destination charges, the connected account would see the full amount paid by the customer yes.

queen veldt
#

I want the booking fee to remain in the main account and then the £10.00 to go to the connected account, is that possible in anyway?

pastel stump
queen veldt
#

also is it possible to pay several connected accounts in one payment?

pastel stump
#

also is it possible to pay several connected accounts in one payment?
Yes, with Separate Charges & Transfer you can.