CCAvenue "Error Encountered.ERROR

I have included CCAvenue in my application, but the problem is that the code gets to

https://secure.ccavenue.com/transaction/initTrans

below is the code:

NSString *encryptedStr = [NSString stringWithFormat:@"Merchant_Id=%@&Order_Id=%@&redirect_url=%@&cancel_url=%@&enc_val=%@&access_code=AVSB00EA86CN75BSNC&billing_name=%@&billing_address =%@&billing_city=%@&billing_state=%@&billing_zip=%@&billing_country=%@&billing_email=%@&billing_tel=%@",MerchantID,_order_id,redirectUrl,cancelUrl,encVal,self.billing_name,self.billing_address,self.billing_city,self.billing_state,self.billing_zip,self.billing_country,self.billing_email,self.billing_tel];
NSData *myRequestData = [NSData dataWithBytes: [encryptedStr UTF8String] length: [encryptedStr length]];
NSMutableURLRequest *requestN = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: urlAsString]];
[requestN setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[requestN setValue:urlAsString forHTTPHeaderField:@"Referer"];
[requestN setHTTPMethod: @"POST"];
[requestN setHTTPBody: myRequestData];
[self.webView loadRequest:requestN];

      

Every time it comes back

Encountered.ERROR error !! Problem decrypting application request

+3


source to share


2 answers


This is a solution for the shameless ... I think the only difference is about payment details (not shameless and shameless) ... only. this works for me. I hope it will solve ur problem ... and check if you push to ccavenue server via ur mobile in 120 seconds or not after you get rsa key. You need to click on the ccavenue server (with 120 seconds) for the invoice page, otherwise it will expire.

try this:

from server:



after you click on the ccavenue line for RSA with ur access code and orderID

u will get: rsa key for ur transaction.

u need to encrypt the key using base64 and AES-256 format .

before you encrypt u, you need to delete some unnecessary data in the key

1. double quotes in a key

  1. \ n in the key
  2. \ in the key
   // removing double quates
            NSString * newReplacedString2 = [rsaKey stringByReplacingOccurrencesOfString:@"\"" withString:@""];

            NSLog(@"%@",rsaKey);

            //removing \n in the key
            NSString * newReplacedString = [newReplacedString2 stringByReplacingOccurrencesOfString:@"\\n" withString:@""];

            NSLog(@"%@",rsaKey);
        //removing \ in the key
        NSString * newReplacedString1 = [newReplacedString stringByReplacingOccurrencesOfString:@"\\" withString:@""];
        NSLog(@"%@",newReplacedString1);

//and u need to divide the key for every 64 bits 

    NSString * abc = [NSString stringWithFormat:@"%@", newReplacedString1];
    NSMutableString *sss=[NSMutableString new];
    int j=(int)([abc length]/63);
    for (int i=0; i<=j; i++) {
        int k= i*63;
        NSString * newString;
        if (i != j) {
            newString = [abc substringWithRange:NSMakeRange(k,63)];
            NSLog(@"%lu",(unsigned long)newString.length);
            newString=[NSString stringWithFormat:@"%@",newString];
        }else{
            newString = [abc substringWithRange:NSMakeRange(k,[abc length]-k)];
            NSLog(@"%lu",(unsigned long)newString.length);
            if (newString.length !=0)
                newString=[NSString stringWithFormat:@"%@",newString];
        }
        if (newString.length !=0)
            [sss appendString:[NSString stringWithFormat:@"%@\n",newString]];
    }
    NSLog(@"%@",sss);

     //as per the documentation u can follow the process 
    rsaKey = [NSString stringWithFormat:@"-----BEGIN PUBLIC KEY-----\n%@-----END PUBLIC KEY-----\n",sss];
    NSLog(@"%@",rsaKey);

    //Encrypting Card Details
        NSString *myRequestString = [NSString stringWithFormat:@"amount=%@&currency=%@",amount,currency];
        CCTool *ccTool = [[CCTool alloc] init];


    NSLog(@"emcrpted data %@",[ccTool encryptRSA:myRequestString key:rsaKey]);

      

0


source


Solution for non-seamless integration in Swift.

In my case, I received the same message.

Encountered.ERROR error !! Problem decrypting application request



For any problem you need to call / send to the ccavenue support team .

They will provide you with a solution or a new integration kit.

CCAvenue Support

0


source







All Articles