frodosghost Posted October 2, 2009 Share Posted October 2, 2009 Howdy Guys, Is there a way to we can test payments to WHMCS through PayPal's sandbox? I have tried so far, and set up the account in the WHMCS through the backend - but we cannot complete the payment. I think I am hitting the wall because the API is querying the Live PayPal server instead of the sandbox.paypal.com... I can't see a way to change that. How do you guys go about testing paypal payments in WHMCS? Cheers jim 0 Quote Link to comment Share on other sites More sharing options...
HerrZ Posted October 2, 2009 Share Posted October 2, 2009 my hack is a little bit dirty but i dont know a better way. Solution PayPal Sandbox: in your viewinvoice.tpl {include_php file='_invoicehacks.php'} oder {php}###{/php} the following. $sandbox=TRUE; // maybe define $pb=$this->get_template_vars('paymentbutton'); $pattern[0]='%action\=\"https\:\/\/www.paypal.com%'; if($sandbox==TRUE) { $replace[0]='action="https://www.sandbox.paypal.com'; // SANDBOX } $mypb = preg_replace($pattern, $replace, $pb); $this->assign('mypaymentbutton', $mypb); now use {$mypaymentbutton} instead of {$paymentbutton} in template. 0 Quote Link to comment Share on other sites More sharing options...
frodosghost Posted October 2, 2009 Author Share Posted October 2, 2009 Wow, nice hack. Thanks HerrZ, I would never have thought of that one... 0 Quote Link to comment Share on other sites More sharing options...
sems Posted April 5, 2010 Share Posted April 5, 2010 The hack partially works for me. I login to developer.paypal.com, to make the sandbox.paypal.com work, then go to the invoice and pay it. It goes through sandbox.paypal.com and payment is done. The IPN is generated and sent to server. However, the invoice is never paid, still stays in unpaid. I checked the payment gateway logs and it shows invalid as a result of the IPN. My guess is paypal.php that handles the IPN is checking the paypal.com, not sandbox.paypal.com, thus failing. Has any of you succeeded with IPNs and invoices getting updated while using sandbox mode? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.