PayPal Pro doesn't seem to work when the total price is $200 but it works with other amounts

TheOutlier
Contributor
Contributor

I'm using PayPal Pro on OpenCart 2.3.0.2.  For some strange reason, when the cart total (the total amount to be passed to PayPal) is exactly $200, then it doesn't get past the page asking for credit card details (it'll wait a few minutes, then give an "Internal Error" popup).  Most other amounts work fine.  I tested with a $300 total and it was fine.  When I tested with a $100 total, it worked most of the time but every now and then it gave the same "Internal Error" popup.  The simplest solution is not to make final prices equal to $100 or $200.  I'm currently changing prices to $99 or $199 instead.  But I would still like to know what the cause of this is, if it's OpenCart related or PayPal related, or if it can happen again with a different value than $200. 

 

I'm tending to think it's PayPal related because a few weeks ago I was able to do a test checkout with a $200 total.  I haven't changed any OpenCart files related to PayPal and this appears to have started recently.  By the way, there's no problem with any amount with PayPal Standard.  It's the $200 total with PayPal Pro (and sometimes $100) that is the issue.  Does anyone have any idea what could be causing this?

Login to Me Too
13 REPLIES 13

angelleye
Advisor
Advisor

This is the code that generates the request.  What I'm curious to look at is the ending result of the $request variable after this code runs.  

 

What I can see from this is that you're using a very old version, 51.0.  The current version is 204.0.  The updated version may accept various values better than the old version.  

 

For the amount you're setting it with:

 

$request .= '&AMT=' . $this->currency->format($order_info['total'], $order_info['currency_code'], false, false);

 

So then we'd need to get a look at your currency->format() method to see if it's always forcing 2 decimals or not.  So again, it would be best to get a look at the raw $request value for when it failed.

 

It very well could be a lot of digging around for nothing, though.  The sandbox just acts weird sometimes, unfortunately.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

TheOutlier
Contributor
Contributor

When it fails with the $200 test amount, there is unfortunately no error shown in the error log.  How is it possible to see the raw $request value when it fails? 

 

Can you also confirm to me something I've asked before.  If transactions are working in the sandbox right now (you can see in the code that my sandbox endpoint is:  https://api-3t.sandbox.paypal.com/nvp ), then will I be ok after June 30, 2017 which is the time when PayPal fully implements its new security changes (like TLS upgrade, use POST instead of GET method, etc.)

Login to Me Too

angelleye
Advisor
Advisor

Yes, all of that stuff has been updated on the sandbox for a little while now, so if your stuff is working there you'll be fine after that date.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

pjtezza
Contributor
Contributor

I'm using the REST API in Python and I can confim that the PayPal Sandbox won't accept a $200 credit card sale transaction. The error I get every time is "paypalrestsdk.exceptions.ServerError: Failed. Response status: 503. Response message: Service Unavailable. Error message: java.net.SocketTimeoutException: Read timed out". In the code below, I can change the total to 201.00 (and make the obvious fix to the credit card number) and the transaction will succeed. Changing the credit number doesn't help. The reason this issue is so annoying is the misleading error message. I'm coding in Python, so I know the "java.net.SocketTimeoutException" error is something happening on the PayPal servers, so I wasted a bunch of time checking the status of the PayPal sandbox service and waiting for the problem to resolve itself.

 

    payment = paypalrestsdk.Payment({
        "intent": "sale",
        "payer": {
            "payment_method": "credit_card",
            "funding_instruments": [{
                "credit_card": {
                    "type": "visa",
                    "number": "************1111",
                    "expire_month": "01",
                    "expire_year": "2018",
                    "cvv2": "123",
                    "first_name": "Joe",
                    "last_name": "Shopper"}}]},
        "transactions": [{
            "amount": {
                "total": "200.00",
                "currency": "USD"},
            "description": "This is the payment transaction description."}]}, api=my_api)

    if payment.create():
        print("Payment created successfully")
    else:
        print(payment.error)

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.