> For the complete documentation index, see [llms.txt](https://docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verifone.com/psdk-latest/psdk-user-guide-and-training/psdk-user-guide/setup.md).

# Project Setup

## Android Initial Setup Guide <a href="#android-initial-setup-guide" id="android-initial-setup-guide"></a>

### Adding PaymentSDK library to the Android project <a href="#adding-paymentsdk-library-to-the-android-project" id="adding-paymentsdk-library-to-the-android-project"></a>

1. Place PaymentSDK-xxxxx.aar file in the project at specific location(e.g. Project/app/libs).
2. Go to File->Project Structure->Dependencies, select Modules(app), select ‘+’, choose **Jar dependency**, provide file path and choose configuration as **implementation**.
3. Go to ‘File->Project Structure->Modules->app->DefaultConfig->Min SDK Version’, Set minSdkVersion to 24 and above.
4. AndroidX and other configuration options are required to use any Activities or Fragments provided by the PSDK.
5. If the reference apps are being compiled on newer versins of Mac (M1 or M2) make sure to enable Rosetta on the machines.
6. The targetSdkVersion must be 26 or greater.
7. `android.useAndroidX=true` and `android.enableJetifier=true` must be set in the project’s gradle.properties file.
8. The module’s gradle file must have data binding enabled and the compile options compatibility must support 1.8 or greater.

   ```gradle
   android {
       dataBinding {
           enabled = true
       }
       compileOptions {
           sourceCompatibility 1.8
           targetCompatibility 1.8
       }
   }
   ```
9. Add the following dependencies to the application’s build.gradle. The versions can be updated as needed.
   * `implementation 'androidx.appcompat:appcompat:1.1.0'`
   * `implementation 'androidx.constraintlayout:constraintlayout:1.1.3'`
   * `implementation 'androidx.recyclerview:recyclerview:1.1.0'`

***

## iOS Initial Setup Guide <a href="#ios-initial-setup-guide" id="ios-initial-setup-guide"></a>

### Adding PaymentSDK Framework to the iOS project <a href="#adding-paymentsdk-framework-to-the-ios-project" id="adding-paymentsdk-framework-to-the-ios-project"></a>

1. In Xcode IDE, Drag **“PaymentSdk.xcframework”** into the project. It opens **“Choose options for adding these files:”**.
   1. At **“Destination:”**, put tick mark at “Copy items if needed”.
   2. At **“Added folders:”**, select “Create folder references”.
   3. At **“Add to targets:”**, select project.
2. Click on main project file, under **“TARGETS”** select project.
   1. Go to **“General”** tab.
   2. Click on small triangle at **“Frameworks, Libraries and Embedded Content”**.
   3. Select **“PaymentSdk.xcframework”**.
   4. Under **“Embed”**, select **“Embed & Sign”**.
3. Update project’s **Info.plist**.
   1. Add these privacy usage descriptions.
      1. NSBluetoothAlwaysUsageDescription
      2. NSBluetoothPeripheralUsageDescription
      3. NSCameraUsageDescription
   2. Add Supported external accessory protocols **“UISupportedExternalAccessoryProtocols”** if you are using Blutooth.
      1. com.verifone.pmr.xpi
      2. com.verifone.pmr.debug
      3. com.verifone.pmr.control
      4. com.verifone.pmr.barcode
      5. com.verifone.pmr.zontalk

***

## Windows Setup <a href="#windows-dot-net-initial-setup-guide" id="windows-dot-net-initial-setup-guide"></a>

### Visual Studio Project Setup <a href="#visual-studio-project-setup" id="visual-studio-project-setup"></a>

1. Open Visual Studio installer. Click “Modify” on the Visual Studio tile.
2. Select “Modify” on the Visual Studio tile.
3. In the “Workloads” tab, select the “Universal Windows Platform development” tile.
4. In the “Individual Components” tab, select the compatible version of “Windows SDK” checkbox.
5. Select “Modify”.
6. Different versions of Windows 10 builds will be compatible with different “Windows SDK” versions. To select the correct version go to Settings->System->About and check your OS build.
7. In the “Individual Components” tab select the Windows SDK version with the same OS build version number. E.g. OS build 17763.678 and Windows SDK 10.0.17763.0.
8. Enable logging in Visual Studio to show PSDK logs as follows.
   * Go to your project’s properties.
   * Select the “Debug” tab on the left.
   * There should be a section labeled “Debugger type”.
     * Change “Application process:” to “Mixed (Managed and Native)”.
     * Change “Background task process:” to “Mixed (Managed and Native)”.
9. To enable network access for inbound and outbound, open Payckage.appxmanifest. Check “Internet (Client & Server)” for public network. Check “Private Networks (Client & Server)” for private network.

### NuGet Package Setup <a href="#nuget-package-setup" id="nuget-package-setup"></a>

1. Open an existing solution or create a new UWP project.
2. Tools → NuGet Package Manager → Manage NuGet Packages for Solution.
3. In Package source, there will be a settings button, click and add a new package source directory in the settings window. The Package source directory is the directory where the Nuget packages are located.
4. Install both “Verifone.PaymentSDK” and “Verifone.PaymentSdkUi” as these two packages would show up once the package source is added correctly.

***

## Windows Dot Net Initial Setup Guide <a href="#windows-dot-net-initial-setup-guide" id="windows-dot-net-initial-setup-guide"></a>

### Visual Studio Project Setup <a href="#visual-studio-project-setup" id="visual-studio-project-setup"></a>

1. Open Visual Studio installer and install .Net Framework 4.6.
2. Open DotNetReferenceApp.sln with Visual Studio.
3. Inside Solution Explorer, in project DotNetReferenceApp.sln, right click “References”, then add VerifoneSdk dll.
4. Deploy on local machine with green start menu.

***

## Linux Initial Setup Guide <a href="#linux-initial-setup-guide" id="linux-initial-setup-guide"></a>

### CMake project setup <a href="#cmake-project-setup" id="cmake-project-setup"></a>

1. Install C++17 compatible compiler toolchain. Refer to your distribution documentation for more information.
2. Install CMake. See <https://cmake.org> for additional information.
3. Unzip PaymentSDK. We will refer to the created directory as PSDK\_DIR.
4. Create a directory for your project. We will refer to this directory as PROJ\_DIR.
5. In the PROJ\_DIR create an example C++ main.cpp source file with following content:<br>

   <pre class="language-cpp" data-overflow="wrap" data-full-width="true"><code class="lang-cpp">#include &#x3C;functional>
   #include &#x3C;iostream>
   #include &#x3C;string>
   #include &#x3C;unordered_map>

   #include "CommerceListener2.hpp"
   #include "CommerceEvent.hpp"
   #include "NativePlatformContext.hpp"
   #include "PaymentSdkInterface.hpp"
   #include "PlatformContextInterface.hpp"
   #include "PsdkDeviceInformation.hpp"
   #include "ScannerDataEvent.hpp"
   #include "ScannerStateEvent.hpp"
   #include "Status.hpp"
   #include "StatusCode.hpp"
   #include "TransactionEvent.hpp"
   #include "AmountAdjustedEvent.hpp"
   #include "BasketAdjustedEvent.hpp"
   #include "BasketEvent.hpp"
   #include "CardInformationReceivedEvent.hpp"
   #include "DeviceManagementEvent.hpp"
   #include "LoyaltyReceivedEvent.hpp"
   #include "PaymentCompletedEvent.hpp"
   #include "ReceiptDeliveryMethodEvent.hpp"
   #include "StoredValueCardEvent.hpp"
   #include "UserInputEvent.hpp"
   #include "ReconciliationEvent.hpp"
   #include "ReconciliationsListEvent.hpp"
   #include "TransactionQueryEvent.hpp"
   #include "HostAuthorizationEvent.hpp"
   #include "HostFinalizeTransactionEvent.hpp"
   #include "NotificationEvent.hpp"
   #include "PrintEvent.hpp"
   #include "DeviceVitalsInformationEvent.hpp"
   #include "PinEvent.hpp"

   // Converts a listener class to using lambdas
   class Listener : public verifone_sdk::CommerceListener2 {
    public:
     typedef std::function&#x3C;void(const int&#x26;)> HandleEventListener;
     Listener(HandleEventListener listener) : listener_(listener) {}
     ~Listener() override = default;
     void handleCommerceEvent(const std::shared_ptr&#x3C;verifone_sdk::CommerceEvent> &#x26;event) override {
       listener_(event->getStatus());
     };
     void handleTransactionEvent(const std::shared_ptr&#x3C;verifone_sdk::TransactionEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleAmountAdjustedEvent(const std::shared_ptr&#x3C;verifone_sdk::AmountAdjustedEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleBasketAdjustedEvent(const std::shared_ptr&#x3C;verifone_sdk::BasketAdjustedEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleBasketEvent(const std::shared_ptr&#x3C;verifone_sdk::BasketEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleCardInformationReceivedEvent(const std::shared_ptr&#x3C;verifone_sdk::CardInformationReceivedEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleDeviceManagementEvent(const std::shared_ptr&#x3C;verifone_sdk::DeviceManagementEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleLoyaltyReceivedEvent(const std::shared_ptr&#x3C;verifone_sdk::LoyaltyReceivedEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handlePaymentCompletedEvent(const std::shared_ptr&#x3C;verifone_sdk::PaymentCompletedEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleReceiptDeliveryMethodEvent(const std::shared_ptr&#x3C;verifone_sdk::ReceiptDeliveryMethodEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleStoredValueCardEvent(const std::shared_ptr&#x3C;verifone_sdk::StoredValueCardEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleUserInputEvent(const std::shared_ptr&#x3C;verifone_sdk::UserInputEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleReconciliationEvent(const std::shared_ptr&#x3C;verifone_sdk::ReconciliationEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleReconciliationsListEvent(const std::shared_ptr&#x3C;verifone_sdk::ReconciliationsListEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleTransactionQueryEvent(const std::shared_ptr&#x3C;verifone_sdk::TransactionQueryEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleHostAuthorizationEvent(const std::shared_ptr&#x3C;verifone_sdk::HostAuthorizationEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleHostFinalizeTransactionEvent(const std::shared_ptr&#x3C;verifone_sdk::HostFinalizeTransactionEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleNotificationEvent(const std::shared_ptr&#x3C;verifone_sdk::NotificationEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handlePrintEvent(const std::shared_ptr&#x3C;verifone_sdk::PrintEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handleScannerDataEvent(const std::shared_ptr&#x3C;verifone_sdk::ScannerDataEvent>&#x26; event) override {
       listener_(event->getStatus());
     }
     void handleScannerStateEvent(const std::shared_ptr&#x3C;verifone_sdk::ScannerStateEvent>&#x26; event) override {
       listener_(event->getStatus());
     }
     void handleStatus(const std::shared_ptr&#x3C;verifone_sdk::Status> &#x26; status) override {
       listener_(status->getStatus());
     }
     void handleDeviceVitalsInformationEvent(const std::shared_ptr&#x3C;verifone_sdk::DeviceVitalsInformationEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
     void handlePinEvent(const std::shared_ptr&#x3C;verifone_sdk::PinEvent> &#x26; event) override {
       listener_(event->getStatus());
     }
    private:
     HandleEventListener listener_;
   };

   int main() {
     std::unordered_map&#x3C;std::string, std::string> param_map{
         {verifone_sdk::PsdkDeviceInformation::DEVICE_ADDRESS_KEY, "192.168.1.10"},
         {verifone_sdk::PsdkDeviceInformation::DEVICE_CONNECTION_TYPE_KEY, "tcpip"}};

     int last_status;

     auto psdk = verifone_sdk::PaymentSdkInterface::create(
         verifone_sdk::CreateNativePlatformContext(std::nullopt));
     auto listener =
       std::make_shared&#x3C;Listener>([&#x26;last_status](const int &#x26;status) {
         last_status = status;
       });
     psdk->initializeFromValues(listener, param_map);
     if (last_status == verifone_sdk::StatusCode::SUCCESS) {
       auto transaction_manager = psdk->getTransactionManager();
       return 0;
     }
     return 1;
   }
   </code></pre>
6. In the same directory create an example CMakeLists.txt file with following content (replacing placeholders <> with full paths and also the LIBRARY\_NAME with libPaymentSdk.so for ‘standard’ and libPaymentSdkSdi.so for ‘sdi’):<br>

   ```cmake
   cmake_minimum_required(VERSION 3.5)

   set(CMAKE_CXX_STANDARD 17)
   set(CMAKE_CXX_STANDARD_REQUIRED ON)

   # Note that PSDK is built using C++03 ABI, hence disabling C++11 ABI
   set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0)

   add_executable(PSDK_Test main.cpp)

   target_include_directories(PSDK_Test PRIVATE "<PSDK_DIR>/include")
   target_link_libraries(PSDK_Test "<PSDK_DIR>/lib/<LIBRARY_NAME>")
   ```
7. Generate make files and compile executable by running the following in the PROJ\_DIR:<br>

   ```shell-session
   cmake .
   cmake --build .
   ```
8. Run the produced executable from the PROJ\_DIR. You should see a couple of log messages informing about PSDK initialization, this indicates successfull linking:<br>

   ```shell
   ./PSDK_Test
   ```

***

## Java Initial Setup Guide (Gradle) <a href="#java-initial-setup-guide-gradle" id="java-initial-setup-guide-gradle"></a>

1. Requires a minimum OpenJDK version of 1.8 and an existing Java project.
2. In the project directory, add a “libs” folder.
3. Copy PaymentSdk-x.x.x-java.jar into the “libs” folder.
4. Update build.gradle to add “implementation files(‘libs/PaymentSdk-x.x.x-java.jar’)” under “dependencies”.

***

{% columns %}
{% column width="25%" %}

<figure><img src="/files/9ezXRridnCaI1awLr3X9" alt="" width="150"><figcaption></figcaption></figure>
{% endcolumn %}

{% column width="25%" %}

{% endcolumn %}

{% column width="16.66666666666666%" %}
**Version:**\
**Date:**
{% endcolumn %}

{% column width="33.333333333333336%" %} <code class="expression">space.vars.psdk\_version</code>\ <code class="expression">space.vars.psdk\_date</code>
{% endcolumn %}
{% endcolumns %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verifone.com/psdk-latest/psdk-user-guide-and-training/psdk-user-guide/setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
