Monday, 15 May 2017

Paypal HTML form works in sandbox, but getting 'Access Denied' on live - Paypal Payments

I have been building an application in NodeJS/ExpressJS which allows users to make purchases. The purchases are handled with an HTML form, which gets posted to a URL on my site, which in turn gets redirected to Paypal. I cannot post directly to Paypal because I need to process some of the data first.

After the payment is processed, Paypal makes a POST request to my IPN handler.

During development, I was pointing to Paypal's Sandbox URL, which was working fine. However, now I want to use the live URL. Whenever the form is submitted and the request is redirected to Paypal, I am getting 'Access Denied - You don't have permission to access "http://www.paypal.com/cgi-bin/webscr?" on this server.'

The only thing that I have changed in moving from Sandbox to Live is the URL.

The form:

<form id="purchaseForm" method="POST">
...    
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="">
<input type="hidden" name="item_name" value="Purchase from ">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="return" value="/../../success">
<input type="hidden" name="cancel_return" value="/../../failure">
<input type="hidden" name="notify_url" value="/../../IPNhandler">
<input type="hidden" name="amount" id="ppAmount" value="1">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
...
<input type="submit" class="btn" value="Submit"/>

The request handler:

...
res.redirect(307, 'https://www.paypal.com/cgi-bin/webscr?custom=' + newPurchase.id);



via Elliot

No comments:

Post a Comment