**Last updated**: 30 October 2025 | [**Change log**](/products/checkout/ios/changelog/) # Create a session for CVC only Enterprise SMB (Worldpay eCommerce) Create a Payments CVC `session` by sending your customer's CVC. Full sample integration You can see an example of the session generation [here](https://github.com/Worldpay/access-checkout-ios/tree/master/AccessCheckoutDemo). ## Reference your UI components To display your checkout form, you must create your layout first using your storyboard. As part of our SDK, we provide a UI component dedicated to capturing your customer's card details to minimize your exposure to PCI data. You must use this component if you want to qualify for the lowest level of PCI compliance (SAQ-A). Here's an example of how you would reference your UI components using unique identifiers. ```swift import AccessCheckoutSDK class ViewController: UIViewController { @IBOutlet weak var cvcAccessCheckoutView: AccessCheckoutUITextField! func submitButtonClickHandler() { // code to generate your session ... } ... ``` ## CVC validation You can optionally validate your customer's CVC. You can find instructions [here](/products/checkout/ios/cvc-validator). ## Create a CVC session ### Initialize the AccessCheckoutClient You must now initialize the SDK using the `AccessCheckoutClientBuilder`. To do this, you must provide your `accessBaseURL`, `checkoutId` and other parameters. Here's an example of how you would initialize the SDK with the mandatory parameters. ```swift // The AccessCheckoutClientBuilder throws an exception if either the accessBaseUrl() or checkoutId() calls are omitted let accessCheckoutClient = try AccessCheckoutClientBuilder() .accessBaseUrl() .checkoutId() .build() ``` | Placeholder | Description | | --- | --- | | `` | For testing use: `https://try.access.worldpay-bsh.securedataplatform.com/`For live use: `https://access.worldpay-bsh.securedataplatform.com/` | | `` | Your unique checkout ID as provided by Worldpay. | Note This instance can be reused across multiple validation scenarios to avoid redundant initialization. - If you have already initialized the `AccessCheckoutClient` in your `viewDidLoad()` [method](/products/checkout/ios/cvc-validator#initialize-the-accesscheckoutclient-and-validation) when setting up CVC validation, you can reuse that instance by storing it as a property on your view controller and referencing it when generating sessions (`self.accessCheckoutClient`). ## Retrieve the session ### Submitting your customer's card details The `CardDetails` contains the customer's data that is submitted to retrieve a `session`. ```swift let cardDetails:CardDetails = try! CardDetailsBuilder() .cvc(cvcAccessCheckoutView) .build() ``` ### Specifying the session You must specify `[SessionType.cvc]` as the type of `session` to generate. ```swift try? accessCheckoutClient?.generateSessions(cardDetails: cardDetails, sessionTypes: [SessionType.cvc]) { result in DispatchQueue.main.async { switch result { case .success(let sessions): // The session is returned in a Dictionary[SessionType:String] let session = sessions[SessionType.cvc] ... case .failure(let error): // The error returned is of type AccessCheckoutError let errorMessage = error.message ... } } } ``` Recommendation - The call to `generateSessions` takes a closure that returns a `Result[SessionType: String], AccessCheckoutError>`. - You must use the pattern of the main thread in the closure when handling the success/failure would lead to updating the UI. ### Full code sample Here's the full code sample of the steps above. import AccessCheckoutSDK class MyViewController: UIViewController { private let accessBaseUrl = "https://try.access.worldpay-bsh.securedataplatform.com" private let checkoutId = "your-checkout-id" @IBOutlet weak var cvcAccessCheckoutView: AccessCheckoutUITextField! @IBAction func submit(_ sender: Any) { let cardDetails = try! CardDetailsBuilder() .cvc(cvcAccessCheckoutView) .build() let accessCheckoutClient = try? AccessCheckoutClientBuilder() .accessBaseUrl(accessBaseUrl) .checkoutId(checkoutId) .build() try? accessCheckoutClient?.generateSessions(cardDetails: cardDetails, sessionTypes: [SessionType.card, SessionType.cvc]) { result in DispatchQueue.main.async { switch result { case .success(let sessionsDictionary): let cardSession = sessionsDictionary[SessionType.card] let cvcSession = sessionsDictionary[SessionType.cvc] ... case .failure(let error): ... } } } } } Caution Do **not** validate the structure or length of the session resources. We follow HATEOS standard to allow us the flexibility to extend our APIs with non-breaking changes. Important The CVC `session` has a lifespan of **15 minutes** and you can use it **only once**. If you do not take a payment within that time, you must create a new CVC `session` value. ### Next steps Using the Payments API Apply the session in the payment request Enterprise SMB (Worldpay eCommerce) Using our Modular APIs Create a verified token Enterprise