Skip to content

Card Scanner

The iOS Payment Sheet SDK includes built-in card scanning powered by the device camera. When enabled, a scan button appears in the top-right corner of the navigation bar. The scanner reads the card number, expiry date, and name. CVV and postal code are not scanned and must be entered manually. Scanning results flow through the same PaymentActionDelegate callbacks as manual entry.

Card scanning is enabled by default. No additional SDK setup is required beyond adding the camera permission to your app.

Camera permission

Add camera permission

Add the following key to your app's Info.plist. Without it, the OS will deny camera access and scanning will not work.

<key>NSCameraUsageDescription</key>
<string>Used to scan credit cards for faster entry.</string>
Required for scanning

If NSCameraUsageDescription is missing from your Info.plist, camera access will be denied and the user will be directed to the Settings page to enable it.

Enabling and disabling

enableCardScanning

Control scanning via the enableCardScanning parameter on Configuration. It defaults to true.

ValueBehavior
true (default)Scan button appears in the payment sheet.
falseScan button is hidden. Users enter card details manually.
// Info.plist
// NSCameraUsageDescription: "Used to scan credit cards for faster entry."

let config = Configuration(
    title: "Card Entry",
    branding: Branding(image: UIImage(named: "MyLogo"), title: "My Company"),
    buttonTitle: "Pay Now",
    enableCardScanning: true // set to false to disable
)
paymentAction = PaymentAction(
    credentials: credentials,
    delegate: self,
    configuration: config
)

let sheet = paymentAction.paymentSheet(style: .complete)
paymentAction.present(from: self, paymentSheet: sheet, animated: true)