Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-1641

PayPal: Refunds for full amounts fail

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.3
    • Fix Version/s: 3.6.0
    • Component/s: None
    • Labels:
      None

      Description

      Someone inquired with PayPal regarding failed refunds due to an "Internal Error". The reply was:

      "Thank you for contacting PayPal Merchant Technical Service.
      Internal error usually occurs if there are wrong variables passed in the
      API call or if there are any intermittent issue at PayPal's end during
      the time of transaction.

      Looking into your API requests, I can see that you are trying to make a
      partial refund for this transaction: 8P5262567W398632Yfor an amount of :
      2.50 USD. However, looking into the transaction, I noticed that, the
      total amount received for that transaction is 2. 50 USD. In that case,
      if you are going to make a partial refund it has be to for an amount
      lesser than 2.50 USD.
      However, if you are going to make a full refund, you need to pass the
      REFUNDTYPE =Full and you do not need to set an AMT value for it.
      You may refer to this documentation on how RefundTransaction API is done :
      https://developer.paypal.com/docs/classic/api/merchant/RefundTransaction_API_Operation_NVP/
      Do get back to us if the issue still occurs. Thank you"


      It appears PayPal is not able to distinguish a full amount from a partial amount except to refuse the refund as an internal error based on the REFUNDTYPE.

      I suggest updating the PayPal Payments Standard gateway to fetch the associated transaction in ::refund to determine whether the given amount is the full transaction amount, and setting the REFUNDTYPE as FULL or PARTIAL accordingly.

        Activity

        tyson Tyson Phillips (Inactive) created issue -
        tyson Tyson Phillips (Inactive) made changes -
        Field Original Value New Value
        Rank Ranked higher
        tyson Tyson Phillips (Inactive) made changes -
        Description Someone inquired with PayPal regarding failed refunds due to an "Internal Error". The reply was:

        "Thank you for contacting PayPal Merchant Technical Service.
        Internal error usually occurs if there are wrong variables passed in the
        API call or if there are any intermittent issue at PayPal's end during
        the time of transaction.

        Looking into your API requests, I can see that you are trying to make a
        partial refund for this transaction: 8P5262688W398632Yfor an amount of :
        2.50 USD. However, looking into the transaction, I noticed that, the
        total amount received for that transaction is 2. 50 USD. In that case,
        if you are going to make a partial refund it has be to for an amount
        lesser than 2.50 USD.
        However, if you are going to make a full refund, you need to pass the
        REFUNDTYPE =Full and you do not need to set an AMT value for it.
        You may refer to this documentation on how RefundTransaction API is done :
        https://developer.paypal.com/docs/classic/api/merchant/RefundTransaction_API_Operation_NVP/
        Do get back to us if the issue still occurs. Thank you"

        ----
        It appears PayPal is not able to distinguish a full amount from a partial amount except to refuse the refund as an internal error based on the REFUNDTYPE.

        I suggest updating the PayPal Payments Standard gateway to fetch the associated transaction in ::refund to determine whether the given amount is the full transaction amount, and setting the REFUNDTYPE as FULL or PARTIAL accordingly.
        Someone inquired with PayPal regarding failed refunds due to an "Internal Error". The reply was:

        "Thank you for contacting PayPal Merchant Technical Service.
        Internal error usually occurs if there are wrong variables passed in the
        API call or if there are any intermittent issue at PayPal's end during
        the time of transaction.

        Looking into your API requests, I can see that you are trying to make a
        partial refund for this transaction: 8P5262567W398632Yfor an amount of :
        2.50 USD. However, looking into the transaction, I noticed that, the
        total amount received for that transaction is 2. 50 USD. In that case,
        if you are going to make a partial refund it has be to for an amount
        lesser than 2.50 USD.
        However, if you are going to make a full refund, you need to pass the
        REFUNDTYPE =Full and you do not need to set an AMT value for it.
        You may refer to this documentation on how RefundTransaction API is done :
        https://developer.paypal.com/docs/classic/api/merchant/RefundTransaction_API_Operation_NVP/
        Do get back to us if the issue still occurs. Thank you"

        ----
        It appears PayPal is not able to distinguish a full amount from a partial amount except to refuse the refund as an internal error based on the REFUNDTYPE.

        I suggest updating the PayPal Payments Standard gateway to fetch the associated transaction in ::refund to determine whether the given amount is the full transaction amount, and setting the REFUNDTYPE as FULL or PARTIAL accordingly.
        cody Cody Phillips (Inactive) made changes -
        Rank Ranked higher
        cody Cody Phillips (Inactive) made changes -
        Rank Ranked lower
        Hide
        cody Cody Phillips (Inactive) added a comment -

        Blesta currently only allows full refunds, so we should be able to simply set FULL as the type, right? Is an amount even needed then?

        Show
        cody Cody Phillips (Inactive) added a comment - Blesta currently only allows full refunds, so we should be able to simply set FULL as the type, right? Is an amount even needed then?
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        Strangely, I tested this with and without an amount when the refund type was set to Full and still encountered the error.

        Show
        tyson Tyson Phillips (Inactive) added a comment - Strangely, I tested this with and without an amount when the refund type was set to Full and still encountered the error.
        Hide
        cody Cody Phillips (Inactive) added a comment -

        Docs say don't use an amount when type is full. Shouldn't be any error in that case, unless the payment already had a partial refund previously?

        Show
        cody Cody Phillips (Inactive) added a comment - Docs say don't use an amount when type is full. Shouldn't be any error in that case, unless the payment already had a partial refund previously?
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        I continue getting the same error regardless. No partial refund was previously issued.

        Consider the logs:
        INPUT:
        https://api-3t.sandbox.paypal.com/nvp
        a:8:

        {s:6:"METHOD";s:17:"RefundTransaction";s:13:"TRANSACTIONID";s:17:"67E001199A642311Y";s:10:"REFUNDTYPE";s:4:"Full";s:12:"CURRENCYCODE";s:3:"USD";s:4:"NOTE";s:0:"";s:4:"USER";s:36:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";s:3:"PWD";s:10:"xxxxxxxxxx";s:9:"SIGNATURE";s:56:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";}

        OUTPUT:
        https://api-3t.sandbox.paypal.com/nvp
        a:6:

        {s:9:"TIMESTAMP";s:20:"2015-05-13T20:14:57Z";s:13:"CORRELATIONID";s:13:"29fdca3039c3c";s:3:"ACK";s:7:"Failure";s:12:"L_ERRORCODE0";s:5:"10001";s:15:"L_SHORTMESSAGE0";s:14:"Internal Error";s:14:"L_LONGMESSAGE0";s:26:"Timeout processing request";}
        Show
        tyson Tyson Phillips (Inactive) added a comment - I continue getting the same error regardless. No partial refund was previously issued. Consider the logs: INPUT: https://api-3t.sandbox.paypal.com/nvp a:8: {s:6:"METHOD";s:17:"RefundTransaction";s:13:"TRANSACTIONID";s:17:"67E001199A642311Y";s:10:"REFUNDTYPE";s:4:"Full";s:12:"CURRENCYCODE";s:3:"USD";s:4:"NOTE";s:0:"";s:4:"USER";s:36:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";s:3:"PWD";s:10:"xxxxxxxxxx";s:9:"SIGNATURE";s:56:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";} OUTPUT: https://api-3t.sandbox.paypal.com/nvp a:6: {s:9:"TIMESTAMP";s:20:"2015-05-13T20:14:57Z";s:13:"CORRELATIONID";s:13:"29fdca3039c3c";s:3:"ACK";s:7:"Failure";s:12:"L_ERRORCODE0";s:5:"10001";s:15:"L_SHORTMESSAGE0";s:14:"Internal Error";s:14:"L_LONGMESSAGE0";s:26:"Timeout processing request";}
        Hide
        cody Cody Phillips (Inactive) added a comment -

        So paypal just doesn't respond? Or that's just the error they give "Timeout processing request."?

        Show
        cody Cody Phillips (Inactive) added a comment - So paypal just doesn't respond? Or that's just the error they give "Timeout processing request."?
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        That error is the only response. It is identical to the response when the refund type is "Partial" and a full amount is given. So it appears that the resolution that PayPal support described does not resolve the issue.

        Show
        tyson Tyson Phillips (Inactive) added a comment - That error is the only response. It is identical to the response when the refund type is "Partial" and a full amount is given. So it appears that the resolution that PayPal support described does not resolve the issue.
        Hide
        cody Cody Phillips (Inactive) added a comment -

        Any other causes of the error?

        As it stands now, it sounds like refunds don't work at all. They worked just fine before.

        Show
        cody Cody Phillips (Inactive) added a comment - Any other causes of the error? As it stands now, it sounds like refunds don't work at all. They worked just fine before.
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        I'm not sure if they did work before, as this has been an ongoing problem people have had. Besides what is in the task description, there are no other causes for the error. We may need to contact PayPal support to help determine the issue.

        Show
        tyson Tyson Phillips (Inactive) added a comment - I'm not sure if they did work before, as this has been an ongoing problem people have had. Besides what is in the task description, there are no other causes for the error. We may need to contact PayPal support to help determine the issue.
        Hide
        cody Cody Phillips (Inactive) added a comment -

        I know it worked before because I implemented and tested it. My guess is PayPal made some changes since then which broke backwards compatibility. Either that, or they no longer allow refunds in sandbox.

        Show
        cody Cody Phillips (Inactive) added a comment - I know it worked before because I implemented and tested it. My guess is PayPal made some changes since then which broke backwards compatibility. Either that, or they no longer allow refunds in sandbox.
        Hide
        cody Cody Phillips (Inactive) added a comment -

        REFUNDTYPE, CURRENCY, NOTE (if empty) are optional. I would test without those fields present and see what happens.

        Show
        cody Cody Phillips (Inactive) added a comment - REFUNDTYPE , CURRENCY , NOTE (if empty) are optional. I would test without those fields present and see what happens.
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        With those fields removed, PayPal still returns "Timeout processing request". It appears that all fields, given or not, result in that timeout response for the RefundTransaction method.

        I'm not sure if this is a limitation of the sandbox or not. But since I'm unable to test refunds successfully, all we could do is set the fields according to the API.

        Show
        tyson Tyson Phillips (Inactive) added a comment - With those fields removed, PayPal still returns "Timeout processing request". It appears that all fields, given or not, result in that timeout response for the RefundTransaction method. I'm not sure if this is a limitation of the sandbox or not. But since I'm unable to test refunds successfully, all we could do is set the fields according to the API.
        Hide
        cody Cody Phillips (Inactive) added a comment -

        Can we open a ticket with PayPal and get an official response on this? Would like to get to the bottom of it, whether it's a bug with their sandbox or API.

        Show
        cody Cody Phillips (Inactive) added a comment - Can we open a ticket with PayPal and get an official response on this? Would like to get to the bottom of it, whether it's a bug with their sandbox or API.
        tyson Tyson Phillips (Inactive) made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.6.0 [ 10803 ]
        Resolution Fixed [ 1 ]
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        cURL posts array data by automatically changing the header Content-Type to multipart/form-data, which PayPal rejects with a generic "Internal Error". Solution was to post data as a query string instead.

        Show
        tyson Tyson Phillips (Inactive) added a comment - cURL posts array data by automatically changing the header Content-Type to multipart/form-data, which PayPal rejects with a generic "Internal Error". Solution was to post data as a query string instead.
        tyson Tyson Phillips (Inactive) made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            tyson Tyson Phillips (Inactive)
            Reporter:
            tyson Tyson Phillips (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              14/Oct/15