Search code examples
iosiphoneobjective-cxcodeccavenue

CCAvenue Gateway Integration kit for ios Application


Hi,
I have developed an application which needs payment gateway. I have already worked on "Paypal". It was successful and now i need to integrate another payment gateway that is "ccavenue". Can anybody help me how to integrate that one?
Thanks.


Solution

  • Since the CCAvenue shows server side options we need to connect to web view and load the ccavenue gateway which is compatable with iphone screens. Here in Our application we need to do small things as follows

    First create the html file and parameters related to your ccavenue gateway

    <html>
    
    <body>
    
        <form name='form2' method='post' action='UR URL HERE'>
    
            <input type="text" name='Merchant_Id'><br>
            <input type="text" name='Amount'><br>
            <input type="text" name='Order_Id'><br>
            <input type="text" name='Redirect_Url'><br>
            <input type="text" name='Checksum'><br>
            <input type="text" name='billing_cust_name'><br>
            <input type="text" name='billing_cust_address'><br>
            <input type="text" name='billing_cust_address'><br>
            <input type="text" name='billing_cust_tel'><br>
            <input type="text" name='billing_cust_email'><br>
            <input type="text" name='delivery_cust_name'><br>
            <input type="text" name='delivery_cust_address'><br>
            <input type="text" name='delivery_cust_tel'><br>
            <input type="text" name='delivery_cust_notes'><br>
            <input type="text" name='Merchant_Param'><br>
    
            </form>
    
    </body>
    

    After that load the web view on your screen

      NSURL *url = [NSURL URLWithString: @"https://www.ccavenue.com/shopzone/cc_details.jsp"];
    
    webView.delegate = self;
    webView.scalesPageToFit = YES;
    
    NSString *strUsername = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"];
    
       NSString *body = [NSString stringWithFormat: @"Merchant_Id=%@&Amount=%@&Order_Id=%@&Redirect_Url=%@&Checksum=%@&billing_cust_name=%@&billing_cust_address=%@&billing_cust_country=%@&billing_cust_tel=%@&billing_cust_email=%@&delivery_cust_name=%@&delivery_cust_address=%@&delivery_cust_tel=%@&delivery_cust_notes=%@&Merchant_Param=%@",@"XXXXX",@"10",@"123456",@"http://us2guntur.com/us2guntur/CCAvenueredirecturl.jsp",@"1234567890",@"Test",@"Hyderabad",@"India",@"1357896437",@"Test1000",@"Guntur",@"234567896",@"",@""];
    
    NSLog(@"%@",body);
    
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];
    [request setHTTPMethod: @"POST"];
    [request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];
    [webView loadRequest: request];