Question

I'm working on magneto 2.3 EE.

Hi have integrated afterpay payment method using plugin

Previously I have afterpay version 3.0.0. But it returns some afterpay refund issue. So I have upgraded the afterpay module with a 3.0.6 version.

Now the afterpay payment keeps loading. I have checked the log file it throws the below request and response.

Request

{ 
   "type":"Request",
   "method":"POST",
   "url":"https:\/\/test.com\/",
   "body":{ 
      "paymentType":"PAY_BY_INSTALLMENT",
      "consumer":{ 
         "email":"************",
         "givenNames":"****",
         "surname":"****",
         "mobile":"**********"
      },
      "merchantReference":"merchant-data",
      "merchant":{ 
         "redirectConfirmUrl":"https:\/\/test.com\/afterpay\/payment\/response",
         "redirectCancelUrl":"https:\/\/test.com.\/afterpay\/payment\/response"
      },
      "items":[ 
         { 
            "name":"Test",
            "sku":"test",
            "quantity":1,
            "price":{ 
               "amount":99.95,
               "currency":"AUD"
            }
         }
      ],
      "taxAmount":{ 
         "amount":0,
         "currency":"AUD"
      },
      "shipping":{ 
         "name":"*********",
         "line1":"***************",
         "line2":"",
         "suburb":"**************",
         "postcode":"****",
         "state":"**********",
         "countryCode":"**",
         "phoneNumber":"**********"
      },
      "billing":{ 
         "name":"*********",
         "line1":"***************",
         "line2":"",
         "suburb":"**************",
         "postcode":"****",
         "state":"**********",
         "countryCode":"**",
         "phoneNumber":"**********"
      },
      "totalAmount":{ 
         "amount":104.9,
         "currency":"AUD"
      }
   }
}

Response

{ 
   "type":"Response",
   "method":"POST",
   "url":"https:\/\/test.com\/",
   "httpStatusCode":201,
   "body":{ 
      "token":"7ud3d39bhq3dskquqakuldssssssssssssssssssssssssssssssssssssdsdsdsd",
      "expires":"2019-12-04T03:21:18.547Z"
   }
}

And I have refereed the afterpay docs. The create order throws this response. But I'm not sure why it's loading so far.

Anybody, please help me to solve the problem.

Note: I have modified my token, site URL and some confidential data.

No correct solution

OTHER TIPS

I have checked with afterpay plugin team.

They suggested a solution to solve the issue.

Similar behaviour has been observed in other cases where the global ajaxStop event fails to fire on the body. Please try commenting out this wrapper function so that AfterPay.redirect can be called without waiting for the body event.

I.e. in Afterpay/Afterpay/view/frontend/web/js/view/payment/method-renderer/afterpaypayovertime.js:

if (data.success && (typeof data.token !== 'undefined' && data.token !== null && data.token.length) ) {
    //Init or Initialize Afterpay
    //Pass countryCode to Initialize function
    if (typeof AfterPay.initialize === "function") {
        AfterPay.initialize(countryCode);
    } else {
        AfterPay.init();
    }   
 //Waiting for all AJAX calls to resolve to avoid error messages upon redirection

    //$("body").ajaxStop(function () { <-- Comment this line
        AfterPay.redirect({
            token: data.token
        });
    //}); <-- And this line
}

This behaviour is still being investigated but is planned to be addressed more permanently in an upcoming release. At this stage it’s anticipated to be included in version 3.1.1.

After commented on this lines, my problem got solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top