我已经集成了payumoney付款方式。但是我在webView中收到错误,无法加载此https://test.payu.in/_payment测试网址。
和我的代码:
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 = @"[email protected]";
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];
我已经引用了此链接PayUMoney payment gateway issue,并且我已经正确传递了所有参数。我不明白我的错。
我通过以下路径获取商人和盐键
Seller Dashboard -> Settings -> My account -> Merchant Key - Salt
最佳答案
对于测试代码,请使用以下键:
NSString *key = @"JBZaLc";
NSString* salt = @"GQs7yium";
和您的网址
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://test.payu.in/_payment"]]];
注意:对于实时使用,请用您自己的值替换KEY和SALT值。
&setURL与
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@" https://secure.payu.in/_payment"]]];
关于ios - Payumoney网关错误在iOS中发生,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31681781/