iOS Question Problem with MKWebView

Pablo Torres

Active Member
Licensed User
Hi everybody, I need a hand with a problem I am stucked with
I have a funny issue with MKWebView: I am trying to use a PCI plattform (mercado pago) to process payments on an app I'm developing on iOS, everithing works fine but when I enter the data of the card It gets stuck trying to process the payment. My guess is that something is locking the MKWebView where I load the plattform that can't perform the whole payment process.
I have tried everything with the ATS (false, true, allowing arbytrary loads in webview, etc) but the behaviour is exactly the same, it get stuck during the payment and can´t finish the process.
I can´t attach videos here because of the size, but I put 2 videos on my server showing the different behaviour between Desktop and iOS.
The link for these videos are Desktop and iOS
I already contact the people in charge of the plattform and they told me the behaviour should be exactly the same in the app than in the desktop.
Also, I tried to work it out with the Safari using iUI9, but the results remains the same, stuck during the payment process without finish

I will be glad for any help you can give me

Many thanks
 

Semen Matusovskiy

Well-Known Member
Licensed User
I used Charles for Windows only (on iPhone / Android you need to configurate proxy-settings).
I saw that there is a special Charles's release for IOS, but I did not try it.

Also (if you use local builder) maybe useful Web Inspector in Safari. But Charles is better anyway.
 
Upvote 0

Pablo Torres

Active Member
Licensed User
I used Charles for Windows only (on iPhone / Android you need to configurate proxy-settings).
I saw that there is a special Charles's release for IOS, but I did not try it.

Also (if you use local builder) maybe useful Web Inspector in Safari. But Charles is better anyway.
I see... my problem is on iOS, windows is working perfect (desktop).
I will try Charles
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Hi,

It sounds similar to a problem I had when trying to implement STRIPE


My problem was that there were callbacks to particular web pages that it needs as it expects to be working with a website.
The solution was to use OverrideURL to trap these and perform any appropriate action

B4X:
Sub wvApple_OverrideUrl (Url As String) As Boolean
    Log($"Override ? (${Url})"$)
    If (Url.Contains("cancel.html")) Then
        wvApple.Visible = False
        xui.MsgboxAsync("Cancelling. Do something ","Hi")
        'handle cancelling here
    else if (Url.contains("success.html")) Then
        wvApple.Visible = False
        xui.MsgboxAsync("Success! Do something ","Hi")
        'Handle success here
    End If  
    Return False
End Sub
 
Upvote 0

Pablo Torres

Active Member
Licensed User
Hi,

It sounds similar to a problem I had when trying to implement STRIPE


My problem was that there were callbacks to particular web pages that it needs as it expects to be working with a website.
The solution was to use OverrideURL to trap these and perform any appropriate action

B4X:
Sub wvApple_OverrideUrl (Url As String) As Boolean
    Log($"Override ? (${Url})"$)
    If (Url.Contains("cancel.html")) Then
        wvApple.Visible = False
        xui.MsgboxAsync("Cancelling. Do something ","Hi")
        'handle cancelling here
    else if (Url.contains("success.html")) Then
        wvApple.Visible = False
        xui.MsgboxAsync("Success! Do something ","Hi")
        'Handle success here
    End If 
    Return False
End Sub

Hi, good answer, it didn't solve the problem but at least I did something different

The logs are:

Override ? (https://www.mercadopago.com.uy/chec...-f8c89ac98f0e&transaction-amount=3400&action=)
Override ? (https://www.mercadopago.com.uy/chec...-f8c89ac98f0e&action=&transaction-amount=3400)
Override ? (about:blank)
Override ? (about:blank)
Override ? (https://vars.hotjar.com/box-469cf41adb11dc78be68c1ae7f9457a4.html)
Override ? (https://www.google.com/recaptcha/en...c8LiYc1DKXiAomK&size=invisible&cb=y8rinndmca1)
Override ? (about:blank)
Override ? (about:blank)
Override ? (about:blank)
Override ? (https://mldp.mercadopago.com/device...e&session_id=a41735113b2b82279491df6d912c582c)
Override ? (https://www.mercadolibre.com/jms/lg...057787bd341bc2703da7970feb1a5be1b3bebe31bc6b4)

It stops there and I can't see anything after that
 
Upvote 0

Pablo Torres

Active Member
Licensed User
I have created 3 projects and zipped so anyone can try them
TestNonUI: a B4J NonUI project that do everything "on the back" and creates an html in the same dir of the jar named "Prueba.html", then you doubleclick this file and follow the orders to complete the payment
TestUI: basically the same but it uses the Webview of b4j to load the page
TestiOS: something very similar than the other but for iOS, this is the one where I have the problem

For anyone to do the test:
Cardnumber 5031 7557 3453 0604
Name APRO
Expiration 11/25
Code 123

In the next page the CI number could be 33476561

I will appreciate any hand that could help me to solve the problem
 

Attachments

  • TestNonUI.zip
    1.4 KB · Views: 61
  • TestUI.zip
    2.7 KB · Views: 65
  • TestiOS.zip
    137.7 KB · Views: 69
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
I simply ran TestiOS without any change. Results:
https://sportsticket.uy:8080/cafemax/Service?Data={"Articulos":[{"subtotal":500,"idarticulo":1,"cantidad":2,"unitario":250},{"subtotal":300,"idarticulo":7,"cantidad":1,"unitario":300},{"subtotal":700,"idarticulo":2,"cantidad":2,"unitario":350}],"IdEmpresa":1,"Valor":"1500.00","metodo":"Pedido","IdCliente":1}
ResponseError: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “sportsticket.uy” which could put your confidential information at risk., status code: 0

Well let's look a certificate. Let's Encrypt. It's not a surprise that Safari (unlike IE, Chrome etc) does not trust. Guys do not have USD 3-4 /year to buy the simpliest Comodo certificate ?
 
Upvote 0

Pablo Torres

Active Member
Licensed User
I simply ran TestiOS without any change. Results:


Well let's look a certificate. Let's Encrypt. It's not a surprise that Safari (unlike IE, Chrome etc) does not trust. Guys do not have USD 3-4 /year to buy the simpliest Comodo certificate ?
That shouldn't be a problem if you did setup to ATSEnabled=false, right?
 
Upvote 0

Pablo Torres

Active Member
Licensed User
No such thing MKWebView. You mean WKWebView which was replaced with the regular WebView.

You shouldn't try to implement the web based solution. Look for the OAuth solution.
Exactly, WKWebView.
I did not understand your answer. Where do I have to look for the OAuth Solution? Can I get an example of that? Why is the web solution not working in iPhone?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
ATSEnabled=True works better. At least the system accepts information about credit card and then offers to check information (Revisa si está todo bien)
 
Upvote 0

Pablo Torres

Active Member
Licensed User
ATSEnabled=True works better. At least the system accepts information about credit card and then offers to check information (Revisa si está todo bien)
I don't know, what you say is not happening to me.
I set ATSEnabled to false
I always see the information about credit card and etc
In every intent I made the payment get stuck in the same part (like thinking)

How is that ATSEnabled=true works "better"?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Better means that results in B4J and B4i are very similar

1.PNG
 
Upvote 0
Top