OloPayAPI
@objc
public class OloPayAPI : NSObject, OloPayAPIProtocol
Represents the OloPayAPI and functionality related to it
Important
Prior to calling methods in this class be sure to initialize the SDK by callingOloPayApiInitializer.setup
-
Creates an
OPPaymentMethodinstance with the provided control.Warning
This method was deprecated in v1.0.2. Please usecreatePaymentMethod(with: OPPaymentMethodParams, completion: OPPaymentMethodCompletionBlock)Declaration
Swift
@available(swift, deprecated: 1.0, message: "Deprecated in Olo Pay SDK v1.0.2: Use createPaymentMethod(with: OPPaymentMethodParams, completion: OPPaymentMethodCompletionBlock﹚ instead.") @objc(createPaymentMethodWithPaymentForm:completion:) public func createPaymentMethod(with paymentForm: OPPaymentCardDetailsForm, completion: @escaping OPPaymentMethodCompletionBlock)Parameters
paymentFormThe
OPPaymentCardDetailsFormfrom the UI.completionThe callback to run with the returned
OPPaymentMethodinstance, or an error -
Creates an
OPPaymentMethodinstance with the provided control.Warning
This method was deprecated in v1.0.2. Please usecreatePaymentMethod(with: OPPaymentMethodParams, completion: OPPaymentMethodCompletionBlock)Declaration
Swift
@available(swift, deprecated: 1.0, message: "Deprecated in Olo Pay SDK v1.0.2: Use createPaymentMethod(with: OPPaymentMethodParams, completion: OPPaymentMethodCompletionBlock﹚ instead.") @objc(createPaymentMethodWithPaymentControl:completion:) public func createPaymentMethod(with paymentControl: OPPaymentCardDetailsView, completion: @escaping OPPaymentMethodCompletionBlock)Parameters
paymentControlThe
OPPaymentCardDetailsViewfrom the UIcompletionThe callback to run with the returned
OPPaymentMethodinstance, or an error. -
Creates an
OPPaymentMethodobject with provided parametersDeclaration
Swift
@available(swift, introduced: 1.0, message: "Introduced in Olo Pay SDK v1.0.2") @objc(createPaymentMethodWithPaymentMethodParams:completion:) public func createPaymentMethod(with params: OPPaymentMethodParamsProtocol, completion: @escaping OPPaymentMethodCompletionBlock)Parameters
paymentParametersThe
OPPaymentMethodParamssupplied either by anOPPaymentCardDetailsVieworOPPaymentCardDetailsForm.completionThe callback to run with the returned
OPPaymentMethodinstance, or an error. -
Whether or not this device can make Apple Pay payments via a supported card network Supported ApplePay card networks are: American Express, Visa, Mastercard, Discover
Declaration
Swift
@objc public func deviceSupportsApplePay() -> BoolReturn Value
YES if the device is currently able to make Apple Pay payments via one of the supported networks. NO if the user does not have a saved card of a supported type, or other restrictions prevent payment (such as parental controls).
-
A convenience method to build a
PKPaymentRequestwith sane default values.Important
OloPayApiInitializer.setup(...)must have been called with both the Apple Pay merchant id and company name prior to calling this methodDeclaration
Swift
@objc public func createPaymentRequest(forAmount amount: NSDecimalNumber, inCountry country: String = "US", withCurrency currency: String = "USD") throws -> PKPaymentRequestParameters
forAmountThe amount to charge
inCountryThe two-letter code for the payment country (Defaults to “US”)
withCurrencyThe three-letter code for the currency (Defaults to “USD”). ApplePay interprets the amounts provided by the summary items attached to this request as amounts in this currency.
Return Value
a
PKPaymentRequestwith proper default values
OloPayAPI Class Reference