OPPPaymentProvider

@objc
public final class OPPPaymentProvider : NSObject
extension OPPPaymentProvider: OPPSThreeDSManagerDelegate

Defines the methods and properties of the payment provider. Use the factory method +paymentProviderWithMode: to instantiate a new provider.

  • Determines the type of Server to use. Transactions to the LIVE server come with fees attached.

    Declaration

    Swift

    @objc
    public var mode: OPPProviderMode
  • Delegate for processing the 3-D Secure transaction.

    Declaration

    Swift

    @objc
    public weak var threeDSEventListener: OPPThreeDSEventListener?
  • Instance method to obtain a new provider.

    Declaration

    Swift

    @objc
    public init(mode: OPPProviderMode)

    Parameters

    mode

    Determines the type of Server to use. Transactions to the LIVE server come with fees attached.

    Return Value

    An OPPPaymentProvider which can be used to process transactions.

  • Factory method to obtain a new provider.

    Declaration

    Swift

    @objc
    public static func paymentProviderWithMode(_ mode: OPPProviderMode) -> OPPPaymentProvider

    Parameters

    mode

    Determines the type of Server to use. Transactions to the LIVE server come with fees attached.

    Return Value

    An OPPPaymentProvider which can be used to process transactions.

  • On sending a transaction, it is performed asynchronously using an NSURLSession to communicate with the Server. Depending on the endpoint the transaction will be submitted or registered only without making the payment.

    Declaration

    Swift

    @objc(sendTransaction:toEndpoint:completionHandler:)
    public func send(_ transaction: OPPTransaction, toEndpoint endpoint: String, completionHandler: @escaping (OPPTransaction, (any Error)?) -> Void)

    Parameters

    transaction

    The transaction to be sent.

    endpoint

    The endpoint which will be used for processing transaction. The endpoint must start with a "/".

    completionHandler

    A block executed when the transaction is sent.

  • On sending a transaction, it is performed asynchronously using an NSURLSession to communicate with the Server. Depending on the endpoint the transaction will be submitted or registered only without making the payment.

    Declaration

    Swift

    public func send(_ transaction: OPPTransaction, toEndpoint endpoint: String) async throws -> OPPTransaction

    Parameters

    transaction

    The transaction to be sent.

    endpoint

    The endpoint which will be used for processing transaction. The endpoint must start with a "/".

    Return Value

    The transaction with its response applied.

  • On submitting a transaction, it is performed asynchronously using an NSURLSession to communicate with the Server. Depending on the concrete type of the transaction, various calls to the server are necessary to ensure proper processing. Submitting means that the transaction is sent to the server, where it will cause a debit of the given amount on the account specified in the OPPTransaction‘s OPPPaymentParams.

    Declaration

    Swift

    @objc
    public func submitTransaction(_ transaction: OPPTransaction, completionHandler: @escaping (OPPTransaction, (any Error)?) -> Void)

    Parameters

    transaction

    The transaction to be submitted.

    completionHandler

    A block executed when the transaction is submitted.

  • On submitting a transaction, it is performed asynchronously using an NSURLSession to communicate with the Server. Depending on the concrete type of the transaction, various calls to the server are necessary to ensure proper processing. Submitting means that the transaction is sent to the server, where it will cause a debit of the given amount on the account specified in the OPPTransaction‘s OPPPaymentParams.

    Declaration

    Swift

    public func submitTransaction(_ transaction: OPPTransaction) async throws -> OPPTransaction

    Parameters

    transaction

    The transaction to be submitted.

    Return Value

    The transaction with its response applied.

  • On storing a payment data, it is performed asynchronously using an NSURLSession to communicate with the Server. The method creates a just registration separate from any later payment.

    Declaration

    Swift

    @objc(registerTransaction:completionHandler:)
    public func register(_ transaction: OPPTransaction, completionHandler: @escaping (OPPTransaction, (any Error)?) -> Void)

    Parameters

    transaction

    The transaction to be registered.

    completionHandler

    A block executed when the transaction is registered.

  • On storing a payment data, it is performed asynchronously using an NSURLSession to communicate with the Server. The method creates a just registration separate from any later payment.

    Declaration

    Swift

    public func register(_ transaction: OPPTransaction) async throws -> OPPTransaction

    Parameters

    transaction

    The transaction to be registered.

    Return Value

    The transaction with its response applied.

  • Requests checkout details such as amount, currency and tokens from the Server by checkout ID. Request is performed asynchronously using an NSURLSession.

    Declaration

    Swift

    @objc
    public func requestCheckoutInfo(withCheckoutID checkoutID: String, completionHandler: @escaping (OPPCheckoutInfo?, (any Error)?) -> Void)

    Parameters

    checkoutID

    The checkout ID of a transaction.

    completionHandler

    The completion block will be invoked once the response in received. On success, you will receive an instance of OPPCheckoutInfo; on failure, an error.

  • Requests checkout details such as amount, currency and tokens from the Server by checkout ID. Request is performed asynchronously using an NSURLSession.

    Declaration

    Swift

    public func requestCheckoutInfo(withCheckoutID checkoutID: String) async throws -> OPPCheckoutInfo

    Parameters

    checkoutID

    The checkout ID of a transaction.

    Return Value

    An instance of OPPCheckoutInfo.

  • Requests logo URLs for specified payment brands. Request is performed asynchronously using an NSURLSession.

    Declaration

    Swift

    @objc
    public func requestLogoURLs(forPaymentBrands paymentBrands: [String], completionHandler: @escaping ([String : URL]?, (any Error)?) -> Void)

    Parameters

    paymentBrands

    The list of payment brands to get logos from the Server.

    completionHandler

    The completion block will be invoked once the response in received. On success, you will receive a dictionary with URLs in format <paymentBrand: URL>; on failure, an error.

  • Requests logo URLs for specified payment brands. Request is performed asynchronously using an NSURLSession.

    Declaration

    Swift

    public func requestLogoURLs(forPaymentBrands paymentBrands: [String]) async throws -> [String : URL]

    Parameters

    paymentBrands

    The list of payment brands to get logos from the Server.

    Return Value

    A dictionary with URLs in format <paymentBrand: URL>.

  • Note

    If you are using core SDK, please request checkout info by calling -[OPPPaymentProvider requestCheckoutInfoWithCheckoutID:completionHandler:] before requestBinInfo call. Checkout info call is essential part of the flow, error will be thrown otherwise.

    Declaration

    Swift

    @objc
    public func requestBinInfo(withCheckoutID checkoutID: String, bin: String, completionHandler: @escaping (OPPBinInfo?, (any Error)?) -> Void)

    Parameters

    checkoutID

    The checkout ID of a transaction.

    bin

    First 6 or more digits of the card number.

    completionHandler

    The completion block will be invoked once the response in received. On success, you will receive an instance of OPPBinInfo; on failure, an error.

  • Note

    If you are using core SDK, please request checkout info by calling -[OPPPaymentProvider requestCheckoutInfoWithCheckoutID:completionHandler:] before requestBinInfo call. Checkout info call is essential part of the flow, error will be thrown otherwise.

    Declaration

    Swift

    public func requestBinInfo(withCheckoutID checkoutID: String, bin: String) async throws -> OPPBinInfo

    Parameters

    checkoutID

    The checkout ID of a transaction.

    bin

    First 6 or more digits of the card number.

    Return Value

    An instance of OPPBinInfo.

  • Requests a list of iDeal banks.

    This method is deprecated.

    Declaration

    Swift

    @available(*, deprecated)
    @objc
    public func requestIdealBanks(withCheckoutID checkoutID: String, completionHandler: @escaping ([[AnyHashable : Any]]?, (any Error)?) -> Void)

    Parameters

    checkoutID

    The checkout ID of a transaction.

    completionHandler

    The completion block which will be invoked once the response is received. On success, you will receive a list of banks in array, and on failure an error is received.

  • The ipworks3ds SDK performs security checks in order to provide a list of Warning objects. These can be checked by the app to determine whether or not to proceed with the checkout process.

    Declaration

    Swift

    @objc
    public func securityWarnings(completionHandler: @escaping ([Warning]?, (any Error)?) -> Void)

    Parameters

    completionHandler

    The completion block will be invoked once the performing of security checks is done . On success, you will receive an instance of Warning; on failure, an error.

  • The ipworks3ds SDK performs security checks in order to provide a list of Warning objects. These can be checked by the app to determine whether or not to proceed with the checkout process.

    Declaration

    Swift

    public func securityWarnings() async throws -> [Warning]

    Return Value

    An instance of Warning.

  • Requests a Apple’s recurring payments tokenId.

    Declaration

    Swift

    @objc
    public func requestApplesTokenId(withCheckoutID checkoutID: String, completionHandler: @escaping (String?, (any Error)?) -> Void)

    Parameters

    checkoutID

    The checkout ID of a transaction.

    completionHandler

    The completion block which will be invoked once the response is received. On success, you will receive a tokenId, and on failure an error is received.

  • Requests a Apple’s recurring payments tokenId.

    Declaration

    Swift

    public func requestApplesTokenId(withCheckoutID checkoutID: String) async throws -> String

    Parameters

    checkoutID

    The checkout ID of a transaction.

    Return Value

    A tokenId.

  • Determine whether this device can process Apple Pay payment requests using specific payment request. Your application should confirm that the user can make payments before attempting to authorize a payment. Your application may also want to alter its appearance or behavior when the user is not allowed to make payments.

    Declaration

    Swift

    @objc
    public static func canSubmitPaymentRequest(_ request: PKPaymentRequest) -> Bool

    Parameters

    request

    The return value of this method depends on the supportedNetworks property of this payment request.

    Return Value

    YES if the user can authorize payments on this device using the payment request. NO if the user cannot authorize payments on these networks or if the user is restricted from authorizing payments, or if paymentSummaryItems is empty or its last item’s amount is not positive.

  • Whether or not this device is capable of using Apple Pay. This checks both whether the user is running an iPhone 6/6+ or later, iPad Air 2 or later, or iPad mini 3 or later, as well as whether or not they have stored any cards in Apple Pay on their device.

    Declaration

    Swift

    @objc
    public static func deviceSupportsApplePay() -> Bool

    Return Value

    Whether or not the user is currently able to pay with Apple Pay.

  • A convenience method to return a PKPaymentRequest with sane default values. You will still need to configure the paymentSummaryItems property to indicate what the user is purchasing.

    Declaration

    Swift

    @objc(paymentRequestWithMerchantIdentifier:countryCode:)
    public static func paymentRequest(withMerchantIdentifier merchantIdentifier: String, countryCode: String) -> PKPaymentRequest

    Parameters

    merchantIdentifier
    countryCode

    The merchant’s ISO country code. We suggest using the country where your business is located.

    Return Value

    A PKPaymentRequest with proper default values.

  • A convenience method to check if Touch ID, Face ID or passcode are set on user device.

    Declaration

    Swift

    @objc
    public static func isDeviceAuthenticationAvailable() -> Bool

    Return Value

    NO if neither Touch ID/Face ID nor passcode are set, otherwise YES.

  • Returns the list of FPX banks as a dictionary. Key from the dictionary will be banks display name and bank name will be value for that key.

    Declaration

    Swift

    @objc
    public static func getFPXBanks() -> [String : String]

    Return Value

    A dictionary of FPX payment bank names where key will be banks display name and its value will be bank name.

  • Requests a Checkout payment data

    Declaration

    Swift

    @objc
    public func requestCheckoutData(withCheckoutID checkoutID: String, completionHandler: @escaping (OPPCheckoutData?, (any Error)?) -> Void)

    Parameters

    checkoutID

    The checkout ID of a transaction.

    completionHandler

    The completion block which will be invoked once the response is received. On success, you will receive an OPPCheckoutData ojbect with payment data, and on failure an error is received.

  • Requests a Checkout payment data

    Declaration

    Swift

    public func requestCheckoutData(withCheckoutID checkoutID: String) async throws -> OPPCheckoutData

    Parameters

    checkoutID

    The checkout ID of a transaction.

    Return Value

    An OPPCheckoutData object with payment data.