OPPCardPaymentParams

@interface OPPCardPaymentParams : OPPBaseCardPaymentParams

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

It offers сonvenience methods for checking if the number is valid, i.e. if it passes the Luhn check and can be assigned to one of the major card companies.

After getting an authorization for the transaction the parameters are masked in accordance to PCI PA DSS requirements.

  • Creates an object representing a card transaction.

    Declaration

    Objective-C

    + (nullable instancetype)
        cardPaymentParamsWithCheckoutID:(nonnull NSString *)checkoutID
                           paymentBrand:(nullable NSString *)paymentBrand
                                 holder:(nullable NSString *)holder
                                 number:(nonnull NSString *)number
                            expiryMonth:(nullable NSString *)expiryMonth
                             expiryYear:(nullable NSString *)expiryYear
                                    CVV:(nullable NSString *)CVV
                                  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 card.

    holder

    The name of the card holder.

    number

    The card number of the transaction.

    expiryYear

    The expiration year. It is expected in the format YYYY.

    expiryMonth

    The expiration month of the card. It is expected in the format MM.

    CVV

    The CVV code associated with the card. Set to nil if CVV is not required.

    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 card transaction, and nil if parameters are invalid.

  • Creates an object representing a card transaction without specifying a brand. Use it only with BIP settings ‘automatic brand detection’ activated.

    Declaration

    Objective-C

    + (nullable instancetype)
        cardPaymentParamsWithCheckoutID:(nonnull NSString *)checkoutID
                                 holder:(nullable NSString *)holder
                                 number:(nonnull NSString *)number
                            expiryMonth:(nullable NSString *)expiryMonth
                             expiryYear:(nullable NSString *)expiryYear
                                    CVV:(nullable NSString *)CVV
                                  error:(NSError *_Nullable *_Nullable)error;

    Swift

    convenience init(checkoutID: String, holder: String?, number: String, expiryMonth: String?, expiryYear: String?, cvv CVV: String?) throws

    Parameters

    checkoutID

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

    holder

    The name of the card holder.

    number

    The card number of the transaction.

    expiryYear

    The expiration year. It is expected in the format YYYY.

    expiryMonth

    The expiration month of the card. It is expected in the format MM.

    CVV

    The CVV code associated with the card. Set to nil if CVV is not required.

    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 card transaction, and nil if parameters are invalid.

  • Creates an object representing a card transaction.

    Declaration

    Objective-C

    - (nullable instancetype)initWithCheckoutID:(nonnull NSString *)checkoutID
                                   paymentBrand:(nullable NSString *)paymentBrand
                                         holder:(nullable NSString *)holder
                                         number:(nonnull NSString *)number
                                    expiryMonth:(nullable NSString *)expiryMonth
                                     expiryYear:(nullable NSString *)expiryYear
                                            CVV:(nullable NSString *)CVV
                                          error:
                                              (NSError *_Nullable *_Nullable)error;

    Swift

    init(checkoutID: String, paymentBrand: String?, holder: String?, number: String, expiryMonth: String?, expiryYear: String?, cvv CVV: String?) throws

    Parameters

    checkoutID

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

    paymentBrand

    The payment brand of the card.

    holder

    The name of the cardholder.

    number

    The card number of the transaction.

    expiryYear

    The expiration year. It is expected in the format YYYY.

    expiryMonth

    The expiration month of the card. It is expected in the format MM.

    CVV

    The CVV code associated with the card. Set to nil if CVV is not required.

    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 card transaction, and nil if parameters are invalid.

  • Holder of the card account. The length must be greater than 3 characters and less then 128 character.

    Declaration

    Objective-C

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

    Swift

    var holder: String { get }
  • The card number. It may contain spaces " " and dashes "-".

    Declaration

    Objective-C

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

    Swift

    var number: String { get }
  • The card expiry month in the format MM.

    Declaration

    Objective-C

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

    Swift

    var expiryMonth: String { get }
  • The card expiry year in the format YYYY.

    Declaration

    Objective-C

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

    Swift

    var expiryYear: String { get }
  • The customer’s country code.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull countryCode;

    Swift

    var countryCode: String { get set }
  • The customer’s mobile number.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull mobilePhone;

    Swift

    var mobilePhone: String { get set }
  • Default is NO. If YES, the payment information will be stored for future use.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isTokenizationEnabled) BOOL tokenizationEnabled;

    Swift

    var isTokenizationEnabled: Bool { get set }
  • The customer’s billing address.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) OPPBillingAddress *address;

    Swift

    var address: OPPBillingAddress? { get set }
  • Checks if the holder name is filled with sufficient data to perform a transaction.

    Declaration

    Objective-C

    + (BOOL)isHolderValid:(nonnull NSString *)holder;

    Swift

    class func isHolderValid(_ holder: String) -> Bool

    Parameters

    holder

    Holder of the card account.

    Return Value

    YES if the holder name length greater than 3 characters and less than 128 character.

  • Checks if the card number is filled with sufficient data to perform a transaction.

    Declaration

    Objective-C

    + (BOOL)isNumberValid:(nonnull NSString *)number luhnCheck:(BOOL)luhnCheck;

    Swift

    class func isNumberValid(_ number: String, luhnCheck: Bool) -> Bool

    Parameters

    number

    Card number.

    luhnCheck

    Set to YES if number should pass Luhn test http://en.wikipedia.org/wiki/Luhn_algorithm.

    Return Value

    YES if the number consists of 10-19 digits and passes luhn test, NO if it doesn’t.

  • Checks if the card expiry month is filled with sufficient data to perform a transaction.

    Declaration

    Objective-C

    + (BOOL)isExpiryMonthValid:(nonnull NSString *)expiryMonth;

    Swift

    class func isExpiryMonthValid(_ expiryMonth: String) -> Bool

    Parameters

    expiryMonth

    The expiry month of the card.

    Return Value

    YES if the card expiry month is in the format MM.

  • Checks if the card expiry year is filled with sufficient data to perform a transaction.

    Declaration

    Objective-C

    + (BOOL)isExpiryYearValid:(nonnull NSString *)expiryYear;

    Swift

    class func isExpiryYearValid(_ expiryYear: String) -> Bool

    Parameters

    expiryYear

    The expiry year of the card.

    Return Value

    YES if the card expiry year is in the format YYYY.

  • Checks if the country code is filled with sufficient data to perform a transaction.

    Declaration

    Objective-C

    + (BOOL)isCountryCodeValid:(nonnull NSString *)countryCode;

    Swift

    class func isCountryCodeValid(_ countryCode: String) -> Bool

    Parameters

    countryCode

    The country code.

    Return Value

    YES if the country code contains digits only.

  • Checks if the mobile phone is filled with sufficient data to perform a transaction.

    Declaration

    Objective-C

    + (BOOL)isMobilePhoneValid:(nonnull NSString *)mobilePhone;

    Swift

    class func isMobilePhoneValid(_ mobilePhone: String) -> Bool

    Parameters

    mobilePhone

    The mobile phone number.

    Return Value

    YES if the mobile phone number contains digits only.

  • Checks if the month and year have been set and whether or not card is expired.

    Declaration

    Objective-C

    + (BOOL)isExpiredWithExpiryMonth:(nonnull NSString *)month
                             andYear:(nonnull NSString *)year;

    Swift

    class func isExpired(withExpiryMonth month: String, andYear year: String) -> Bool

    Parameters

    month

    The expiry month of the card.

    year

    The expiry year of the card.

    Return Value

    YES if the month or the year is expired. NO if the card is not expired yet.