#Didier-refund

1 messages · Page 1 of 1 (latest)

sterile lodge
#

Good question. Looking in to how to do this...

faint girder
#

thanks

sterile lodge
#

Is this direct charges or destination charges?

faint girder
#

I think destination charges, I'll share you the code

#

$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => $amount,
'currency' => $currency,
'metadata' => [
'cust_id' => $cust_id,
'order_id' => $order_id
],
'application_fee_amount' => $commission,
'transfer_data' => [
'destination' => $vendeur_stripe_account_id
]
]);

#

and for the refund

#

$refund = $stripe->refunds->create([
'payment_intent' => $commande->commandes_paymentintent_id,
'refund_application_fee' => false,
'reverse_transfer' => true
]);

sterile lodge
#

Thanks!

#

Do you have the ID of a refund that you created this way?

faint girder
#

yes : re_3K45byCitftmwxG116uzgVmx

#

I'm in test mode

sterile lodge
#

Perfect, thank you

sterile lodge
#

Hey apologies this took a bit. Still nailing down the exact details of this but closer to an answer

#

Essentially this can't be done in one action, you will want to do a partial refund and then transfer the application fee back to the connected account seperately

#

Working out the exact details still...

faint girder
#

ok thank you, i'll wait for your complete answer and details for a way to do that

surreal thistle
#

@gloomy nimbus taking over

#

@faint girder sorry

#

If you charge a customer 110€ and want to only refund 100€ then you have to control this by passing the right amount on Refund creation really

faint girder
#

you mean I just have to create the refund with the paymentintent ID and the good amount ? what about the other parameters ?

surreal thistle
#

what about them? What's confusing you?

faint girder
#

do I keep the reverse_transfer to true and refund_application_fee to false ?

#

I'll try this and let you know the result

surreal thistle
#

yep you keep both that way and you will pull 100€ back from the connected account

#

if you refund more than you gave them, say 105€ then they will go negative by 5€

faint girder
#

@surreal thistle thank you it seems to work well ! i'm looking for some details in the dashbord to be sure