Payumoney Getway错误在iOS中发生 [英] Payumoney getway error occur in ios

查看:92
本文介绍了Payumoney Getway错误在iOS中发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经集成了Payumoney付款方式.但是我在webView中遇到错误,无法加载此 https://test.payu.in/_payment 测试网址

I have integrate payumoney payment getway. But i get error in webView not load this https://test.payu.in/_payment testing url.

还有我的代码:

 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];

我已引用此链接 PayUMoney付款网关问题.并且我已正确传递了所有参数.我不明白我的错.

i have refer this link PayUMoney payment gateway issue .And I have pass all parameter correct. I have not understand what i am wrong.

我通过以下路径获取我的商人和盐键

I get my merchant and salt key this following path

 Seller Dashboard -> Settings -> My account -> Merchant Key - Salt

推荐答案

我在问题解决方案上方找到了它.我尚未在forHTTPHeaderField字段值中传递"charset = utf-8".

I found above my question solution. I have not pass "charset=utf-8" in forHTTPHeaderField field value.

在url请求中通过这种方式传递参数.

pass this way parameter in url request.

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

没有"charset = utf-8"的旧版本可以正常工作,但最新代码在网址中添加了"charset = utf-8".

old version without "charset=utf-8" work correct but latest code add "charset=utf-8" in url.

这篇关于Payumoney Getway错误在iOS中发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆