CardScan (Bouncer SDK) module
VGS Collect SDK provides CardScan integration module for collecting and setting scanned card data into VGSTextFields
.
It's required to use scan module provided by VGS, which is audited by VGS PCI requirements.
Pricing
VGS Collect CardScan module is a paid integration with Bouncer. VGS customers pay Bouncer for the functionality and receive a 20% discount off of Bouncer's normal pricing: $0.12 per card scan. For VGS customers expecting to scan >40,000 cards per month, customers can contact Bouncer directly for an attractive best-available custom plan supported by the VGS-Bouncer partnership.
Before you start
You should obtain API Key for CardScan commercial usage, generating it on the Bouncer admin console.
Integration
Integrate with Cocoapods
To use CardScan with VGSCollectSDK you should add CardScan module alongside with core VGSCollectSDK module into your App Podfile:
pod 'VGSCollectSDK' pod 'VGSCollectSDK/CardScan'
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
Then in Terminal run:
pod install
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
Integrate with Carthage
Carthage users should point to VGSCollectSDK
repository and use next generated frameworks: VGSCollectSDK
, VGSCardScanCollector
, and CardScan
.
Make the following entry in your Cartfile:
github "verygoodsecurity/vgs-collect-ios"
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
Then in Terminal run:
carthage update --platform iOS
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
You'll need to go through some additional steps as explained over at Carthage documentation.
In any file you'd like to use CardScan module in, don't forget to import the module:
import VGSCollectSDK import VGSCardScanCollector
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
VGSCollectSDK
, VGSCardScanCollector
, and CardScan
from the Carthage Build directory after carthage update completes. Other submodules can safely be deleted.VGSCardScanController
An object you use to manage CardScan scan ViewController.
Declaration
class VGSCardScanController
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
Creating a VGSCardScanController
/// Init Controller with CardScan `apiKey` and delegate init(apiKey: String, delegate: VGSCardScanControllerDelegate? = nil)
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
VGSCardScanController Attributes and Methods
/// Handle CardScan states var delegate: VGSCardScanControllerDelegate? /// Set preferred camera position(default, back, front) var preferredCameraPosition: AVCaptureDevice.Position? /// Present CardScan ViewController func presentCardScanner(on viewController: UIViewController, animated: Bool, completion: (() -> Void)?) /// Dismiss CardScan ViewController func dismissCardScanner(animated: Bool, completion: (() -> Void)?) /// Check if CardScan can run on current device static func isCompatible() -> Bool
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
VGSCardScanControllerDelegate
Declaration
protocol VGSCardScanControllerDelegate
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
Managing Controller States
/// On CardScan finish scanning the card @objc func userDidFinishScan() /// On user selecting Back button on CardScan screen @objc func userDidCancelScan()
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
Providing VGSTextFields for setting Scanned Data
/// Asks VGSTextField where scanned data with type need to be set. /// Called after user select Done button, just before userDidFinishScan() delegate. @objc func textFieldForScannedData(type: CradScanDataType) -> VGSTextField?
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
If scanned data is valid, it will be set in your VGSTextFields
automatically.
CradScanDataType
CradScanDataType is an Enum of supported scan data types by CardScan module.
CradIODataType | Type, Value |
---|---|
.cardNumber | String, 16 digits number |
.expirationDate | String, "mm/yy" digits |
.expirationMonth | String, "mm" digits |
.expirationYear | String, "yy" digits |
.name | String, characters |
Usage
Create UI Form with VGSTextfields
, if not done yet.
Inside your ViewController create and configure VGSCardScanController
instance:
class ViewController: UIViewController { // Create VGSCardScanController instance var scanController = VGSCardScanController(apiKey: "YOUR_CARD_SCAN_API_KEY") // Scan card button var scanButton = UIButton() /// Initialize VGSCollect instance var vgsCollect = VGSCollect(id: "<VAULT_ID>", environment: .sandbox) /// VGS UI Elements var cardNumberField = VGSCardTextField() var cardHolderNameField = VGSTextField() var expCardDateField = VGSTextField() var cvcField = VGSTextField() override func viewDidLoad() { super.viewDidLoad() /// Set and implement VGSCardScanDelegate to handle user interaction with CardScan scanController.delegate = self /// Add action to handle scan button touch scanButton.addTarget(self, action: #selector(scanData(_:)), for: .touchUpInside) /// Setup Fields Layout and Configuration ... } // Present scan ViewController @objc func scanData(_ sender: UIButton) { /// Check if CardScan can run on current device if VGSCardScanController.isCompatible() { scanController.presentCardScanner(on: self, animated: true, completion: nil) } else { print("This device not compatible with CardScan") } } }
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.
Implement VGSCardScanControllerDelegate
methods.
To setup scanned data into specific VGSTextFields
implement textFieldForScannedData:
.
If scanned data is valid it will be set in your VGSTextFields
automatically after user confirmation.
Check CradScanDataType
to get available scanned data types.
extension ViewController: VGSCardScanControllerDelegate { //When scanning finished on CardScan screen func userDidFinishScan() { scanController.dismissCardScanner(animated: true, completion: { // add actions on scan controller dismiss completion }) } //When user press Back button on CardScan screen func userDidCancelScan() { scanController.dismissCardScanner(animated: true, completion: nil) } //Asks VGSTextField where scanned data with type need to be set. func textFieldForScannedData(type: CradIODataType) -> VGSTextField? { switch type { case .expirationDate: return expCardDateField case .name: return cardHolderNameField case .cardNumber: return cardNumberField default: return nil } } }
This is a sample VGS echo server.This is a HTTP port number to access.This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.More about the aliases available formats you can read at nomenclature page.This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.More about the available formats of alias you can read here.This is a sample vault id.This is a vault id.This is your vault id.This is a vault environment.These are an access credentials for a sample test vault.This is a placeholder for your access credentials.This is a sample proxy vault url.This is your vault url.This is your proxy vault url.This is a sample vault host.This is your vault host.This is your current Organization ID.A pre-generated JS script placeholder for your current organization.Sign in to see your personalized example.A pre-generated JS script placeholder for your current organization.Please talk to support in order to enable it for this organization.This is your pre-generated JS script for your current organization.The unique name that identifies a specific iframe.Unique client ID used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Client secret used for VGS CLI authentication.Please contact VGS Support in order to enable it for your organization.Version of the CLI published on quay.io.Command on the VGS CLI.This is a full path to the certificate file.This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use--cacert [FILE]
.