#nerdslice_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1334647166773493902
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Here is my code for creating the payment intent
$paymentIntent = $stripe->paymentIntents->create(
[
'amount' => $total,
'currency' => strtolower($lane->country).'d',
'payment_method_types' => ['card_present'],
'statement_descriptor' => $team->name,
'capture_method' => 'automatic_async',
'transfer_data' => [
'amount' => $total - str_replace('.', '', number_format(round($total * 0.0003, 2), 2, '.', '')) - 10,
'destination' => $team->connect_id,
],
//get package and determine percent to charge for fee.
//'tax' => $totaltax,
//'application_fee_amount' => 5,
//'processing' => 5
]
);
Thanks for the info, looking in to this
So the issue I have is on the transfer, I need to be able to transfer the appropriate amount to the connect account but when I set up the intent they have not yet chosen a tip.
So can I set up a transfer when I get the payment intent id back via the webhook?
Ah gotcha, sorry I misunderstood. Yes, doing that on payment_intent.succeeded or payment_intent.amount_capturable_updated should work. If you are creating transfers yourself you can just pass the amount to the transfers API
Or transfer the tip amount when I get the confirmation?
And if you are using application_amount or transfer_data.amount you can update those via the payment intent update call.
Thats what I am doing.
Gotcha, in that case I think you would want to use capture_mode: manual
So as you can see when I am setting up the intent I am setting up the transfer, I can move that to the webhook fairly easy
Ah yep right. So yes that is a great way to implement this!
OK so i can still capture automatically just move the transfer to webhook
The funds are transferred automatically when the payment succeeds, so I think you need to use manual capture and update this before your capture call