iPhone
For iOS below are some guidelines for app to app. Make sure to URL encode the parameters.
- Register a URL schema for their app in the info.plist file. (This is so that we can navigate back to the merchant app when the transaction is done). This screenshot shows an example:
-
Generate a QR Code using the Create Code API request
-
Construct a URL with the correct format (passing the QR Code and return URL as parameter) and call it when you want to make a purchase. Sample request:
- (IBAction)purchase:(id)sender
{
//The product QR Code
NSString *qrCode = self.codeView.text;
//URL to call when transaction is done. Register your schema in info.plist file
NSString *returnUrl = @"merchant.app.scheme://merchant.com";
//Remember to URL encode
NSString *encodedReturnUrl = [self urlEncode:returnUrl];
//Construct the URL with the parameters
//The URL format is schema://hostname/qrCode/returnUrl
NSString *urlStr = [NSString stringWithFormat:@"Scan to Pay.app.scheme://Scan to Pay.oltio.co.za/%@/%@", qrCode, encodedReturnUrl];
NSURL *url = [NSURL URLWithString:urlStr];
//Open the URL, this
[[UIApplication sharedApplication] openURL:url];
}
*iPhone will not give you an option to select which Scan to Pay App to use to handle the payment. It will select one for you. This is completely out of our control at this point in time.
Updated about 2 years ago