News:

Support the VirtueMart project and become a member

Main Menu

Automatic refund to buyer from PayPal ?

Started by Mister Paul, October 25, 2020, 05:19:44 AM

Previous topic - Next topic

Mister Paul

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

AH

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.
Regards
A

Joomla 3.10.11
php 8.0

Mister Paul

#2
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?

pinochico

#3
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.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Mister Paul

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?

pinochico

#5
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)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Mister Paul

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

AH

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
Regards
A

Joomla 3.10.11
php 8.0

Mister Paul

#8
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"?

AH

In the latest version there is now a config to stop VM requesting a  PayPal refund
Regards
A

Joomla 3.10.11
php 8.0

Mister Paul


AH

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
Regards
A

Joomla 3.10.11
php 8.0

Mister Paul

Quoteand let an PayPal IPN message set the VM order status
You use the "Notes and special requests" field for that?

AH

#13
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
Regards
A

Joomla 3.10.11
php 8.0

Mister Paul

#14
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?