Skip to main content

Configuration

The iOS SDK is configured through MicroblinkPlatformServiceSettings, which you pass to MicroblinkPlatformSDK:

let consent = MicroblinkPlatformConsent(
userId: ...,
isProcessingStoringAllowed: ...,
isTrainingAllowed: ...,
isGivenOn: ...,
note: ...
)

let serviceSettings = MicroblinkPlatformServiceSettings(
workflowId: ...,
url: ...,
consent: consent,
additionalRequestHeaders: ...
)

See the quickstart for full UIKit integration examples.

Configuration objects

let serviceSettings = MicroblinkPlatformServiceSettings(
workflowId: "...", // required
url: "...", // required
consent: MicroblinkPlatformConsent(...), // required
additionalRequestHeaders: [...] // optional
)

// Path overrides (optional)
serviceSettings.startTransaction = "/transaction"
serviceSettings.cancelWorkflow = "/initialize/%@/cancel"
serviceSettings.getWorkflowInfo = "/initialize/%@/info"

let sdk = MicroblinkPlatformSDK(
serviceSettings: serviceSettings,
delegate: self // required
)

Required fields

You must set the following fields. Other fields are optional and are described in the Optional fields section.

workflowId

MicroblinkPlatformServiceSettings(
workflowId: "example123",
...
)

This is the ID of your workflow. You can get the workflowId from the Platform dashboard.


url

MicroblinkPlatformServiceSettings(
url: "https://your.proxy.server",
...
)

The url is the base URL of the proxy service you are hosting. By default, the SDK appends /transaction to this value when creating new transactions. If you're using our proxy (latest version), you don't need to change anything.


Consent is a mandatory field where you provide a unique user identifier and the user's consent to process their data. You provide the consent by setting the isProcessingStoringAllowed flag to true. If it is not set, the SDK will show its own consent form to the user. If they reject, the transaction will be abandoned and the delegate will be called with .consentDenied.

Never reuse user IDs

Never reuse the same user ID for multiple users. Each consent to process someone's personal data must be accompanied by a unique identifier that can be used to associate this consent with the person who gave it.

MicroblinkPlatformConsent(
// Required:
userId: "...",
isProcessingStoringAllowed: true,
isTrainingAllowed: true,
isGivenOn: .now,
// Optional:
note: nil
)
  • isTrainingAllowed: set to true to allow the user's data to be used for training machine learning models; defaults to false.
  • isGivenOn: the Date when consent was given.
  • note: an optional note describing the consent.

Optional fields

additionalRequestHeaders

MicroblinkPlatformServiceSettings(
...
additionalRequestHeaders: [
"X-custom-header": "some-custom-value"
]
)

Additional HTTP headers included in every request to the proxy service. Useful for authorization or other custom headers your proxy requires.


Path overrides

var serviceSettings = MicroblinkPlatformServiceSettings(...)
serviceSettings.startTransaction = "/transaction"
serviceSettings.cancelWorkflow = "/initialize/%@/cancel"
serviceSettings.getWorkflowInfo = "/initialize/%@/info"

The overrides depend on how you have configured your proxy service. By default, the SDK will append "/transaction" to the value in url when creating new transactions. If you're using our proxy (latest version), you don't need to change anything.


delegate

MicroblinkPlatformSDK(
serviceSettings: serviceSettings,
delegate: self
)

The delegate receives SDK lifecycle events. Implement MicroblinkPlatformSDKDelegate on the object you pass here. See Delegate methods below for details on each callback.


Customization

// Primary color
MicroblinkPlatformTheme.shared.primaryColor = myColor

// Images
MicroblinkPlatformTheme.shared.mainScreenMainImage = myHomeImage
MicroblinkPlatformTheme.shared.verifySuccessImage = mySuccessImage
MicroblinkPlatformTheme.shared.verifyReviewImage = myReviewImage
MicroblinkPlatformTheme.shared.verifyErrorImage = myErrorImage
MicroblinkPlatformTheme.shared.cameraPermissionIcon = myCameraIcon

// Fonts
MicroblinkPlatformTheme.shared.mainScreenTitleFont = myTitleFont
MicroblinkPlatformTheme.shared.mainScreenSubtitleFont = mySubtitleFont
MicroblinkPlatformTheme.shared.mainButtonFont = myButtonFont
MicroblinkPlatformTheme.shared.verifyTitleFont = myVerifyTitleFont
MicroblinkPlatformTheme.shared.verifySubtitleFont = myVerifySubtitleFont

// Shape
MicroblinkPlatformTheme.shared.buttonCornerRadius = 24

Customizations include:

  • primaryColor: controls the primary color of buttons and interactive elements throughout the SDK.
  • Images (mainScreenMainImage, verifySuccessImage, verifyReviewImage, verifyErrorImage, cameraPermissionIcon): replace the default images on the home, result, and camera permission screens.
  • Fonts: individual UIFont properties for each screen element — title, subtitle, button, loading, error, and camera permission screens.
  • buttonCornerRadius: controls the corner radius of action buttons; defaults to 10.
  • documentScan* properties: Color and Font values controlling the appearance of alert dialogs, onboarding sheets, and the scanning reticle within document capture screens.

Read more about how to customize your iOS SDK integration.


Delegate methods

Transaction finished

func microblinkPlatformSDKDidFinish(
viewController: UIViewController,
result: MicroblinkPlatformResult
) {
viewController.dismiss(animated: true)
}

Called when the transaction finishes. MicroblinkPlatformResult contains:

  • status: a MicroblinkPlatformResultStatus value: .accept, .review, or .reject
  • transactionId: the unique identifier of the completed transaction

User exited

func microblinkPlatformSDKDidClose(
viewController: UIViewController,
cancelState: MicroblinkPlatformCancelState
) {
viewController.dismiss(animated: true)
}

Called when the user exits the workflow before completion. MicroblinkPlatformCancelState contains:

  • cancelReason: a MicroblinkPlatformCancelReason value: .userCanceled or .consentDenied
  • transactionId: the transaction ID, if available at the time of cancellation

Card scan step finished

func microblinkPlatformSDKDidFinishCardScanStep(
viewController: UIViewController,
cardScanResult: MicroblinkPlatformResultCardScanResult
) {
// cardScanResult.cardNumber, .expiryDate, .owner, .cvv
}

Called when a card scan step is completed within the flow. MicroblinkPlatformResultCardScanResult contains cardNumber, expiryDate, owner, and cvv.