OPPPaymentParams

@objc
public class OPPPaymentParams : NSObject, NSCopying

Class to represent a set of parameters needed for performing an e-commerce transaction.

  • A property that can be set with a value from initial checkout request (mandatory). This value is required in the next steps.

    Declaration

    Swift

    @objc
    public private(set) var checkoutID: String { get }
  • The payment brand of the transaction.

    Declaration

    Swift

    @objc
    public private(set) var paymentBrand: String { get }
  • This URL will receive the result of an asynchronous payment. Must be sent URL encoded.

    Declaration

    Swift

    @objc
    public var shopperResultURL: String?
  • To get or set the mode of payment.

    Declaration

    Swift

    @objc
    public var mode: OPPProviderMode
  • Creates an object representing a payment transaction.

    Throws

    Error The error that occurred while validating payment parameters. See code attribute (OPPErrorCode) and NSLocalizedDescription to identify the reason of failure.

    Declaration

    Swift

    @objc
    public init(checkoutID: String,
                paymentBrand: String?) throws

    Parameters

    checkoutID

    The checkout ID of the transaction. Must be not nil or empty.

    paymentBrand

    The payment brand of the transaction.

    Return Value

    Returns an object representing a payment transaction, and nil if parameters are invalid.

  • Creates an object representing a payment transaction.

    Throws

    Error The error that occurred while validating payment parameters. See code attribute (OPPErrorCode) and NSLocalizedDescription to identify the reason of failure.

    Declaration

    Swift

    @objc
    public static func paymentParams(checkoutID: String,
                                     paymentBrand: String?) throws -> OPPPaymentParams

    Parameters

    checkoutID

    The checkout ID of the transaction. Must be not nil or empty.

    paymentBrand

    The payment brand of the transaction.

    Return Value

    Returns an object representing a payment transaction, and nil if parameters are invalid.

  • Method to add parameter that will be sent to the server.

    Declaration

    Swift

    @discardableResult
    @objc
    public func addParam(withName name: String,
                         value: String) -> Bool

    Parameters

    name

    Parameter name, expected string that matches regex [0-9a-zA-Z._\[\]]{3,64}.

    value

    Any string no longer than 2048 characters.

    Return Value

    Returns true if name and value are valid and parameter is successfully saved, otherwise false.

  • Method to remove record from the dictionary of parameters.

    Declaration

    Swift

    @objc
    public func removeParam(withName name: String)

    Parameters

    name

    Parameter name.

  • Helper method to mask sensitive payment details such as card number, CVV and etc.

    Declaration

    Swift

    @objc
    public func mask()