VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: Mister Paul on October 25, 2020, 05:19:44 AM

Title: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on October 25, 2020, 05:19:44 AM
Hi,

For the first time I'll have to make refunds. The payment method is PayPal.
And I am wondering if the refund is automatic. Or what is the good process to manage refund from PayPal.

I tried with sandbox and it seems that no refund was made...

What I did:
- In the Order backend  page, I modified the Order status of a previously Confirmed order (made with PayPal Sandbox):
I set the status to Refunded and selected the Notify shopper option.
- Yes the shopper was notified by email from Virtuemart
- But nothing was received from PayPal (no email, no confirmation) by the Shopper, nor by the Seller (for what I saw)

I suppose that my setings are OK on the PayPal configuration page: I have the Refunded status selected for the Refunded transactions and the Partial Refunded transactions (cf screenshot)

Please, could you help me on this?

Thanks for your patience!
;-)

Paul
Title: Re: Automatic refund to buyer from PayPal ?
Post by: AH on October 25, 2020, 09:21:49 AM
From my understanding

If you set an order to refund status in VM it will generate a FULL refund of the PayPal transaction. 

There is no method for giving a partial refund using this method.

As a personal preference for a workflow I therefore generate all refunds using my PayPal Console.
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on October 25, 2020, 10:52:18 AM
Thank you very much for your answer.

Just to fully understand your workflow:
• after the refund (full or partial) made from the PayPal Console, do you modify the Order status to get the historic in Virtuemart?
• in Virtuemart PayPal configuration, your setting should be different from mine to avoid the PayPal automatic refund, right?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: pinochico on October 25, 2020, 10:59:31 AM
QuoteAnd I am wondering if the refund is automatic.

I think no.
On our payment plugin, which is developed from the Paypal payment plugin, is not automatic too and we must create self.

But!

All of admins or the owners' shops don't want this function, after we are developing and we must add checkbox in setting - refund automatic (Yes/No), because as written AH - personal preferences is No.
Then my recommended is the same - you don't need this function.
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on October 25, 2020, 12:05:28 PM
Thank you too !

So in Virtuemart PayPal configuration, your settings are different from mine to get a correct order status but to avoid the PayPal automatic refund, right?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: pinochico on October 25, 2020, 12:09:50 PM
No,
in the payment method settings we use your settings, but in the plugin settings we have a checkbox with which we can set whether an automatic refund will take place without the administrator's knowledge or not.

But as I said, it's a custom development and the plugin is customized like this from us. (Beware, this is not a Paypal plugin - we do not use it, but the Gopay payment method we use)
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on October 25, 2020, 13:25:39 PM
OK...

So if I want to avoid the automatic refund from PayPal but get the good status in the Virtuemart Orders page, do I have to  the set the PayPal payment configuration like that:
Refunded transactions -> Confirmed
Partial Refunded transactions -> Confirmed
Title: Re: Automatic refund to buyer from PayPal ?
Post by: AH on October 25, 2020, 20:42:49 PM
I did develop the code for the core VM paypal plugin to prevent automatic refunds based on an order status update

Unfortunately it has never made it to the core:

I can try again


No dont set them to confirmed!!


If you want to hard code for now - to prevent vm initiating a refund  (you can test this code of course before moving to live)


in plugins paypal / paypal.php 

comment out the code in function plgVmOnUpdateOrderPayment where it tries to handle the refund status




//dont inititate a paypal refund based on VM order status
// elseif ($order->order_status == $this->_currentMethod->status_refunded /*OR $order->order_status == $this->_currentMethod->status_canceled*/) {
// $paypalInterface = $this->_loadPayPalInterface();
// $paypalInterface->setOrder($order);
// $paypalInterface->setTotal($order->order_total);
// $paypalInterface->loadCustomerData();
// if ($paypalInterface->RefundTransaction($payment)) {
// if ($this->_currentMethod->payment_type == '_xclick-subscriptions') {
// $paypalInterface->debugLog(vmText::_('VMPAYMENT_PAYPAL_SUBSCRIPTION_CANCELLED'), 'plgVmOnUpdateOrderPayment Refund', 'message', true);
// } else {
// //Mark the order as refunded
// // $order->order_status = $method->status_refunded;
// $paypalInterface->debugLog(vmText::_('VMPAYMENT_PAYPAL_API_TRANSACTION_REFUNDED'), 'plgVmOnUpdateOrderPayment Refund', 'message', true);
// }
// $this->_storePaypalInternalData( $paypalInterface->getResponse(false), $order->virtuemart_order_id, $payment->virtuemart_paymentmethod_id, $order->order_number);
// }
// }

return true;
}






Ask the team to do a very straightforward configuration inclusion

Config:

Refund PayPal transactions when the refund status is set in VM:

VMpaypalRefunds

Default = Yes
Option = Y/N
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on December 02, 2020, 17:58:47 PM
Oh YES, because for now all automatic refunds are full refunds,
I ask the team to do your very straightforward configuration inclusion to prevent automatic refunds based on an order status update.

Where is the wishlist?

EDIT:
no way to affect only "Partial refunded transactions"?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: AH on December 02, 2020, 18:48:14 PM
In the latest version there is now a config to stop VM requesting a  PayPal refund
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on December 02, 2020, 18:59:30 PM
Good news AH !
:)
Title: Re: Automatic refund to buyer from PayPal ?
Post by: AH on December 03, 2020, 09:29:34 AM
Yes - it gives shop owners a choice on how they want VM to act on setting the refund status

I have always issued refunds via the PayPal website and let an PayPal IPN message set the VM order status
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on December 03, 2020, 10:16:34 AM
Quoteand let an PayPal IPN message set the VM order status
You use the "Notes and special requests" field for that?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: AH on December 03, 2020, 12:12:54 PM
Are you sure you have posted in the correct thread

I was referring to setting a refund using PAYPAL's systems and a subsequent IPN message changing the order status

Notes is irrelevant and is not part of IPN handling
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on December 03, 2020, 13:21:39 PM
Well... so I don't fully undertsand the second part of your phrase:
QuoteI have always issued refunds via the PayPal website and let an PayPal IPN message set the VM order status
I thought that you were pasting the PayPal references (given by PayPal's system console after refund) somewhere in the relevant VM order to keep historic updated...
Am I wrong?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: GJC Web Design on December 03, 2020, 16:07:09 PM
Quoteand let an PayPal IPN message set the VM order status

when he refunds in Paypal it will send an IPN to the site setting the order to refunded?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on December 03, 2020, 16:36:01 PM
Quotewhen he refunds in Paypal it will send an IPN to the site setting the order to refunded?
• Even for partial refunds?

Sorry for these naive questions but I have never made any refund (PayPal or other). It's not me that does refunds:
my role is webmaster, not shop owner...

• And I am not sure that the refund were made until now through PayPal console. I think that they do it through bank note or bank transfer.
I know that's not a good practice, but in these cases, how could we get historic in VM?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: GJC Web Design on December 03, 2020, 16:48:28 PM
if its done outside of Paypal then just set them manually in VM
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on December 03, 2020, 17:06:25 PM
OK But where do you note the relevant infos about the refund (bank check number and so on...)?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: GJC Web Design on December 03, 2020, 19:03:05 PM
No idea .. I don't do refunds... in the order note?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: AH on December 04, 2020, 10:24:15 AM
Quotewhen he refunds in Paypal it will send an IPN to the site setting the order to refunded?"

Yes that is what happens - if the order came from PayPal.

At present VM does not differentiate between a full refund and a partial refund PayPal refund - both set the same VM status as configured in the VM PayPal Refund setting.

QuoteI know that's not a good practice, but in these cases, how could we get historic in VM?

It is not and you should not do it that way as you subject yourselves to potential fraud.

Look to change your business practices for payments made via PayPal - refund via PayPal console.
Title: Re: Automatic refund to buyer from PayPal ?
Post by: Mister Paul on December 04, 2020, 10:37:26 AM
Yes...
Thanks AH
Title: Re: Automatic refund to buyer from PayPal ?
Post by: cristina on December 14, 2021, 15:29:26 PM
Hi,
I hope to post in the right 3D,
today I made a partial refund using my PayPal console.
After I sent the partial refund, the paypal plugin sent a full refund.
I wondre what happened and I would like to know if that's correct.
Thank for help
Title: Re: Automatic refund to buyer from PayPal ?
Post by: GJC Web Design on December 14, 2021, 16:26:35 PM
QuoteVM 2.0.6 - Joomla! 2.5.4 - php 5.3.6
- Really!!!!
Title: Re: Automatic refund to buyer from PayPal ?
Post by: cristina on December 16, 2021, 12:52:20 PM
Sorry,
I updated my profile.
I'm using Joomla 3.10.4 - VM 3.8.8 and PHP 7.4
Title: Re: Automatic refund to buyer from PayPal ?
Post by: GJC Web Design on December 16, 2021, 15:08:41 PM
QuoteAfter I sent the partial refund, the paypal plugin sent a full refund.

how could the paypal VM plugin "send" this?

So u partially refunded in the Paypal admin and then VM was notified of this and then it sent a full refund notice back to Paypal which then refunded all of it? Is this what you are saying?
Title: Re: Automatic refund to buyer from PayPal ?
Post by: cristina on December 22, 2021, 10:37:42 AM
I finally solved the issue. It was a PayPal problem.
They set the money back after I called the support.
I wish everybody a Merry Christmas.