Search code examples
objective-cuiwebviewpayment-gatewayccavenue

How to get back from web view after some action is done there?


I am implementing the CCAvenue gate way in my application. In which CCAvenue gateway is loaded in web view from my web site.

Now after Transaction is completed with Success/Failur page,How can i came to know and load my apps success page.... Please help me Friends


Solution

  • The easiest way would be for your web page to send a request with a custom scheme for example myapp://transactionSuccess and your app to handle this in the webView delegate:

    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    
        NSURL *URL = [request URL];
        if ([[URL scheme] isEqualToString:@"myapp"]) {
            // handle the response
            NSString *host = [URL host];
            if ([host isEqualToString:@"transactionSuccess"]) {
                // show your custom screen
                return NO;
            }
        }
    
        return YES;
    }