Creating an `mposUIReader` Instance {#ttpay-ios-mposui-reader-intro}
====================================================================

Use this information to create and configure an `mposUIReader` instance. Before creating this instance, you must first create `Credentials` and `Configuration` objects.

Create an `mposUIReader` `Credentials` Object {#ttpay-ios-mposui-reader-credentials}
====================================================================================

Before starting this task, obtain a merchant ID and secret key. You use these values when creating the `Credentials` object.

> IMPORTANT  
> Things to know about migrating from SDK 3.5.0 to SDK 3.6.0:
>
> * The environment parameter was removed from the ` Credentials ` object.
> * Use the standalone ` MposEnvironment ` enum, with the value ` .live ` or ` .test `, when calling ` activate() `.

* The merchant parameter was renamed to merchantId .  
  The `Credentials` object is required to access the functionality of the Tap to Pay on iPhone SDK. Before you can create an `mposUIReader` instance, you must create the `Credentials` object.

1. Import `MposUI`.

2. Create a `Credentials` object.

3. Set the merchantId field value to the merchant ID that you obtained.

4. Set the secret field value to the secret key that you obtained.

   ```
   import MposUI

   let credentials = try Credentials(merchantId: "MerchantId",
                                     secret: "SecretKey")
   ```

Create an `mposUIReader` `Configuration` Object {#ttpay-ios-mposui-reader-configuraiton}
========================================================================================

Before you can create the `mposUIReader` instance in the Tap to Pay on iPhone SDK, you must create the `Configuration` object.  
Use the `Configuration` object to configure these parameters for the `mposUIReader` instance:

* Configure these Summary screen features:
  * Refund a transaction (`.refundTransaction`).
  * Send a receipt by email (`.sendReceiptViaEmail`).
  * Capture a transaction (`.captureTransaction`).
  * Increment a transaction (`.incrementTransaction`).
  * Retry a failed transaction (`.retryTransaction`).
    {#ttpay-ios-mposui-reader-configuraiton_ul_mkm_dm3_lyb}
* Configure the Summary screen so that it can be skipped (`.skipSummaryScreen`). The default setting is to show the Summary screen (`.displayIndefinitely`).
* Configure the signature capture so that it prints on the paper receipt (`.onReceipt`) or is skipped (`.none`). The default setting is on-screen signature capture.
* Configure the device activation process to prompt the merchant to enter the serial number of a previously activated device (`.manualInput`). The default setting is to show a list of previously activated devices and prompt the merchant to choose a device from the list (`.deviceList`).
* Configure the Serial Number Confirmation screen to be skipped (`.skip`). The default setting is to show the screen (`.showWithSerialNumber`).
  {#ttpay-ios-mposui-reader-configuraiton_ul_kpy_gl3_lyb}

1. Create the `Configuration` object.

   ```
   let configuration = Configuration(summaryFeatures: [.sendReceiptViaEmail, .refundTransaction, .captureTransaction, .incrementTransaction, .retryTransaction],
                                     resultConfiguration: .displayIndefinitely,
                                     signatureCapture: .onScreen,
                                     enrollmentConfiguration: .init(serialNumberInputMethod: deviceList, confirmationScreenOption: showWithSerialNumber)
                                     )
   ```

Create an `mposUIReader` Instance {#ttpay-ios-mposui-reader-instance}
=====================================================================

Before you can create the `mposUIReader` instance, you must create and configure the `Configuration` object.

> IMPORTANT
> Things to know about migrating from SDK 3.5.0 to SDK 3.6.0: If your app has activated devices in production, use the migration builder to preserve existing activations. This step migrates the device state from the old storage location to the new Apple Keychain-backed storage location and merchants do not need to reactivate their devices.
>
> ```
>   let reader: MposUIReader = await mposUiBuilder(
>     credentials: credentials,
>     environment: .live,
>     configuration: configuration
> )
>   
> ```
>
> Both builders return the same ` MposUIReader ` type. When all of your in-production merchants have upgraded to and used SDK 3.6.0 at least one time, switch to ` mposUIReaderBuilder ` in a future release.

1. Call `mposUIReaderBuilder` with the `Configuration` object to create an `mposUIReader` instance.

   ```
   let reader: MposUIReader = await mposUIReaderBuilder(
       configuration: configuration
   )
   ```

