Question

I have been trying to setup a test for payment on our site.

But I keep getting an error, everything works on the website but when they click buy you then go off to paypal sandbox which is then giving a error called:

Sorry, an error occurred after you clicked the last link

Instead of giving the payment page and overview.

If set to live mode it works 100% but it does not work while in sandbox.

Here is the code I am using to submit the form.

$paypalurl = 'paypal.com/cgi-bin/webscr';
$paypal_testurl ='sandbox.paypal.com/cgi-bin/webscr';
$paypalipn = $siteurl . 'Applications/Controllers/Memberships/paypal_ipn.php';

$paypal_form = '<form action="https://www.'.$paypal_testurl.'" method="post">';
$paypal_form .= '<input type="hidden" name="cmd" value="_cart">';
$paypal_form .= '<input type="hidden" name="upload" value="1">';
$paypal_form .= '<input type="hidden" name="business" value="'.$paypalEmail.'">';
$paypal_form .= '<input type="hidden" name="item_name_1" value="'.$name.'">';
$paypal_form .= '<input type="hidden" name="amount_1" value="'.$price.'">';
$paypal_form .= '<input type="hidden" name="quantity_1" value="1">';
$paypal_form .= '<input type="hidden" name="notify_url" value="http://'.$paypalipn.'">';
$paypal_form .= '<input type="hidden" name="return" value="'.$siteurl.'membership-thankyou/">';
$paypal_form .= '<input type="hidden" name="rm" value="2">';
$paypal_form .= '<input type="hidden" name="cbt" value="Return To Store">';
$paypal_form .= '<input type="hidden" name="cancel_return" value="'.$siteurl.'membership-cancelpurchase/">';
$paypal_form .= '<input type="hidden" name="lc" value="GB">';
$paypal_form .= '<input type="hidden" name="currency_code" value="GBP">';
$paypal_form .= '<input type="hidden" name="custom" value="'.$_GET['userid'].'">';
$paypal_form .= '<p><a href="#" class="btn btn-lg btn-grey">Edit</a> <input type="submit" value="Proceed" class="btn btn-lg btn-success"></p>';
$paypal_form .= '</form>';

Thanks in advance for any help received

Was it helpful?

Solution

The only way I am able to recreate this error with your code is by supplying an email address that is not attached to a sandbox account.

Try it with a valid sandbox email address: $paypalEmail = 'hbsawnhdglv@paypal.com';

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top