#nerdslice_api

1 messages ¡ Page 1 of 1 (latest)

vague helmBOT
#

👋 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.

viral lava
#

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
]
);

distant maple
#

Thanks for the info, looking in to this

viral lava
#

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?

distant maple
#

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

viral lava
#

Or transfer the tip amount when I get the confirmation?

distant maple
#

And if you are using application_amount or transfer_data.amount you can update those via the payment intent update call.

viral lava
#

Thats what I am doing.

distant maple
#

Gotcha, in that case I think you would want to use capture_mode: manual

viral lava
#

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

distant maple
#

Ah yep right. So yes that is a great way to implement this!

viral lava
#

OK so i can still capture automatically just move the transfer to webhook

distant maple
#

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