Many people still use traditional payment methods like cash and credit cards. However, the prevalence of card-free transactions has led to a fall in demand for these methods. Meanwhile, mobile devices have become an integral part of our lives that we rely on them more than ever before. This article will discuss how Apple Pay, one such app/service can be improved with minimal effort by leveraging blockchain technology and its ability to share data securely online

Apple is finally getting into the payments game with their new payment card UI. Although they are still taking cues from their competitors, it’s an important piece in Apple’s plan to integrate more digital services into users’ lives.This is the first in a series of posts that will discuss how to build payment card user interfaces for iOS apps.

The “credit card checkout form ui design” is a payment card UI and validator for iOS. It allows users to enter credit card information, with the option of displaying a confirmation screen with a receipt. The app also includes a built-in timer that will automatically close the window after a certain amount of time.

Description

Caishen offers a simple text field for asking users for credit card details and validating their answers. It accomplishes the same goal as PaymentKit, except it’s a stand-alone framework built completely in Swift. Caishen also makes it simple to integrate with third-party frameworks like CardIO.

Requirements

Installation

CocoaPods

Caishen may be found on CocoaPods. Simply add the following line to your Podfile to install it:

“Caishen” pod

Carthage

Caishen may be found in Carthage. Simply add the following line to your Cartfile to activate it:

“prolificinteractive/Caishen” on github

Usage

Example

Clone the repo and run pod install from the Example directory to start the example project.


Throughout your project

To add a text box to a display for inputting card data, either…

  • …in InterfaceBuilder, add a UITextField to your view and modify its class to CardTextField (when using InterfaceBuilder)
  • … or call one of the CardTextField’s initializers (when instantiating from code):
    • init? (aDecoder: NSCoder) (coder: aDecoder: aDecoder: aDecoder: aDe
    • start (frame: CGRect)

Confirm to the protocol CardTextFieldDelegate set the view controller as cardTextFieldDelegate for the text field to receive updates about inserted card information on your view controller:

class @IBOutlet weak var MyViewController: UIViewController, CardTextFieldDelegate cardTextField: What exactly is a cardTextField? override viewDidLoad func () cardTextField?.cardTextFieldDelegate = self; cardTextField?.cardTextFieldDelegate = self; cardTextField?.cardTextFieldDelegate = self; cardTextField(_ cardTextField: CardTextField, didEnterCard); func cardTextField(_ cardTextField: CardTextField); func cardTextField(_ cardTextFi Detailed information: ValidationResult: CardValidationResult) Card, withValidationResult) Card, withValidationResult) Card, withValidationResult) Card, withVali If validationResult == CardValidationResult.Valid, a valid card has been input. cardTextField: CardTextField) -> UIImage? func cardTextFieldShouldShowAccessoryImage( cardTextField: CardTextField) -> UIImage? / You may return an image to be used on the accessory button of the cardTextField. / If you return nil but supply an accessory button action, instead of an image, the unicode character “” is shown to signify an action that impacts the text field. func cardTextFieldShouldProvideAccessoryAction(_ cardTextField: CardTextField) -> (() -> ())? func cardTextFieldShouldProvideAccessoryAction(_ cardTextField: CardTextField) -> (() -> ())? / You may provide a callback function that will be invoked whenever a user taps the accessory button on cardTextField. / If you return nil, cardTextField will not show an accessory button at all. …


Changing the look of the text field

CardTextField, like all other UITextFields, is largely configurable. Setting any of the standard attributes for a CardTextField (either from code or through the interface builder) has the same effect as setting any other UITextField:

Property Type Description
placeholder String? The holder for the card number. Make sure you format a card number as a placeholder such that it utilizes the cardNumberSeparator that has been specified for the text field (i.e. when using ” – ” as separator, set a placeholder like “1234 – 1234 – 1234 – 1234”).
textColor UIColor? The color of the text that has been put into the CardTextField.
backgroundColor UIColor? The text field’s background color.
font UIFont? The typeface of the text that has been inputted.
secureTextEntry Bool When true, any text entered in the text field is encrypted (i.e. masked by “•” characters).
keyboardAppearance UIKeyboardAppearance When altering text in the text box, the keyboard appears.
borderStyle UITextBorderStyle For the text field, this is the border style.

CardTextField also has the following characteristics (which are also available via the interface builder):

Property Type Description
cardNumberSeparator String? The string that separates the groups in a card number. The default value is ” – “.
viewAnimationDuration Double? When moving between the card number text field and the information, the length of a view animation in seconds (month, view and cvc text fields).
invalidInputColor UIColor? The color of the text for incorrect input. The text will flash in this color when inputting an invalid card number, and the expiration date will be shown in this color if the card is expired.

CardIO

CardIO is one of the most powerful solutions for allowing users to input payment card information. It makes use of the camera to allow the user to scan their credit card. Users may wish to limit access to their camera or just input this information manually, therefore you may want to offer them with a visually attractive text box to submit their credit card information.

You can use a CardTextField’s prefillCardInformation function in conjunction with the previously described accessory button to give users with a connection to CardIO:

/ 1. Confirm the CardTextFieldDelegate and CardIOPaymentViewControllerDelegate protocols in your view controller: class UIViewController, CardTextFieldDelegate, CardIOPaymentViewControllerDelegate… ViewController: UIViewController, CardTextFieldDelegate, CardIOPaymentViewControllerDelegate… / MARK: – CardTextFieldDelegate func cardTextField( cardTextField: CardTextField, didEnterCardInformation information: cardTextField: CardTextField, didEnterCardInformation information: cardTextField: CardTextField, didEnterCardInformation information: cardTex ValidationResult: CardValidationResult) Card, withValidationResult) Card, withValidationResult) Card, withValidationResult) Card, withVali if validationResult is equal to. Valid / Either a valid payment card was manually input or one was scanned using CardIO. func cardTextFieldShouldShowAccessoryImage(_ cardTextField: CardTextField) -> UIImage? / 2. Optionally supply an image for the CardIO button func cardTextFieldShouldShowAccessoryImage(_ cardTextField: CardTextField) -> UIImage? UIImage(named: “cardIOIcon”) UIImage(named: “cardIOIcon”) UIImage(named: “cardIOIcon”) UIImage( / 3. Set the accessoryButton’s action to open CardIO: func cardTextFieldShouldProvideAccessoryAction(_ cardTextField: CardTextField) -> (() -> ())? func cardTextFieldShouldProvideAccessoryAction(_ cardTextField: CardTextField) -> (() -> ())? let cardIOViewController = CardIOPaymentViewController(paymentDelegate: self) self? return [weak self] in let cardIOViewController = CardIOPaymentViewController(paymentDelegate: self) self? cardIOViewController(animated: true, completion: nil) presentViewController(cardIOViewController, animated: true, completion: nil) MARK: – CardIOPaymentViewControllerDelegate; / MARK: – CardIOPaymentViewControllerDelegate; / MARK: – Prefill the text box with the following information when receiving payment card information from CardIO: cardInfo: CardIOCreditCardInfo!, inPaymentViewController paymentViewController: CardIOPaymentViewController!) func userDidProvideCreditCardInfo(cardInfo: CardIOCreditCardInfo!, inPaymentViewController paymentViewController: CardIOPaymentViewController!) cardTextField.prefillCardInformation(cardInfo.card); cardTextField.prefillCardInformation(cardInfo.card); cardTextField.prefillCar func userDidCancelPaymentViewController(paymentViewController: CardIOPaymentViewController!) paymentViewController.dismissViewControllerAnimated(true, completion: nil) paymentViewController.dismissViewControllerAnimated(true, completion: nil) paymentViewController.dismissViewControllerAnimated(true, completion: nil) paymentViewController.dismissViewControllerAnimated(true


You may create your own card kinds.

CardTextField also has a CardTypeRegister, which keeps track of the many card kinds that this text field accepts. You may make your own card kinds and add or delete them from the card number text fields as you see fit:

MARK: – Required / struct MyCardType: CardType The name of the card type you’ve chosen: name = “My Card Type” public let name = “My Card Type” Note: When this card type is identified, the picture that will be shown in the card number text field’s image view will come from an asset called ‘cardType.name.’ / The card is recognized as being of type “MyCardType” if the Issuer Identification Number (the first six digits of the supplied card number) begins with any number between 1000 and 1111: Identifying the public is permitted. Set of digits (1000…1111) / The anticipated number of digits in the Card Validation Code. MARK: – Optional / public let CVCLength = 4 Your card number type’s grouping. In a card number format like “100 – 0000 – 00000 – 000000,” the following outcomes appear: / If you don’t provide this, the output will be a 16-digit number divided into four groups of four digits. numberGrouping = [3, 4, 5, 6] public let /** Whether or not CVC validation is needed for this card type is indicated by this boolean flag. By setting this value to false, the CVC text field will be hidden from the ‘CardTextField’ and the necessary validation procedure will be removed. True is the default value. */ requiresCVC = true /** public let This is a boolean flag that specifies whether or not this card type requires expiration validation. The month and year text fields will be hidden from the ‘CardTextField’ and the necessary validation procedure will be removed if this value is set to false. True is the default value. */ public init()… class public let requiresExpiry = true @IBOutlet weak var cardTextField: CardTextField? MyViewController: UIViewController, CardTextFieldDelegate cardTextField?.cardTypeRegister.registerCardType(MyCardType()) method viewDidLoad()


Using the text field’s various components individually

Instead of inputting the card number, expiration date, and CVC in a single text box, single text fields may be used to segregate this information.

number ViewController: UIViewController, class ViewController: UIViewController, class ViewController: UIViewControl Card, InputTextFieldDelegate @IBOutlet weak var card InfoTextFieldDelegate NumberTextField: This is a number field. @IBOutlet weak var month InputTextField! MonthInputTextField! @IBOutlet weak var yearInputTextField! Year is an inputTextField. @IBOutlet weak var cvc InputTextField! CVCInputTextField! InputTextField: CVCInputTextField! When genuine information is provided in the text boxes, the card is not nil: a variable card: Card? Let’s say you want to make a card out of a number. NumberTextField.card Number CVC(rawValue: cvc) = cvc ?? “”) InputTextField.text let expiry = Expiry(month: monthInputTextField.text?? “”, year: yearInputTextField.text?? “”, monthInputTextField.text?? “”, monthInputTextField. “”)?? InputTextField.text?? Expiry.invalid let cardType equals card NumberTextField.cardTypeRegister.cardType If cardType.validate(cvc: cvc).union(cardType.validate(expiry: expiry)).union(cardType.validate(number: number) ==, then for(number: cardNumberTextField.cardNumber) Return Card (number: number, CVV: CVV, Expiry: Expiry) that is valid otherwise, return nil override func super.viewDidLoad() card viewDidLoad() NumberTextField.number MonthInputTextFieldDelegate = self InputTextField.card DelegateInfoTextField = self year InputTextField.card InfoTextField Self = delegate cvcInputTextField.card InfoTextField / Delegate = self Set the ‘deleteBackwardCallbacks’ – closures that are triggered when a user presses / backspace on an empty text field. month InputTextField.delete in self.card, BackwardCallback = becomeFirstResponder(NumberTextField) year InputTextField.delete in self.month BackwardCallback = cvc cvc cvc cvc cvc cvc cvc cvc cvc cvc cvc cvc cv InputTextField.delete in self.year BackwardCallback = becomeFirstResponder() InputTextField number of functions InputTextFieldDidComplete(_ number)InputTextFieldDidComplete(_ number)InputTextFi Number in the inputTextField cvcInputTextField.card) cvcInputTextField.card) cvcInputTextField.card) cvcInputTextField Number = type InputTextField.cardTypeRegister.cardType (number: number) for(number: number) for(number: number print(“Card number: (numberInputTextField.cardNumber)”) InputTextField.cardNumber) print(card) month becomeFirstResponder() InputTextField number of functions InputTextFieldDidChangeText(_ number)InputTextFieldDidChangeText(_ number)InputTextFi Number in the inputTextField func textField(_ textField: UITextField, didEnterValidInfo: String) func textField(_ textField: UITextField, didEnterValidInfo: String) textField switch the situation is Month printInputTextField (“Month: (didEnterValidInfo)”), “Month: (didEnterValidInfo)”, “Month: (did The case of YearInputTextField.becomeFirstResponder() is YearInputTextField.becomeFirstResponder(). cvcInputTextField: print(“Year: (didEnterValidInfo)”) InputTextField: print(“Year: (didEnterValidInfo)”) The CVCInputTextField: becomeFirstResponder() scenario is CVCInputTextField: “CVC: (didEnterValidInfo)” print(“CVC: (didEnterValidInfo)”) func textField(_ textField: UITextField, didEnterPartiallyValidInfo: String) func textField(_ textField: UITextField, didEnterPartiallyValidInfo: String) func textField(_ textField: UITextField, didEnterPartiallyValidInfo: / The user provided invalid data, which may become valid with further input. / For example, typing “1” for the CVC is partly acceptable, but not “a.” didEnterOverflowInfo overFlowDigits: String) func textField(_ textField: UITextField, didEnterOverflowInfo overFlowDigits: String) / In a CardTextField, this method is used to transfer digits to the next text field. / For example, a user set the expiration date to “02/20” and now wants to add “5” to the month. / The year will be substituted with “5”, the overflow digit, in a card text field. /…/

Caishen’s contribution

Please submit an issue under the appropriate category to report a problem or propose an improvement.

If you want to help out with the project, fork it and make a pull request. Contributions to the code should adhere to the Prolific Swift Style Guide’s guidelines.

License

Caishen is a trademark of Prolific Interactive (c) 2017. The LICENSE file specifies the conditions under which it may be shared.

Maintainers

prolific

Prolific Interactive maintains and funds Caishen. Prolific Interactive’s names and logos are trademarks.

GitHub

https://github.com/prolificinteractive/Caishen

The “add credit card ui design” is a UI & Validator for iOS. It allows users to add credit cards from their iPhone or iPad.

Frequently Asked Questions

Which card is used for payment?

A: The credit card is used as the payment method for purchases.

What is an e card for payment?

A: An e card is an email address that you can use for online payments.

What is a credit card checkout?

 

Related Tags

  • credit card ui kit
  • bank card ui
  • credit card payment ui
  • credit card checkout template
  • credit card checkout form or page
Author

Peter started his tech website because he was motivated by a desire to share his knowledge with the world. He felt that there was a lot of information out there that was either difficult to find or not presented in a way that was easy to understand. His website provides concise, easy-to-understand guides on various topics related to technology. Peter's ultimate goal is to help people become more comfortable and confident with technology. He believes that everyone has the ability to learn and use technology, and his website is designed to provide the tools and information necessary to make that happen.