SQRDReaderSDK
@interface SQRDReaderSDK : NSObject
Manages initialization and authorization for Reader SDK.
Warning
You must initialize Reader SDK before attempting any other operation.Warning
All methods on this class must be called from the main thread.See
SQRDReaderSettingsControllerSee
SQRDCheckoutController-
Initializes Reader SDK. Call this method from the
application:didFinishLaunchingWithOptions:method in your app delegate.Warning
You must initialize Reader SDK before attempting any other operation, or your app will crash.Declaration
Objective-C
+ (void)initializeWithApplicationLaunchOptions: (nullable NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions;Swift
class func initialize(applicationLaunchOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -
The Reader SDK singleton. Use this to authorize and deauthorize Reader SDK to accept payments on behalf of a Square seller account.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nonnull, class) SQRDReaderSDK *sharedSDK;Swift
class var shared: SQRDReaderSDK { get } -
Returns the location of the authorized Square seller account if Reader SDK is authorized; otherwise,
nil.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) SQRDLocation *authorizedLocation;Swift
var authorizedLocation: SQRDLocation? { get }
-
Authorize the SDK with a mobile authorization code.
Declaration
Objective-C
- (void)authorizeWithCode:(nonnull NSString *)code completionHandler:(nonnull SQRDAuthorizationHandler)completionHandler;Swift
func authorize(withCode code: String, completionHandler: @escaping SQRDAuthorizationHandler)Parameters
codeThe mobile authorization code used to authorize the SDK for a Square merchant.
completionHandlerThe completion handler to be called upon success or failure of the authorization attempt.
-
Returns
trueif Reader SDK is currently authorized to accept payments on behalf of a Square seller account; otherwise,false.Declaration
Objective-C
@property (readonly, nonatomic) BOOL isAuthorized;Swift
var isAuthorized: Bool { get } -
Returns
trueif a Reader SDK authorization is in progress,falseotherwise.Declaration
Objective-C
@property (readonly, nonatomic) BOOL isAuthorizationInProgress;Swift
var isAuthorizationInProgress: Bool { get }
-
Deauthorize the SDK.
Note
Deauthorization may fail if there are pending uploads that need to be completed (for instance, uploading a payment to Square). You can always check if deauthorization is possible by checking thecanDeauthorizeproperty on the SDK singleton.Declaration
Objective-C
- (void)deauthorizeWithCompletionHandler: (nonnull SQRDDeauthorizationHandler)completionHandler;Swift
func deauthorize(completionHandler: @escaping SQRDDeauthorizationHandler)Parameters
completionHandlerThe completion handler to be called upon success or failure of the deauthorization attempt.
-
Returns
trueif Reader SDK is currently authorized and there are no pending uploads; otherwise,false. Deauthorization fails if there are asynchronous payments recorded on the device that have not been uploaded to Square servers. This can happen when the device is having network connection issues.Declaration
Objective-C
@property (readonly, nonatomic) BOOL canDeauthorize;Swift
var canDeauthorize: Bool { get }
SQRDReaderSDK Class Reference