Prerequisites: Authentication
To set up the SDK and start integrating, add the Tap to Pay on iPhone SDK to your Xcode project, and then configure your build settings.
Integration steps
Download the SDK package.
Extract the archives.
Link the libraries to your app.
Copy the resources to your project.
Add your API key.
(Optional) Create a Swift bridging header.
Update your build settings.
Step 1. Download the SDK package
- Go to our Tap to Pay on iPhone GitHub repository, and then from the Releases section, download the latest package.
Step 2. Extract the archives
- Extract the contents from the PayrocTapToPayOniPhoneSDK zip folder. The package contains the following folders and files:
| Folder or file | Description |
|---|---|
| docs/ | HTML documentation and a script to load the documentation on your computer. |
| iosSample/ | Sample apps that we've created using Swift and Objective-C. |
| libs/ | SDK and plugin static libraries. |
| payconfig.xml | Configuration file that contains the gateway URLs and your API key. |
Go to the libs folder, and then extract the following zip folders:
gochip-applettp*.zip
gochip-sdk*.zip
Step 3. Link the libraries to your app
In Xcode, open your project, and then select your project in the Project navigator.
From the TARGETS list, select your app.
Select the Build Phases tab.
Expand Link Binary With Libraries, and then select +.
Add each of the following libraries:
libAFNetworking*.a
libc++.tbd
libgochip-common*.a
libgochip-restconnector*.a
libgochip-sdk*.a
libgochip-applettp*.a
libISO8601*.a
libJSONModel*.a
Step 4. Copy the resources to your project
Copy the following files to the root of your app project:
PayrocTapToPayOniPhoneSDK/libs/Core.h
PayrocTapToPayOniPhoneSDK/payconfig.xml
Check that Xcode copied payconfig.xml into your app
If the payconfig.xml file isn't in Copy Bundle Resources, your app builds successfully but can't reach our gateway.
To check that Xcode copied payconfig.xml into your app when it builds, complete the following steps:
From the TARGETS list, select your app, and then select the Build Phases tab.
Expand Copy Bundle Resources.
Check that the payconfig.xml file appears in the list.
(Optional) If the payconfig.xml file isn't in the list, select +, and then add it.
Step 5. Add your API key
- In the payconfig.xml file, enter your API key and integration ID.
Note: We provided you with your API key and integration ID when you boarded with us.
Step 6. (Optional) Create a Swift bridging header
If you're using Objective-C, go to Step 7. Update your build settings.
If you're using Swift, you need to create a Swift bridging header. To create a Swift bridging header, complete the following steps:
Create a file named [YourAppName]-Bridging-Header.h in the root of your project.
Add the following code to the file:
objectivec #ifndef [YourAppName]_Bridging_Header_h #define [YourAppName]_Bridging_Header_h #import "Core.h" #endif /* [YourAppName]_Bridging_Header_h */
Step 7. Update your build settings
From the TARGETS list, select your app, and then select the Build Settings tab.
In the search box, search for Other Linker Flags, and then set its value to
-ObjC.Search for Header Search Paths, and then add the path to the root of your app project.
(Optional) If you're using Swift, search for Objective-C Bridging Header, and then set its value to the path of the bridging header that you created in Step 6.
Next step
After you set up the SDK, you need to configure the processing terminal.