Misleading error messages waste everybody's time

pjtezza
Contributor
Contributor

I'm using the REST API with the PayPal Python wrapper. I have programmed many credit processing integrations, including a prior PayPal integration using the SOAP service. Developing with the REST API is frustrating and takes much longer than it should due to the poor error messages returned. Here are some examples:

 

  1. A sale transaction with a total of $200 results in the error "paypalrestsdk.exceptions.ServerError: Failed. Response status: 503. Response message: Service Unavailable. Error message: java.net.SocketTimeoutException: Read timed out". This issue was particularly frustrating for me because my code was working, then suddently it was not. Of course, with this error message, I thought maybe the problem was on the PayPal sandbox servers. After waiting 12 hours, I started searching Google for this error messages. Apparently, there was a previous sandbox issue with using the same credit card number too many times that caused the same error. I tried different credit card numbers, but that didn't help. After more searches, I found a SOAP forum post with a similar issue and realized that I had just recently changed the amount in my test to $200.
  2. A sale transaction without a funding_instrument.credit_card.type property results in the error "paypalrestsdk.exceptions.ServerError: Failed. Response status: 500. Response message: Internal Server Error". First, I would expect the REST API, like every other credit card processing API, to be able to figure out the credit card type on its own. Second, I would expect any missing required property to generate a much more explicit error message. With a generic "Internal Server Error", I started to wonder if the problem is a crashed PayPal server. Without a more explict error, the only way to find the issue is to tediously recreate the transaction by hand and edit it and feed it into the PayPal API by hand until it works.
  3. A sale transaction with a total of $2000 results in the error "The instrument presented  was either declined by the processor or bank, or it can't be used for this payment". I appreciate the ability to use magic dollar amounts to generate errors for testing. However, in the case of the REST API, these magic amounts aren't documented (see https://developer.paypal.com/docs/api/payments/, for example) and the error message is misleading. 

Here is the Python code I used to reproduce all these issues (with minor edits): 

    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
0 REPLIES 0

Haven't Found your Answer?

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