You need to open the service page in UIWebView , where the user would enter their data and process the result.

url this type (generated by the server, payment is made for it)

https://techno.org.uk / payment / assist / return & URL_RETURN_OK = {company_domain} / payment / assist / 111683 / pass & URL_RETURN_NO = {company_domain} / payment / assist / 111683 / fail

Forced to replace Russian letters with r, digits with n, English letters with e, domain of your company with {company_domain} for security purposes, but observing all spaces and order.

I'm trying to create an NSURL from this line to open the page in UIWebWiew . But as a result I get nil and the page in UIWebView does not open. If I open the link in the browser, then everything is OK and the transfer is made to the payment page. hence the NSURL initializer NSURL not like the format of the string. I suspect that the fact is that the url quite complicated.

How can I get around this problem?

    1 answer 1

    The URL is complex, we need an encoding so that it can be represented as an address. Try this:

     let url : NSString = "https://test.paysecure.ru/pay/order.cfm?Merchant_ID=nnnnnn&OrderNumber=eennnnn&OrderAmount=503,5&OrderCurrency=RUB&Delay=1&FirstName=Rrrrrrr&LastName=Rrrrrrr&Email=eeeee@eeeee.ee&MobilePhone=+n nnn nnn nn nn&URL_RETURN={company_domain}/payment/assist/return&URL_RETURN_OK={company_domain}/payment/assist/111683/pass&URL_RETURN_NO={company_domain}/payment/assist/111683/fail" let urlStr : NSString = url.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())! let urlToOpen : NSURL = NSURL(string: urlStr as String)! UIApplication.sharedApplication().openURL(urlToOpen) //пробуйте в UIWebView 
    • Thanks, worked - iamthevoid