OPPPaymentParams

@interface OPPPaymentParams : NSObject

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

  • Creates an object representing a payment transaction.

    Declaration

    Objective-C

    + (nullable instancetype)
        paymentParamsWithCheckoutID:(nonnull NSString *)checkoutID
                       paymentBrand:(nullable NSString *)paymentBrand
                              error:(NSError *_Nullable *_Nullable)error;

    Parameters

    checkoutID

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

    paymentBrand

    The payment brand of the transaction.

    error

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

    Return Value

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

  • Creates an object representing a payment transaction.

    Declaration

    Objective-C

    - (nullable instancetype)initWithCheckoutID:(nonnull NSString *)checkoutID
                                   paymentBrand:(nullable NSString *)paymentBrand
                                          error:
                                              (NSError *_Nullable *_Nullable)error;

    Swift

    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.

    error

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

    Return Value

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

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

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull checkoutID;

    Swift

    var checkoutID: String { get }
  • The payment brand of the transaction.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull paymentBrand;

    Swift

    var paymentBrand: String { get }
  • This URL will receive the result of an asynchronous payment. Must be sent URL encoded.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *shopperResultURL;

    Swift

    var shopperResultURL: String? { get set }
  • Dictionary of custom parameters that will be sent to the server.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSDictionary<NSString *, NSString *> *_Nonnull customParams;

    Swift

    var customParams: [String : String] { get }
  • Method to add parameter that will be sent to the server.

    Declaration

    Objective-C

    - (BOOL)addParamWithName:(nonnull NSString *)name
                       value:(nonnull NSString *)value;

    Swift

    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 YES if name and value are valid and parameter is successfully saved, otherwise NO.

  • Method to remove record from the dictionary of parameters.

    Declaration

    Objective-C

    - (void)removeParamWithName:(nonnull NSString *)name;

    Swift

    func removeParam(withName name: String)

    Parameters

    name

    Parameter name.

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

    Declaration

    Objective-C

    - (void)mask;

    Swift

    func mask()