Jump to content

Paypal Sandbox to test payments


frodosghost

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 6 months later...

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?

Link to comment
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.

  • 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