I have one working app in Swift, but my 2nd app is ignored by the Square POS app in iOS.
It does not process the card, it temporarily shows the Square POS app on screen, then just returns without callback, without doing anything. The api and dashboard setup look correct.
Is it possible that when I set up the 2nd app - POSSDKTest2, with URL scheme & bundleID and specifying the app’s ID that the Square POS app can’t find it in the Square server?
Here is the screenshot of the info.plist:
api code:
//
// ViewController.swift
// POSSDKTest2
//
// Created by Dr Craig E Curphey on 2022-06-14.
//
import UIKit
import SquarePointOfSaleSDK
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}//------------------------------------
@IBAction func doPaymentTapped(_ sender: Any) {
//------ API to Square right here ******-----------------
let callbackURL = URL(string: "POSSDKTest2Scheme://")!
var money: SCCMoney?
do {
// Specify the amount of money to charge.
let todaysFeePennies = Int(1.00) * 100
money = try SCCMoney(amountCents: todaysFeePennies, currencyCode: "CAD")
} catch {
print("money conversion failed.")
}
let LoginID = "TestPatient"
squareTransDone = false
//log values used:
print("Initiating payment api request")
print("callback: \(callbackURL)")
print("money: \(money!)")
print("LoginID: TestPatient")
print("Creating payment api request")
SCCAPIRequest.setApplicationID("sq0idp-TbgQGqSrC84qkfcXSTntNg")
var request: SCCAPIRequest?
do
{
request =
try SCCAPIRequest(
callbackURL: callbackURL,
amount: money!,
userInfoString: LoginID,
locationID: "",
notes: "TestingSDK",
customerID: "tester2",
supportedTenderTypes: .all,
clearsDefaultFees: false,
returnsAutomaticallyAfterPayment: false,
disablesKeyedInCardEntry: false,
skipsReceipt: false
)
print("api initiating!")
try SCCAPIConnection.perform(request!)//Kaled says this does the api
} catch let error as NSError {
print("Error detected: \(error.localizedDescription)")
}//end API
print("End of payment api function.")
}//------------------------------------
}
I probably should have included screenshots of my dashboard under [email protected], to demonstrate that the URL scheme and the bundleID are correctly specified.
At this point I can see no reason why this problem should be happening.