Getway Payumoney error occurs in ios

I have paywoney payment integration. But I get an error in webView without loading this https://test.payu.in/_payment verification URL.

enter image description here

And my code is:

int i = arc4random() % 9999999999; NSString *strHash = [self createSHA512:[NSString stringWithFormat:@"%d%@",i,[NSDate date]]]; NSString *txnid1 = [strHash substringToIndex:20]; NSLog(@"tnx1 id %@",txnid1); NSString *key = @"xxxxx"; // my key NSString* salt = @"xxxxxx"; // my salt key NSString *amount = @"1.00"; NSString *productInfo = @"Nice product"; NSString *firstname = @"Mani"; NSString *email = @" mani.ingenius@gmail.com "; NSString *phone = @"1234566"; NSString *surl = @"http://www.google.com/"; NSString *furl = @"http://www.github.in/"; NSString *serviceprovider = @"payu_paisa"; NSString *hashValue = [NSString stringWithFormat:@"%@|%@|%@|%@|%@|%@|||||||||||%@",key,txnid1,amount,productInfo,firstname,email,salt]; NSString *hash = [self createSHA512:hashValue]; NSDictionary *parameters = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:txnid1,key,amount,productInfo,firstname,email,phone,surl,furl,hash,serviceprovider , nil] forKeys:[NSArray arrayWithObjects:@"txnid",@"key",@"amount",@"productinfo",@"firstname",@"email",@"phone",@"surl",@"furl",@"hash",@"service_provider", nil]]; __block NSString *post = @""; [parameters enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { if ([post isEqualToString:@""]) { post = [NSString stringWithFormat:@"%@=%@",key,obj]; }else{ post = [NSString stringWithFormat:@"%@&%@=%@",post,key,obj]; } }]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%lu",(unsigned long)[postData length]]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://test.payu.in/_payment"]]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"]; [request setHTTPBody:postData]; [web_view_PayU loadRequest:request]; 

I refer to this PayMoney link for a payment gateway . And I have all the options correctly. I do not understand that I am wrong.

I get my merchant and salt key in the following way

  Seller Dashboard -> Settings -> My account -> Merchant Key - Salt 
+3
source share
3 answers

I found above my solution to the question. I did not pass "charset = utf-8" in the forHTTPHeaderField value forHTTPHeaderField .

pass this parameter parameter in url request.

 [request setValue:@"application/x-www-form-urlencoded charset=utf-8" forHTTPHeaderField:@"Current-Type"]; 

the old version without "charset = utf-8" works correctly, but the latest code adds "charset = utf-8" to the url.

0
source

For the test code, use the following keys:

 NSString *key = @"JBZaLc"; NSString* salt = @"GQs7yium"; 

And ur url

 [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://test.payu.in/_payment"]]]; 

NOTE. For real-time use, replace the KEY and SALT value with your own value. & Amp; setURL with

 [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@" https://secure.payu.in/_payment"]]]; 
0
source

NSString * serviceprovider = @ "";

Leave the service provider field blank. That should work.

0
source

Source: https://habr.com/ru/post/980863/


All Articles