AptoPCISDK 1.0.2

AptoPCISDK 1.0.2

Maintained by Ivan Oliver, Evan Li.



  • By
  • Pau Teruel

AptoPCISDK

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

AptoPCISDK is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AptoPCISDK'

Using the PCI SDK

To use the PCI SDK, simply instantiate a PCIView and add it to yor view hierarchy:

view.addSubview(pciView)
pciView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
  pciView.topAnchor.constraint(equalTo: topConstraint, constant: 40),
  pciView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 20),
  pciView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20),
  pciView.heightAnchor.constraint(equalToConstant: 240),
])

Then, initialize the SDK using the initialize medhod:

pciView.initialise(apiKey: "API_KEY",
                   userToken: "USER_TOKEN",
                   cardId: "CARD_ID",
                   lastFour: "1234",
                   environment: "sandbox")

Note: The allowed values for the environment parameter are sandbox and production.

To show the card's last four, use the following snippet:

pciView.lastFour()

To show the card's complete data, use the following snippet:

pciView.reveal()

The PCI SDK will verify the user (if needed) and will show the card data.

Customise the PCI SDK

The PCI SDK look & feel can be customised in different ways:

Showing / hiding elements

You can decide which elements are shown by the PCI SDK. There are three elements that can be shown / hidden:

  1. PAN
  2. CVV
  3. Exp. Date

You can, also, define the css styles of various components, including:

  1. IFrame (container)
  2. PAN field.
  3. CVV field.
  4. Exp. Date field

Styling elements

To customise the PCI look and feel, you can use the following snippet:

pciView.showPan = true
pciView.showCvv = false
pciView.showExp = false
pciView.styles = [
  "container": "color: red",
  "content": [
    "pan": "color: blue",
    "cvv": "color: yellow",
    "exp": "color: green"
  ]
]

Text customization

To customize the different texts shown in alerts, you can use the following attribute:

pciView.alertTexts = [
    "inputCode.message": "What's your secret code?",
    "inputCode.okAction": "Ok",
    "inputCode.cancelAction": "Cancel",
    "wrongCode.message": "Invalid code",
    "wrongCode.okAction": "Ok"
]

Author

Pau Teruel, [email protected]

License

AptoPCISDK is available under the MIT license. See the LICENSE file for more info.