I am trying to integrate the Square Payment on my Ionic 1 application using the Web API based on their docs here. They are using intent anchor to call the Square app and send appropriate payment details. But when I tried to implement, it gives me this error:
Can't display PDF file (intent URL cannot be opened)
Here's my code snippet:
var hrefString = 'intent://#Intent;';
var extrasObject = { /* extras */
"action": "com.squareup.register.action.CHARGE",
"package":"com.squareup",
"S.browser_fallback_url":"<my-fallback-url>",
"S.com.squareup.register.CLIENT_ID":"<my-client-id>",
"S.com.squareup.register.WEB_CALLBACK_URI": "<registered-callback-uri>",
"S.com.squareup.register.API_VERSION":"v1.3",
"i.com.squareup.register.TOTAL_AMOUNT": 100,
"S.com.squareup.register.CURRENCY_CODE":"USD",
"S.com.squareup.register.TENDER_TYPES":"com.squareup.register.TENDER_CARD,com.squareup.register.TENDER_CARD_ON_FILE,com.squareup.register.TENDER_CASH,com.squareup.register.TENDER_OTHER"
};
// Generate intent anchor
for(var key in extrasObject) {
hrefString += key + '=' + extrasObject[key] + ';';
}
// Convert string to URI
var intentURL = encodeURIComponent(hrefString + 'end');
window.open(intentURL, "_system", "location=no");
Prior to this implementation, I already install the InAppBrowser Cordova plugin here.
Can someone help me on this one? Thanks in advance!