iOS中的Telr支付集成

时间:2016-09-03 12:58:50

标签: ios objective-c

我想在我的应用程序中集成Telr Payment集成,我已经完成了DOC部分,似乎我必须要求启用移动API。如果有人在iOS上有一个Telr集成演示,请随时分享。我无法找到有关此Telr支付集成的任何演示。

我正在给你我的演示,但每当我收到错误并且它说类型 - " E "代码 - 的 01 即可。如果这里有任何人有任何想法请帮助我。实际上我正在进行一个测试演示,有可能我传递了一些错误的参数,但实际上我并不知道哪些参数错误。

NSString *paramString = [NSString stringWithFormat:
                      @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"

                      "<mobile:Body>\n"
                      "<store>%@</store>"
                      "<key>%@</key>"

                      "<device:Body>\n"
                      "<type>%@</type>"
                      "<id>%@</id>"
                      "<agent>%@</agent>"
                      "<accept>%@</<accept>"
                      "</device:Body>\n"

                      "<app:Body>\n"
                      "<name>%@</name>"
                      "<version>%@</version>"
                      "<user>%@</user>"
                      "<id>%@</<id>"
                      "</app:Body>\n"

                      "<tran:Body>\n"
                      "<test>%@</test>"
                      "<type>%@</type>"
                      "<class>%@</class>"
                      "<cartid>%@</<cartid>"
                      "<description>%@</description>"
                      "<currency>%@</currency>"
                      "<amount>%@</amount>"
                      "<ref>%@</<ref>"
                      "</tran:Body>\n"
                      "</mobile:Body>\n"
                         ,@"123",@"XG32K#rBLn~BSm82",@"Simulator",@"xyzabc",@"",@"",@"Telr-Payment-Demo",@"1.0",@"Syscraft.Telr-Payment-Demo",@"",@"Test mode",@"PAYPAGE",@"",@"123",@"hello",@"AED",@"9.50",@""];


NSString *requestURL=@"https://secure.innovatepayments.com/gateway/mobile.xml";

NSURL *url=[NSURL URLWithString:requestURL];
NSData *data=[paramString dataUsingEncoding:NSUTF8StringEncoding];

NSMutableURLRequest *mRequest = [[NSMutableURLRequest alloc] init];
[mRequest setURL:url];

[mRequest setHTTPMethod:@"POST"];




[mRequest setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[data length]] forHTTPHeaderField:@"Content-Length"];

[mRequest setValue:@"application/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
 [mRequest setHTTPBody:data];

NSURLResponse *response = nil;
NSError *error = nil;

NSData *responseData1  = [NSURLConnection sendSynchronousRequest:mRequest returningResponse:&response error:&error];



if (error!=nil)
{
    NSLog(@"Webservice Error==%@",error);
}
else
{
    NSString *responseDic =[NSJSONSerialization JSONObjectWithData:responseData1 options:NSUTF8StringEncoding error:&error];

    if (error!=nil)
    {
        NSLog(@"Webservice Error==%@",error);

    }
    else
    {
        NSLog(@"responseDic ======\n %@",responseDic);

    }
}

0 个答案:

没有答案