#Hamza-Reverse-Transfer

1 messages ยท Page 1 of 1 (latest)

upbeat tartan
dusty bramble
#

req_ljlPFi4oX2QTlX

upbeat tartan
#

Thanks for the ID, you've specified an amount when creating this refund, that's why it's a partial refund

dusty bramble
#

i want a partial refund with any transfer which was created "reversed completely" but right now it is only reversing partial amount

#

i don't have issue with refund amount rather the transfer reversal amount which should be reversed completely.

#

Here's my code:

$response = $stripe->refunds->create([
'payment_intent' => $invoice2[0]->auth_code,
'amount' => $invoice[0]->total * 100,
'reverse_transfer' => true
]);

upbeat tartan
#

What do you mean by reversed completely ?

dusty bramble
#

the amount which was transferred to the connected account should be reversed completely.

upbeat tartan
#

Let's say you made a charge of 100. Now you are going to refund 50, and you expect a reversed transfer of 100?

dusty bramble
#

No, A charge of 100 was created with let's say 50 was transferred to the connected account using transfer_data->destination. Now i want to refund the customer 60 and i expect the 50 which was transferred to the connected account back completely.

upbeat tartan
#

So you are doing a separate charge and transfer, am I right?

dusty bramble
#

No, Transfer is being created with the checkout session.

upbeat tartan
#

OK, so you are using destination charge, and collecting a fee via transfer_data[amount]. If you want to do a full refund+reversed transfer, you should just set reverse_transfer to true and don't specify an amount when creating a refund

#

If the refund results in the entire charge being refunded, the entire transfer is reversed. Otherwise, a proportional amount of the transfer is reversed.
dusty bramble
#

but i don't want to refund the full amount

#

is there a way to refund partial amount but reverse_transfer the full amount

upbeat tartan
#

No, there's no way.

dusty bramble
#

so i'll have to make 2 requests.

  1. create a manual transfer reversal.
  2. refund the amount from the parent account
upbeat tartan
#

But you still need a transfer object in order to create a transfer reversal.

#

Hmm, it might work. You can try to the transfer object created from the destination charge to create a reverse transfer.

dusty bramble
#

i can get the transfer id from charge id which i can get from payment Intent (which i am saving in my database) then create a transfer reversal using the transfer id.

#

its a bit long process but it will work

#

I was hoping there would be a much simpler process but i don't think it's possible by any other way

upbeat tartan
#

This is a unique flow and I haven't tried it myself. So I'll suggest you to try it out in test mode and see if the resulting behaviour is what you want.

dusty bramble
#

I've managed to make it work. thank you for your help ๐Ÿ™‚

upbeat tartan
#

Great! I hope I can help more, you figure out most of it by yourself ๐Ÿ™‚