#paulC-connect
1 messages ยท Page 1 of 1 (latest)
Hello !
hello there
it refers to paying the Express account's accumulated balance out to their bank account.
'Payout' in Stripe always means moving money from a Stripe balance to an external account
I see, so generally if I use manual payouts each time the user confirms the service , the connected express account would technically never store funds in his/her stripe balance , is it correct?
they would store them. You can't do the manual payout if they don't have funds in their balance.
generally the way this works is you charge the customer and transfer funds to the connected account(let's say,via a Destination charge)
if you also set the connected account to manual payouts, the transferred funds sit there, until when you're ready(and after the funds are available to payout, per https://stripe.com/docs/payouts#standard-payout-timing ), you call the API to pay out some amount of that balance to their bank account
I understand , so flow would be something like this Receive full payment => Store each supplier's fraction of it in their stripe balance => When the user confirms the service use the payout API to actually trnasfer the supplier's Stripe balance into their account
yep
Got it , do you maybe know which API to call to store funds in their Stripe balance ?
it generally happens as part of implementing the payment flow(https://stripe.com/docs/connect/destination-charges)
Destination charges are created on the platform, but as part of the charge operation, funds are transferred to the connected account specified in the transfer_data[destination] parameter of the charge.
Thanks so much !
happy to help
One more question if I may. Does Stripe Checkout have a paymentIntent under the hood?
Yes they do
Thank you !
Any time!
Although it seems like my webhook doesnt respod after an test checkout session , whereas it does respond after a stripe trigger
Glancing back through the thread, you're using Connect, right?
Yes
So we have two different types of webhooks, one that listens to events on the platform account and another that listens to events on the connected account(s). Usually for connect scenarios you'll need a combination of the two to catch the events you want.
This doc helps explain this further:
https://stripe.com/docs/connect/webhooks#connect-webhooks
Yes , I also saw this in the answer you gave below , but given that the Checkout has a paymentIntent under the hood , shouldnt it trigger a paymentIntent event ? Because it doesnt have anything to do with connect so far right ?
Do you have an ID of a related object (an event, checkout session, etc) that I can take a closer look at?
sure
1 sec please
After finishing it , it doesnt trigger the event
req_i77QyIdpQTUaCm
Thanks, taking a look
Thank you
Hm, I'm not seeing any webhook endpoints on that account. Do you have the webhook endpoint ID (we_xxx) where you're expecting to see the event?
yes
at /webhook
const webHookStripe = async (req, res) => {
const event=req.body
let paymentIntent
switch (event.type) {
case 'payment_intent.succeeded':
paymentIntent = event.data.object;
console.log(paymentIntent);
console.log("Payment Succeeded")
//DB queries
break;
case 'account.external_account.created':
paymentIntent = event.data.object;
// console.log(paymentIntent);
console.log("External account created")
//DB queries
break;
default:
console.log("Payment was attempted")
}
return res.json({ received: true });
}
That looks like your handler code, but did you actually create a Webhook Endpoint for your Stripe account? Either through the dashboard or this API?
https://stripe.com/docs/api/webhook_endpoints/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Is this also for test mode ?
Because I have used to forward cli command to listed to that webhook
Oohh, apologies, I overlooked that you were forwarding with the CLI.
It looks like a payment_intent.succeeded event was sent to the CLI at 14:02:51 UTC
Maybe it was when I was triggering it from the CLI
but after I successfully complete the checkout my console doesnt log that the payment succedeed
But surprisingly it does log when a connect account is created from the link
Hm, the timestamp seems to correspond perfectly with when that checkout session was updated. Do you have the command you used to initialize the listener?
stripe listen --forward-to localhost:8000/webhook
That looks right, do you not see the events show up at all, or do they appear in the terminal and just not make it to your endpoint?
After a successfull checkout in the terminal I get
checkout.session.completed [evt_1JuxjxA3jSMal6ivMbZkrWxg]
Yet , I in my node console it should log something , which doesnt get logged
but it does get logged with stripe trigger
Hm, could you add a log statement before your switch block to ensure the event is actually making its way into your handler? And could you have that log the event type so we can double check that's coming over correctly?
sorry for that , was away from the keyboard
Yes , it does hit the endpoint
but it never goes to the payment_intent.succeeded succeded case , only default
Hey there just catching up ๐
like Toby asked:
And could you have that log the event type so we can double check that's coming over correctly?
that's type checkout.session.complete
yes
so it doesnt match the type you specify in your code
i would expect the default case to apply
Ah okay , because i had assumed that the payment intent would also be triggered , since itbis used in thecheckout
Thank you so much !
Well, to be clear, if you're listening to all events a successful payment checkout should have a payment intent event, too
but that's a different/separate event than the one you're currently looking at
So it's not payment_intent.succeeded
Additionally I am trying to create a payment for a single supplier (out of many in an order with the payout API) but there is only an example where the payment is just sent to one supplier , is it wrong if I replicate that logic for every supplier in the order ? Something like this :const payout = await stripe.payouts.create({
amount: amount,
currency: 'eur',
}, {
destination: supplierStripeId,
});
You want to read more about Stripe Connect in this case
The destination parameter there is about the external bank account, not a connected Stripe account
YOu'll need to facilitate transfers to supplier accounts you onboard
Yes , I have done that as soon as the order is received , I use the Transfer API to transfer into the connected account's balance
The above was reffering to the actual payment to their bank account using manual payouts (after they were specified on the account). I am not sure if it the correct approach since the docs dont say how to pay out say all 5 suppliers in an order
oh, yes, if you're using manual payouts after eg splitting a payment many ways, you'd need to create many payouts
there's no consolidated call you can make to trigger payouts for multiple connected accounts
Yes , I know ,I am sending the array with the stripeId of the suppliers and the amount and doing this :
const payOut=async(res, req)=>{
const suppliers=req.data.suppliers
try{
const payouts = await Promise.all(suppliers.map(supplier=>{
stripe.payouts.create({
amount: supplier.amount,
currency: 'eur',
}, {
destination: supplierStripeId,
});
}))
res.send({ok : true})
}catch(error){
res.send(error)
}
}
req.body*
Ok and what about this isn't working for you?
I was thinking maybe there is a different syntax for paying connected accounts. This is what I have derived only form the APIhttps://stripe.com/docs/api/payouts/object#payout_object-id
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Are the suppliers here stripe accounts?
You wouldn't do it like that, as i said destination there is about the bank accounts, not stripe accounts
Instead you need to make each request using the stripeAccount header/option
Yes they are stripe accounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
In your code, replace destination with stripeAccount
Well, try it out in test mode!
Your snippet doesnt define supplierStripeId anywhere, so not sure if that needs to change too or is defined elsewhere
Yeah I need to change that . Thanks so much for the help and for your patience !