On This Page
Creating an mposUI Instance
Use this information to create and configure an
mposUI
instance. Before
creating an mposUI
instance, you must create the
Credentials
and Configuration
objects.Create an mposUI Credentials Object
mposUI
Credentials ObjectBefore starting this task, obtain a merchant ID and secret key. For more
information, see Generating a Secret Key for an Existing Merchant ID.
The
mposUI Credentials
object is required in order to access the
functionality of the Tap to Pay on iPhone SDK. You must create this object before you
can create an mposUI
instance. Follow these steps to create the
mposUI Credentials
object.- ImportMposUI.
- Create aCredentialsobject.
- Set themerchantfield value to the merchant ID that you obtained.
- Set thesecretfield value to the secret key that you obtained.
- Set theenvironmentfield value totestor tolive.
- Use thetestsetting to test your integration without charging a real payment card. Use the merchant ID and secret key that you obtained from the test environment.
- Use thelivesetting to process live transactions. Use the merchant ID and secret key that you obtained from the production environment.
import MposUI let credentials = Credentials(merchant: "MerchantId", secret: "SecretKey", environment: .live)
Create an mposUI Configuration Object
mposUI
Configuration ObjectTo create and use the
mposUI
instance with the Tap to Pay on
iPhone SDK, you must create the mposUI Configuration
object.Use the
Configuration
object to configure these parameters for the
mposUI
instance:- Configure these Summary screen features:
- Refund a transaction (.refundTransaction).
- Send a receipt by email (.sendReceiptViaEmail).
- Capture a transaction (.captureTransaction).
- Increment a transaction (.incrementTransaction).
- Re-try a failed transaction (.retryTransaction).
- 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 enrollment process to prompt the merchant to enter the serial number of a previously enrolled device (.manualInput). The default setting is to show a list of previously enrolled 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).
Follow this step to create the
mposUI Configuration
object.- Create theConfigurationobject.let configuration = Configuration(summaryFeatures: [.sendReceiptViaEmail, .refundTransaction, .captureTransaction, .incrementTransaction, .retryTransaction], resultConfiguration: .displayIndefinitely, signatureCapture: .onScreen, enrollmentConfiguration: .init(serialNumberInputMethod: deviceList, confirmationScreenOption: showWithSerialNumber) )
Create an mposUI Instance
mposUI
InstanceBefore you can create the
mposUI
instance, create and configure the
Credentials
and Configuration
objects.Follow this step to create the
mposUI
instance.- Create themposUIinstance.let mposUi = await mposUiBuilder(credentials: credentials, configuration: configuration)