Classes
The following classes are available globally.
- 
                  
                  Represents the OloPayAPI and functionality related to it See moreImportant Prior to calling methods in this class be sure to initialize the SDK by callingOloPayApiInitializer.setup(...)DeclarationSwift @objc public class OloPayAPI : NSObject, OloPayAPIProtocol
- 
                  
                  Class to set up and initialize the Olo Pay API See moreDeclarationSwift @objc public class OloPayApiInitializer : NSObject, OloPayApiInitializerProtocol
- 
                  
                  Configuration paramaters required for setting up ApplePay See moreDeclarationSwift @objc public class OPApplePayConfiguration : NSObject
- 
                  
                  A helper class that implements and simplifies ApplePay. Use of this class looks like this: - Create an instance of this class
- Create instances of OPApplePayConfigurationandOPApplePayLauncherDelegateand update theconfigurationanddelegateproperties of this class
- Create a button for ApplePay and connect it to a click handler
- Enable/Disable or Hide/Show the ApplePay button by calling OPApplePayLauncher.canMakePayments()
- In the click handler, call OPApplePayLauncher.present()to present the Apple Pay sheet and begin the payment process
- Implement OPApplePayLauncherDelegate.paymentMethodCreated(...)to submit the basket to Olo’s Ordering API
- Optionally implement OPApplePayLauncherDelegate.applePayDismissed(...)to handle success and error states when the ApplePay sheet is dimissed
 Warning OPApplePayLauncher needs to be created as a class member variable rather than a variable with function scope or else it can becomenilwhile the ApplePay sheet is presented and callback methods won’t get calledExample Implementation 
 See moreclass ViewController: UIViewController, OPApplePayLauncherDelegate { // This needs to be a class member variable or it can go out of // scope during the ApplePay flow and become nil, preventing callbacks // from executing var _applePayLauncher: OPApplePayLauncherProtocol required init() { _applePayLauncher = OPApplePayLauncher() super.init() _applePayLauncher.delegate = self _applePayLauncher.configuration = OPApplePayConfiguration( merchantId: "merchant.com.your.applepay.id", companyLabel: "Your Company Name" ) } // Called when user taps on ApplePay button to begin ApplePay flow func submitApplePay() { // To allow mocking this check, it could instead be called like this: // type(of: _applePayLauncher).canMakePayments() guard OPApplePayLauncher.canMakePayments() else { return } do { let amount: NSDecimalNumber = 1.23 try _applePayLauncher?.present(for: amount) { // Optional logic for when the ApplePay flow is displayed } } catch { // Handle error conditions. See docs for `OPApplePayLauncher.present()` for more information } } func paymentMethodCreated(from launcher: OPApplePayLauncherProtocol, with paymentMethod: OPPaymentMethod) -> NSError? { // Use the payment method to submit the basket to Olo's Ordering API (the basket id can be retrieved with `launcher.basketId` // If the API returns an error, return that error. If the API call is successful, return nil } func applePayDismissed(from launcher: OPApplePayLauncherProtocol, with status: OPPaymentStatus, error: Error?) { // This is called after the payment sheet has been dismissed // Use the status and error parameters to determine if payment was successful } }DeclarationSwift @available(iOSApplicationExtension, unavailable) @available(macCatalystApplicationExtension, unavailable) @objc public class OPApplePayLauncher : NSObject, PKPaymentAuthorizationControllerDelegate, OPApplePayLauncherProtocol
- 
                  
                  Convenience view for gathering CVV details from a user See moreImportant CVV details are intentionally restricted for PCI complianceDeclarationSwift @objc public class OPPaymentCardCvvView : UIView, UIKeyInput, OPPaymentCardCvvTextFieldDelegate, OPValidStateChangedDelegate
- 
                  
                  Convenience multi-field form for collecting card details from a user See moreImportant Card details are intentionally restricted for PCI complianceDeclarationSwift @objc public class OPPaymentCardDetailsForm : UIView, STPCardFormViewDelegate
- 
                  
                  Convenience view for gathering card details from a user. See moreImportant Card details are intentionally restricted for PCI complianceDeclarationSwift @objc public class OPPaymentCardDetailsView : UIView, UIKeyInput, OPPaymentCardDetailsViewInternalDelegate, OPValidStateChangedDelegate
- 
                  
                  Error class for all OloPay-pecific errors Errors will come back as either ErrororNSErrorinstances. To get an instance of this class just check that it is the correct type and cast toOPError.
 See morefunc someMethod(error: Error?) { if let opError = error as? OPError { //Do something with the error } }DeclarationSwift @objc public class OPError : NSError
- 
                  
                  Default error messages used by See moreOPPaymentCardDetailsViewDeclarationSwift @objc public class OPStrings : NSObject
 Classes  Reference
        Classes  Reference