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 calling OloPayApiInitializer.setup
  • Creates an OPPaymentMethod instance with the provided control.

    Warning

    This method was deprecated in v1.0.2. Please use createPaymentMethod(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

    paymentForm

    The OPPaymentCardDetailsForm from the UI.

    completion

    The callback to run with the returned OPPaymentMethod instance, or an error

  • Creates an OPPaymentMethod instance with the provided control.

    Warning

    This method was deprecated in v1.0.2. Please use createPaymentMethod(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

    paymentControl

    The OPPaymentCardDetailsView from the UI

    completion

    The callback to run with the returned OPPaymentMethod instance, or an error.

  • Creates an OPPaymentMethod object with provided parameters

    Declaration

    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

    paymentParameters
    completion

    The callback to run with the returned OPPaymentMethod instance, 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() -> Bool

    Return 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 PKPaymentRequest with sane default values.

    Important

    OloPayApiInitializer.setup(...) must have been called with both the Apple Pay merchant id and company name prior to calling this method

    Declaration

    Swift

    @objc
    public func createPaymentRequest(forAmount amount: NSDecimalNumber, inCountry country: String = "US", withCurrency currency: String = "USD") throws -> PKPaymentRequest

    Parameters

    forAmount

    The amount to charge

    inCountry

    The two-letter code for the payment country (Defaults to “US”)

    withCurrency

    The 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 PKPaymentRequest with proper default values