简体   繁体   中英

How to pass GET request for PayTm transaction in ios Objective C

I am integrating PayTm with my app and I want to pass the parameters using GET method.

My code is as follows:

NSString *urlString = [NSString stringWithFormat:@"https://secure.paytm.in/oltp/HANDLER_INTERNAL/TXNSTATUS?JsonData={%22MID%22:%22%@%22,%22ORDERID%22:%22a84afd6c-0e54-42df-b29a-2b057f9e7c53%22}",MIDValue];

where MIDValue is a string.

When I use this code I'm getting error message.

Please give a suggestion to remove the error.

Thank You

Maybe your variable MIDValue contains space and/or &. You first have to encode it as URL and then pass it as parameter.

Visit this for details, I guess this is what you are looking for

NSString *newParam = [MIDValue stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]

NSString *urlString = [NSString stringWithFormat:@"https://secure.paytm.in/oltp/HANDLER_INTERNAL/TXNSTATUS?JsonData={%22MID%22:%22%@%22,%22ORDERID%22:%22a84afd6c-0e54-42df-b29a-2b057f9e7c53%22}", newParam];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM