Paypal sandbox returning 500 error - paypal

I'm using Paypal Sandbox to test my site. Few days ago it was ok and coming to the final stages of testing and all of a sudden i get a 500 error returned. The issue started yesterday so thought it would be resolved by today but i dont know if something has changed which I'm not aware of or how i could check the status and when the service would resume?
I get the following returned
HTTP/1.1 500 Internal Server Error
Date: Sat, 24 Jun 2017 08:37:50 GMT
Server: Apache
Paypal-Debug-Id: d48964f5c065
Vary: Accept-Encoding
Strict-Transport-Security: max-age=14400
X-Cnection: close
Content-Type: text/plain
Content-Length: 1
Can anyone advise how to go from here? I tried checking for a status page but non that i saw mentioned any maintenance work. If i've changed something i would have assumed a different error status but considering its 500 it leads me to believe its something to do with PP Sandbox?

as pperejon says, it is an issue at PayPal's end, if you take some of PayPal's sample code and copy it into a file called 'index.html':
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="PayPalMerchant#example.com">
<input type="hidden" name="item_name" value="Widget">
<input type="hidden" name="amount" value="10.00">
<input type="hidden" name="currency_code" value="USD">
<input type="submit" value="Buy Now">
</form>
Then open it in your web-browser and click the "Buy Now" button, it will connect to PayPal as normal; however, change paypal to paypal sandbox and instead you will get the following warning:
"This site is not secure"
"This might mean that someone’s trying to fool you or steal any info
you send to the server. You should close this site immediately."
Clicking the "More information" button just below the error gives a little more detail:
"Error Code: DLG_FLAGS_SEC_CERT_CN_INVALID"
If you ignore the SSL certificate warning and still attempt to open the sandbox page you will then encounter the Server 500 error.
I do not know if there are two issues here (the Certificate and 500 error) or if one is causing the other, but either way it is PayPal to fix. It's Monday, so I am hoping that sometime in the next 48 hours it will get fixed as there will be plenty of people being affected by it.

Related

Can I test my IPN listener VB.NET code under localhost (ASP.NET Web Forms)?

The 'Local development testing' section of PayPal's IPN Testing page implies that it is possible to test your IPN listener code via localhost, using a test page to simulate a message from PayPal.
My TestIPN.aspx page contains the following markup, which appears to follow the example provided by PayPal, but when I open it in Firefox under localhost (via Visual Studio 2019) and click the Submit Query button I get a 'File not found' error for https://localhost:44390/PayPal/IPNHandler.aspx.vb.
Needless to say, IPNHandler.aspx.vb does exist in my PayPal folder (using "PayPal/IPNHandler.aspx" in the form tag on my test page makes no difference). I also get the same error when I run it on my live site.
Any guidance on how to debug this problem would be much appreciated.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test IPN message</title>
</head>
<body>
<!--
<form target="_new" method="post" action="https://www.YourDomain.com/Path/YourIPNHandler.php">
-->
<form target="_new" method="post" action="PayPal/IPNHandler.aspx.vb">
<input type="hidden" name="receiver_email" value="admin%40mysite.co.uk"/>
<input type="hidden" name="business" value="admin%40mysite.co.uk"/>
<input type="hidden" name="first_name" value="Fred"/>
<input type="hidden" name="last_name" value="Bloggs"/>
<input type="hidden" name="payer_email" value="fred.bloggs%40gmail.com"/>
<input type="hidden" name="address_city" value="Southampton"/>
<input type="hidden" name="payment_type" value="instant"/>
<input type="hidden" name="payment_date" value="19:54:19 Apr 12, 2021 GMT"/>
<input type="hidden" name="payment_status" value="Completed"/>
<input type="hidden" name="mc_currency" value="GBP"/>
<input type="hidden" name="mc_gross" value="5.00"/>
<input type="hidden" name="custom" value="25"/>
<input type="submit"/>
</form>
</body>
</html>
I get a 'File not found' error for https://localhost:44390/PayPal/IPNHandler.aspx.vb
Is that the correct port? What happens if you put https://localhost:44390/PayPal/IPNHandler.aspx.vb in the URL bar? Use a URL that works to the handler on your localhost, which does not return a 404. Set the action accordingly.
Consider something like https://ngrok.com for testing as well.
Why are you integrating IPN anyway? It's 20 or so years old, and not required for current PayPal Checkout integrations you should be using instead...
Follow the Set up standard payments guide and make 2 routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. Both routes should return only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.
Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

Why Am I Getting Paypal generic error page in production but not in sandbox

Have been successfully using PayPal Cart buttons in PayPal Express for 2 years. Suddenly, when I click any "Cart button on my Store page, I get the dreaded ""Things don't appear to be working at the moment. Please try again later."
I tried the exact same transaction in the PayPal Sandbox and it processed fine. Now, however, that transaction draws the generic error page in "Live PayPal"
The only differences in the are in the action url, the business email, and the return url and store url:
Sandbox version of action attrbute:
<form id="form107" onsubmit="return CheckForm(this);"
action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_self">`
Live Version of action attribute:
<form id="form107" onsubmit="return CheckForm(this);"
action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_self">
(the javascript "CheckForm" function just checks data on the page to determine whether to show or hide a size dropdown)
The Sandbox integration URLs:
<input name="return" type="hidden" value="http://localhost:52980/Open/Congratulations/107/store">
<input name="shopping_url" type="hidden" value="http://localhost:52980/Store">
The "Live" integration URLS:
<input name="return" type="hidden" value="http://www.(mydomain).org/Open/Congratulations/107/store">
<input name="shopping_url" type="hidden" value="http://www.(mydomain).org/Store">
The code has worked up through 16 April 2018. No changes were made. As of 18 April 2018, we are now getting the PayPal generic error page upon clicking the Cart button

Paypal sandbox: this transaction is invalid

I am trying to integrate paypal express checkout(test) with no luck. Not sure what i am doing wrong. I have followed the documentation but i get "This transaction is invalid. Please return to the recipient's website to complete your transaction using their regular checkout flow." when i try to redirect to the browser to the sandbox login page.
<form method=post action=https://api-3t.sandbox.paypal.com/nvp>
<input type=hidden name=USER value=j***-1_api1.g*******s.com.au>
<input type=hidden name=PWD value=Q8P*******U6>
<input type=hidden name=SIGNATURE value=AFc************fH>
<input type=hidden name=VERSION value=124.0>
<input type=hidden name=PAYMENTREQUEST_0_PAYMENTACTION
value=Sale>
<input name=PAYMENTREQUEST_0_AMT value=19.95>
<input type=hidden name=RETURNURL
value=http://localhost/moes/paypal_complete.php>
<input type=hidden name=CANCELURL
value=http://localhost/moes/paypal_complete.php>
<input type=submit name=METHOD id="submit_paypal" value=SetExpressCheckout>
</form>
have also tried this on my site live in case localhost is causing the troubles, but still the same.
The ACK response i get back is success:
TOKEN=EC-83V63085L7957480A
TIMESTAMP=20150901T14:14:08Z
CORRELATIONID=ffb632c840981
ACK=Success
VERSION=124.0
BUILD=000000
But when i use the redirectURL in the documentation with the token i get the invalid transcation error.
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&TOKEN=EC-83V63085L7957480A
I am logged into developer.paypal.com when i try it, still every time is an invalid transaction.
the URL of the invalid transaction:
//http://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_flow&SESSION=xa6gvld5X3qDZhYbt7pnz6rWMCzBdIFvAREoxohX4E5zH_3ydrzEQBnpQFW&dispatch=50a222a57771920b6a3d7b606239e4d529b525e0b7e69bf0224adecfb0124e9b61f737ba21b0819803370655d2811b9456e01fe893c80ec2
ideas?
You can get sample Express Checkout Code from the PayPal Wizard:
PayPal Express Checkout Code Wizard
<form action='expresscheckout.php' METHOD='POST'>
<input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal'/>
</form>
You will need to download the expresscheckout.php and the paypalfunctions.php files from the PayPal Code Wizard. Typically your PayPal API Signature goes in a separate php file. The paypalfunctions.php on the code wizard has the API credentials stored.
The below snippet is from the paypal.php file and it is the portion of the code for the sandbox endpoints.
if ($SandboxFlag == true)
{
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
$PAYPAL_URL = "https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=";
}
Also with Express Checkout you need to call Mark Express Checkout which is normally done in one of your PHP files.
You can get the complete php code from the code wizard.
Here is more documentation on Express Checkout from the PayPal Developer Site.
For anyone else reading this, i found that if i changed the redirectURL from:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&TOKEN=
to:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=
It redirects to the paypal(sandbox) log-in page as intended without error.
Hope this helps

Change Failed Payment Attempts in Paypal Standard Subsribe Button

A client requested that I set the Subsribe button to have reattempts at failed payments quite specifically. The account used is a Paypal Standard (not paypal pro) and from my research there's only the SRA variable that only toggles the pre-set 3-attempts in 5 days setting by Paypal, which is giving up on a subsriber too easily from my client's perspective. He'd want a total of 30 billing re-attempts, done every 3 days for the next 90 days.
I have only found other people wondering the same thing, but haven't found a solution. My current code on the page is this:
<form id='frmPayPalYearly' action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxxxxxxx">
<input type="hidden" name="custom" value="Standard Annual Member with id:<?php echo $user_id;?>">
<input type="hidden" name="invoice" value="03/2013/<?php echo $user_id;?>/12/<?php echo uniqid()?>">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_SM.gif" width="0" height="1">
</form>
If I add the SRA like so:
<input type="hidden" name="sra" value="1">
Correct me if I'm wrong, but this will tell Paypal to reattempt 3 times. Any way I can make Paypal reattempt 30 times?
Anyone has any ideas?
Unfortunately, there isn't much you can do.
The API products actually provide parameters to specify this sort of thing, but they're ignored. It's a known issue that I've been hoping to see fixed for years now. I'm not holding my breath. Everything falls to the default of 3 attempts 5 days apart and then suspends.
If you were using the API's then you could at least automate the process of re-activating the plugin when it becomes suspended on that 3rd attempt so that it falls right back into a fresh 3-attempt cycle, and just keep doing that as many times as you want your application to allow.
With Payments Standard, though, there isn't an API that will let you do this. You would need to switch to Express Checkout API's in order to do that, and then you would handle the auto-re-activate within an IPN solution.

PayPal Buy Now button on my site with redirection issue

I must be going crazy, or I'm completely lost when it comes to understanding what is doable when it comes to PayPal buttons on my site - either way I must apologise if this seems obtuse.
I'm building a custom CMS for my clients, and I'm trying to let them utilize PayPal on their sites by simply entering in either their merchant ID, or their PayPal e-mail address, and then let CMS will do the rest. Ideally:
Client enters merchant ID / PayPal e-mail address into CMS backend
CMS generates "Buy Now" button for client's buyers to click on
Buyer pays on PayPal's site
Buyer gets redirected to client's site
My headache disappears
This seems to be easier said than done. I've read the developer documentation on generating your own buttons, and used that Javascript-based button generator to create a button with an IPN callback, but that's not going to redirect the buyers back to my clients' websites.
Thus my questions: is it at all possible to achieve what I'm looking to do with just my clients' merchant ID's? Is it possible to do it without them having to configure anything additional in their PayPal account settings to avoid set-up issues? Should I be looking at a different PayPal processing mechanism instead of the "Buy Now" button?
I should probably mention that I have a free PayPal account, not a Premium or Business account, but that should be irrelevant to this situation as it's not me that's trying to get paid.
Thanks in advance, and any help is GREATLY appreciated!
create a hidden field named 'return' in your form and put your return URL as the 'value'
A thank you to Billy for his answer, and while researching this topic some more, I've discovered that what I'm looking to do CANNOT be done with the current payment standards buttons on a standard free PayPal account. You can't achieve automatic redirection back to your site from PayPal with the Buy Now button.
As Billy mentioned, you can add return URLs that will give the user the option to click on a link that will return them to your site afterwards (PayPal will add these links to their side of operations themselves). To do this you would need to add the appropriate hidden fields to your PayPal form.
This worked for me:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="button" value="buynow">
<input type="hidden" name="item_name" value="Item 1">
<input type="hidden" name="amount" value="1234.56">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="env" value="www">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="return" value="http://www.site.com/success">
<input type="hidden" name="cancel_return" value="http://www.site.com/error">
<input type="hidden" name="business" value="your#email.com">
</form>
I hope this helps someone avoid headache and unnecessary documentation scouring!