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
OPPaymentMethodProtocolinstance with the provided parametersDeclaration
Swift
@objc(createPaymentMethodWithPaymentMethodParams:completion:) public func createPaymentMethod(with params: OPPaymentMethodParamsProtocol, completion: @escaping OPPaymentMethodCompletionBlock)Parameters
paramsThe
OPPaymentMethodParamsProtocolsupplied either by anOPPaymentCardDetailsVieworOPPaymentCardDetailsForm.completionThe callback to run with the returned
OPPaymentMethodProtocolinstance, or an error. -
Creates an
OPCvvUpdateTokenProtocolinstance with the provided parametersDeclaration
Swift
@objc(createCvvUpdateTokenWithTokenParams:completion:) public func createCvvUpdateToken(with params: OPCvvTokenParamsProtocol, completion: @escaping OPCvvTokenUpdateCompletionBlock)Parameters
paramsThe
OPCvvTokenParamsProtocolsupplied by anOPPaymentCardCvvView.completionThe callback to run with the returned
OPCvvUpdateTokenProtocolinstance, 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
Important
While this should be used in determining if an Apple Pay button can be displayed, it should not be the only determining factor. It is also important to determine whether a restaurant/vendor supports Apple Pay as a payment method, which can be determined using the Olo Ordering API.
Declaration
Swift
public func deviceSupportsApplePay() -> BoolReturn Value
trueif the device is currently able to make Apple Pay payments via one of the supported networks, orfalseif 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
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 -
The environment the SDK is configured for
Declaration
Swift
public internal(set) static var environment: OPEnvironment { get set }