Skip to content
payrocdevelopers

Configure the processing terminal

Configure the Tap to Pay on iPhone terminal by initializing it locally, setting the operating mode, and loading your settings from our gateway.

Prerequisites: Authentication · Set up the SDK

Before your app can run a sale, it needs the merchant's payment settings. To get the payment settings, initialize WTPSTerminal in your app, and then send your terminal ID to our gateway.

Integration steps

  1. Initialize WTPSTerminal.

  2. Load the settings from our gateway.

Step 1. Initialize WTPSTerminal

  1. Add the following code to your app delegate or to wherever your app runs its launch code:

    Swift

    swift
    let terminal = WTPSTerminal<CoreTerminalConnector>.singleton() as! WTPSTerminal<CoreTerminalConnector>
    terminal.initialize()
    terminal.mode = TEST // TEST or LIVE
    terminal.setLogLevel(LEVEL_INFO)
    

    Objective-C

    objectivec
    [[WTPSTerminal singleton] initialize];
    [(WTPSTerminal *)[WTPSTerminal singleton] setMode:TEST]; // TEST or LIVE
    [[WTPSTerminal singleton] setLogLevel:LEVEL_INFO];
    
  2. Set the operating mode to one of the following values:

ValueDescription
TESTSends requests to our test environment. Use TEST while you develop your integration.
LIVESends requests to our production environment. Use LIVE when you're ready to run live transactions.
  1. Set the log level to one of the following values:
ValueDescription
LEVEL_FULLRecords all messages, including raw data. Available only in TEST mode.
LEVEL_INFORecords informational messages.
LEVEL_ERRORRecords only errors.
LEVEL_NONERecords nothing.
  1. (Optional) To receive the SDK's log output in your own code, register a CoreAPILogsListener:

    Swift

    swift
    terminal.registerLogListener(self)
    
    func onLogMessage(_ message: String!, with logLevel: LogLevel) {
        print("[SDK \(logLevel.rawValue)] \(message ?? "")")
    }
    

    Objective-C

    objectivec
    [[WTPSTerminal singleton] registerLogListener:self];
    
    - (void)onLogMessage:(NSString *)message withLogLevel:(LogLevel)logLevel {
        NSLog(@"[SDK %d] %@", (int)logLevel, message);
    }
    

    Note: To stop receiving log messages, send nil to registerLogListener.

Step 2. Load the settings from our gateway

Important: Make sure that you register your settings listener before you call initWithConfiguration:. If you register your settings listener afterward, you miss the onSettingsRetrieved: callback that indicates the SDK has your settings.

  1. Add the following code to register your settings listener and to send your terminal ID to our gateway:

    Swift

    swift
    terminal.register(self as CoreAPISettingsListener)
    terminal.initWithConfiguration("YOUR_TERMINAL_ID")
    

    Objective-C

    objectivec
    [[WTPSTerminal singleton] registerCoreAPISettingsListener:self];
    [[WTPSTerminal singleton] initWithConfiguration:@"YOUR_TERMINAL_ID"];
    
  2. Replace YOUR_TERMINAL_ID with your terminal ID. We provided you with your terminal ID when you boarded with us.

  3. Add the following code to handle the onSettingsRetrieved: and onError:withDescription: callbacks:

    Swift

    swift
    func onSettingsRetrieved(_ settings: CoreSettings!) {
        // Settings loaded from the gateway. You can now initialize the device.
        terminal.initDevice(APPLETTP, with: DCT_INTERNAL, withDeviceData: [:])
    }
    
    func onError(_ error: CoreError, withDescription message: String!) {
        // Could not load settings. Check your terminal ID and connectivity.
    }
    

    Objective-C

    objectivec
    - (void)onSettingsRetrieved:(CoreSettings *)settings {
        // Settings loaded from the gateway. You can now initialize the device.
        [[WTPSTerminal singleton] initDevice:APPLETTP
                          withConnectionType:DCT_INTERNAL
                              withDeviceData:nil];
    }
    
    - (void)onError:(CoreError)error withDescription:(NSString *)message {
        // Could not load settings. Check your terminal ID and connectivity.
    }
    

    The onSettingsRetrieved: callback indicates that the SDK has your payment processing settings. After the SDK has your settings, you can initialize the device to run a sale.

Next step

After you configure the processing terminal, go to Run a sale.

Browse guides

Search documentation

API reference169
Guides118
Knowledge38
legal1
Solutions32
Workflows74
↑↓highlight↵openView all search results

Menu

Theme

Sign out

Your saved plans remain in your organization. This browser’s private draft and account view will be cleared.

Talk to an engineer