Jump to content
Davor

Payment Gateway - Refunds

Recommended Posts

Hello,

I'm creating for myself the Payment Gateway for Paddle and now I have some doubts how to proceed with refunds because refunds with Paddle are not automatic, but they need to be approved by Paddle team.

So, now, when I make a refund in WHMCS, in the Payment Gateway code in the "paddle_refund" I send this request to the Paddle API and I don't get success or denied response immediately, but I need to return true or false from this function. And if I return false in the WHMCS portal it is displayed the error message that is something wrong, but if I return true the refund gets accepted in WHMCS, but the refund is not yet processed by Paddle. What is the best practice in this case? Or can I return some status like "Processing" in the function "paddle_refund" in the Payment Gateway code?

Then in the WHMCS hook I'm waiting for the response from Paddle. This is not the problem, but what to do, what to return in "paddle_refund" function?

 

Thanks,

Davor

Share this post


Link to post
Share on other sites

Don't think there is a logic for pending and no hook to intercept it seems .   I think doing your own refund logic might be needed here.  A new refund tab or like "pre-refund" button on the refund tab that kicks off the first stage .  Then the whmcs refund checks the API for refund status and completes if successful .  That is presuming their API supports checking refund status.   You basically need to visit the refund tab twice in this case, once to kick off the process and once to complete whmcs side.   I am actually not sure there is an WHMCS API that can do refunds.  UpdateInvoice with status of refunded might work but not sure. 

Share this post


Link to post
Share on other sites

Thanks @steven99 for interesting view of possible workaround and for taking the time.

I need to think about it and test it heavily. 

Davor

Share this post


Link to post
Share on other sites

I would return false in the refund function and change the error message to its own text via javascript using the AdminAreaFooterOutput hook, maybe even change the CSS class so that the notice doesn't appear in red. 

After you received the callback from Paddle, you process the refund properly. It would also be useful to notify the staff about the output of the refund, for this you can either create a ticket or use the WHMCS notification system.

In order to continue to use the normal refund function from WHMCS, I would add a second argument to the function, such as:

function paddle_refund ($params, $fromCallback = null) {
    if ($fromCallback) {
      ....
      return [ 'status' => 'success' ];
    } else {
      ....
      return [ 'status' => 'error' ];
    }
}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By denully
      Hello
      I have been searching from A to Z on the world wide web machine 😛 and only found a paymentgateway for Klarna.com/Sofort which turns out to be an aquired company of Klarna in UK, so their module does not work for normal Klarna.com clients.
      So i am wondering if anyone out there have made a paymentgateway module for Klarna.com (klarna.com/se)  that they would be interrested in sharing, selling a copy of, or is selling licenses to? 
      I know i could be looking for someone to build me one, but unfortunately, even as an online business, i have been hit with the drop in income thanks to Covid and all programmers i have come by has been way over my budget, for a paymentgateway module.

      ps. Klarna.com does not know of a module themselves. 
    • By Mas-J
      Condition:
      I've create copy of banktransfer and rename it as localbank.
      My goal: I want to show some dynamic Virtual Account number (combination of fixed bank code + custom field) when payment method localbank is selected and client preview invoice then choose it (viewinvoice.tpl)
      I've try with several variable but there's no suitable value to match the selected payment method using if-else condition.
      Could you tell me what the correct variable for selected payment method ?
      Here's my custom script on viewinvoice.tpl
      {if $paymentmethod == "localbank"}      <td>: 123123{$clientsdetails["customfields2"]}</td> {else}      <td>: 77777{$clientsdetails["customfields2"]}</td> {/if} With that code, when localbank is selected the result always show the else result.
      Although when I change the $paymentmenthod value to banktransfer, it still show the else result.
    • By ModulesGarden
      1. Today we have the immense pleasure of announcing that we added yet another link to our social network and that is Instagram! Would you like to learn more about the people standing behind the software you are using on a daily basis and peek into the intriguing details of their work that are unavailable on the official ModulesGarden website? 
      Follow us on Instagram!
       
      2. Another piece of great news today is that our Payment Gateway Charges For WHMCS module was just upgraded to the 2.1.0 version!
      If you are wondering what this new update entails, we are rushing to give you a snapshot of the newly introduced capabilities: 

      Billing clients before or after a promo code has been applied Possibility to toggle charges for "Adding Funds To Credit Deposit", "Late Fee Invoice Items", and "Custom Invoice Items" A wide assortment of tweaks


      Bring your module a step closer to perfection with this vital new update, and deliver customer experience at the high-class level. Learn all about Payment Gateway Charges For WHMCS 2.1.0!
       
      3. Halloween is probably this part of the year when our clients can scoop up the most mind-blowing discounts ever. 
      Starting from 25%, through 50%, to even 75% off whichever WHMCS module you set your eyes on – and all that with absolutely minimal effort! 
      Head over to our Blog right away and get inspired by all the participants who already made their contribution towards our chilling Halloween Contest. We are waiting for you until next week when we will be announcing the winners and handing in the well-deserved prizes! 
      Heat up your fall with our stimulating Halloween Promotion!
       
      Need Custom Software Development For Your Business?

      Get Your Free Quote Now!


      Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated