Midtrans / midtrans-php

Official Midtrans Payment API Client for PHP | https://midtrans.com
MIT License
319 stars 106 forks source link

[Non Repo Related Question] MidtransNew3ds.getCardToken "onFailure" JS callback function not triggered properly, when card input is not in valid luhn-algo format #64

Closed sanjayrathod141 closed 2 years ago

sanjayrathod141 commented 2 years ago

https://user-images.githubusercontent.com/96870831/147807178-e6823b83-a3e6-40c8-87f3-f6ad5bf63481.mp4

Hi,

Not working callback onFailure function. when the user enters the wrong card details then will not call this function. So I can manage to fail cases and not display error msg on screens.

PFA

[ 33333333333333333332021-12-30_16-52 22222222222222021-12-30_16-51

----------------------Code--------------------------------------

Checkout
rizdaprasetya commented 2 years ago

hi @sanjayrathod141 thanks for reaching out, looks like the issue seems valid, the onFailure function seems to behave not as expected.

We'll have to check with our internal team to check & fix this. We'll let you know when it solved. Thanks! Note: This seems to be issue on sandbox env only, production env should be fine.

rizdaprasetya commented 2 years ago

Update for this case,

Issue

The issue seems to be identified on scenario:

Our team will further investigate on this.

Workaround

In order to prevent this, there is a workaround. Before passing the card.card_number input param, the value can be validated first using this implementation for example:

Then, only proceed to call MidtransNew3ds.getCardToken when the validation result is valid. If the card_number is not valid card, you can proceed to show validation error to the customer/user instead.

rizdaprasetya commented 2 years ago

Update: confirmed to be issue on our side, and our team is working to fix it. Will inform you for further updates. Thanks.

rizdaprasetya commented 2 years ago

hi @sanjayrathod141 we'd like to give you update. The issue has been resolved as per today. The onFailure callback should behave as expected now. You can try again and let us know if you still have any issue. Thanks!