Nets-mobile-acceptance / Netaxept-Android-SDK

PiA Netaxept Android SDK is a library that provides the native In-App interaction to perform Netaxept payments directly from an app on Android devices while minimizing PCI DSS requirements for you.
31 stars 15 forks source link

Inconsistent callbacks with MobileWalletListener #86

Closed naxx1000 closed 7 months ago

naxx1000 commented 7 months ago

After upgrading to 2.7.4 and using the new MobilePay app, the redirect callbacks have been inconsistent.

Function onMobileWalletRedirectInterrupted is fired as soon as my fragment which implements MobileWalletListener is started.

When I then cancel the payment in the MobilePay app and is redirected back, onMobileWalletRedirect is fired even though the payment was interrupted by the user.

Following your documentation onMobileWalletRedirect shoulds still be for success and onMobileWalletRedirectInterrupted for when user interrupts the payment. I had no problems on 2.7.3 with the old MobilePay app.

I have not yet tested for successful payment flows, but there have been some users reporting problems when trying to pay.

Miss-PiA commented 7 months ago

Hi @naxx1000,

Could you test the latest SDK with our sample app? We do not see this issue with the setup shown there. It can also be helpful to share how you initiate MobilePay payment from the Fragment so we can try and reproduce the issue.

We're happy to continue and debug the issue using the same steps you took to get to the bottom of the problem.

Miss-PiA commented 7 months ago

It's also important to note that onMobileWalletRedirect following user cancellation on MobilePay app is the expected callback. The new latest MobilePay app update removes the need for onMobileWalletRedirectInterrupted callback as there is no WebView loaded before launching the MobilePay app as there was in the previous MobilePay app integration. The interruption callback is triggered when user interrupts launching of the wallet app by cancelling the WebView which no longer applies for MobilePay wallet app.

naxx1000 commented 7 months ago

Hello, thank you for your reply.

Is it then possible to know if onMobileWalletRedirect is fired because the user cancelled the payment on the MobilePay app or if the payment was a success on the MobilePay app?

Regarding reproducing the issue, I made a project template project "Basic Views Activity" using Android Studio Hedgehog 2023.1.1 Beta 4. In my fragment class I inserted the code below. Calling PiaSDK.initateMobileWallet opens the MobilePay app, but onMobileWalletRedirectInterrupted is also fired in the process. The parameter MyToken is a valid token for prod, since I still haven't set up a test environment for MobilePay.

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val mobileWalletRegistration = object : WalletPaymentRegistration {
            override fun registerPayment(callbackWithWalletURL: WalletURLCallback) {
                callbackWithWalletURL.successWithWalletURL(Uri.parse("https://pay.mobilepay.dk/?token=$MyToken"))
            }
        }
        val mobilePayProcess: PaymentProcess.WalletPayment? = PaymentProcess.mobilePayWithFragment(false, this)
        mobilePayProcess?.let { walletPayment ->
            val canLaunch = PiaSDK.initiateMobileWallet(walletPayment, mobileWalletRegistration)
        }
    }
Miss-PiA commented 7 months ago

Hi @naxx1000, the only way to determine cancellation or successful authorisation in MobilePay app is by making a Netaxept Query to get transaction status using the transaction ID following the redirect. We hope this allows you to continue with the integration and we'll make sure to align our SDK if/when MobilePay app sends an update that may change this current flow.

naxx1000 commented 7 months ago

Okay thank you. In my use case I cannot query the transaction status directly, but I have something working for now. Our payment flow would be improved if the new MobilePay app could respond with user interruptions as the previous app did, but there might not be anything more that can be done from your side.