PaymentSDK
Mobile payment SDK
WDCardField Class Reference

Field for collecting card data. More...

#import <WDCardField.h>

+ Inheritance diagram for WDCardField:
+ Collaboration diagram for WDCardField:

Public Instance Methods

(void) - clear
 Resets all of the contents of all of the fields. More...
 

Properties

IBOutlet id< WDCardFieldDelegatedelegate
 The receiver’s delegate. More...
 
WDCardcard
 Non-sensitive card data. More...
 
IBInspectable BOOL cardBrandHidden
 A Boolean value that determines whether the card brand icon is hidden. More...
 
WDCardPaymentcardPayment
 Payment object where card data are appended. More...
 
UIColorcursorColor
 The cursor color for the field. More...
 
IBInspectable UIFont * font
 The font used in each UITextField and number format UILabel. More...
 
UIKeyboardAppearance keyboardAppearance
 The keyboard appearance for the field. More...
 
WDLocale locale
 WDLocale enum used to localize. More...
 
IBInspectable UIColorplaceholderColor
 The text placeholder color used in each child field. More...
 
IBInspectable UIColortextColor
 The text color to be used when entering valid text. More...
 
IBInspectable UIColortextErrorColor
 The text color to be used when the user has entered invalid information, such as an invalid card number. More...
 
IBInspectable NSStringnumberPlaceholder
 The placeholder for the card number field. More...
 
IBInspectable NSStringexpirationMonthPlaceholder
 The placeholder for the expiration month field. More...
 
IBInspectable NSStringexpirationYearPlaceholder
 The placeholder for the expiration year field. More...
 
IBInspectable NSStringsecurityCodePlaceholder
 The placeholder for the security code field. More...
 
NSSet< NSNumber * > * supportedCardBrands
 Set of supported card brands. More...
 
BOOL valid
 Whether or not the field currently contains a valid card number, expiration date and security code. More...
 

Detailed Description

Field for collecting card data.

WDCardField is a field with similar properties to UITextField, but specialized for collecting card data. It manages multiple UITextFields under the hood to collect this data. It's designed to fit on a single line, and from a design perspective can be used anywhere a UITextField would be appropriate.

Method Documentation

- (void) clear

Resets all of the contents of all of the fields.

If the field is currently being edited, the number field will become selected.

Property Documentation

- (WDCard*) card
readwritenonatomiccopy

Non-sensitive card data.

It is convenient to set the data if you collect security code only. According [WDCard brand] security code is validated.

- (IBInspectable BOOL) cardBrandHidden
readwritenonatomicassign

A Boolean value that determines whether the card brand icon is hidden.

Default value is NO

- (WDCardPayment*) cardPayment
readwritenonatomicstrong

Payment object where card data are appended.

If [WDCardPayment token] is set WDCardField collects only security code. It clears user input.

- (UIColor*) cursorColor
readwritenonatomiccopy

The cursor color for the field.

This is a proxy for the view's tintColor property, exposed for clarity only (in other words, calling setCursorColor is identical to calling setTintColor).

- (IBOutlet id<WDCardFieldDelegate>) delegate
readwritenonatomicweak

The receiver’s delegate.

You can use the delegate to respond to the card data entered by the user

- (IBInspectable NSString*) expirationMonthPlaceholder
readwritenonatomiccopy

The placeholder for the expiration month field.

Defaults to localized "MM".

- (IBInspectable NSString*) expirationYearPlaceholder
readwritenonatomiccopy

The placeholder for the expiration year field.

Defaults to localized "YY".

- (IBInspectable UIFont*) font
readwritenonatomiccopy

The font used in each UITextField and number format UILabel.

Default is [UIFont fontWithName:"Menlo-Regular" size:15.0]. Set this property to nil to reset to the default. Monospace fonts are preferred as during number typing number format does not change width.

- (UIKeyboardAppearance) keyboardAppearance
readwritenonatomicassign

The keyboard appearance for the field.

Default is UIKeyboardAppearanceDefault.

- (WDLocale) locale
readwritenonatomicassign

WDLocale enum used to localize.

Localization of WDCardField happens in following order:

  • overriden WDCardField value (e.g. [WDCardField numberPlaceholder], etc.)
  • localized default value by [WDCardField locale]
  • localized default value by [NSLocale preferredLanguages]
  • if locale is not set or localization files are missing default english value is used.
- (IBInspectable NSString*) numberPlaceholder
readwritenonatomiccopy

The placeholder for the card number field.

Default is localized "Credit Card Number".

- (IBInspectable UIColor*) placeholderColor
readwritenonatomiccopy

The text placeholder color used in each child field.

Default is [UIColor lightGrayColor]. Set this property to nil to reset to the default.

- (IBInspectable NSString*) securityCodePlaceholder
readwritenonatomiccopy

The placeholder for the security code field.

Defaults to "CVC".

- (NSSet<NSNumber *>*) supportedCardBrands
readwritenonatomiccopy

Set of supported card brands.

If supportedCardBrands is set and does not contain recognized card brand of user card number the state changes to WDCardFieldStateCardUnsupported. Set can contain NSNumbers with WDCardBrand values. Example:

cardField.supportedCardBrands = [NSSet setWithObjects:@(WDCardBrandAmex), @(WDCardBrandMasterCard), @(WDCardBrandVisa), nil];

- (IBInspectable UIColor*) textColor
readwritenonatomiccopy

The text color to be used when entering valid text.

Default is [UIColor blackColor]. Set this property to nil to reset to the default.

- (IBInspectable UIColor*) textErrorColor
readwritenonatomiccopy

The text color to be used when the user has entered invalid information, such as an invalid card number.

Default is [UIColor redColor]. Set this property to nil to reset to the default.

- (BOOL) valid
readnonatomicassign

Whether or not the field currently contains a valid card number, expiration date and security code.