# Building Your First App

# Getting Started

# Prerequisites

If you wish to begin developing applications for GoDaddy Poynt, it's important to become familiar with some of our platform's recommendations and prerequisites.

NOTE

It through our Development Guidelines, which will ensure your compliance with our requirements and speed up the review process.

# Adding Poynt SDK

The Poynt SDK (Software Development Kit) is a set of Android tools customized for GoDaddy Poynt to facilitate the development of applications for the PoyntOS environment.

SDKs are strictly related to the latest version of PoyntOS, and they allow developers to code essential features and functionalities into their applications. Currently, PoyntOS SDK is distributed as an Android Library (aar) through our Maven repository.

TIP

You can also refer to the Poynt SDK Java Doc (opens new window) for more information on the subject.

# SDK Dependencies

To begin using the Poynt SDKs, you must include the maven repository in your root build.gradle file.

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://nexus.poynt.com/content/repositories/releases'
        }
    }
}

You must also add the following dependencies to the build.gradle file of the application.

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])

  // Poynt SDK and Model Dependencies
  implementation 'co.poynt.api:android-api-model:<release-version>@jar'
  implementation 'co.poynt.android.sdk:poynt-sdk:<release-version>1@aar'

  // Gson dependency
  compile 'com.google.code.gson:gson:2.8.0@jar'

  // JWT dependencies - if you want to parse JWTs
  compile 'net.jcip:jcip-annotations:1.0@jar'
  compile 'com.nimbusds:nimbus-jose-jwt:2.26@jar'
  compile 'net.minidev:json-smart:1.2@jar'
}

# PoyntOS SDK Samples

To help you navigate our documentation and implement our SDKs based on practical references, we have designed a series of samples using GitHub repositories.

This sample below shows a detailed example of an Android application using PoyntOS SDK.

https://github.com/poynt/PoyntSamples (opens new window)

# Building your First UI

UI (User Interface) refers to the digital space where users can interact with machines and their functionalities. GoDaddy Poynt allows developers to create applications and solutions that help merchants drive business growth with a dynamic and simple user interface.

Since the entire GoDaddy Poynt environment for Smart Terminal Apps is based on a specific version of Android, user interfaces for your applications must be aligned with Android's UI Guidelines (opens new window).

Please keep in mind the following items:

  • Try to anticipate user mistakes and possible incorrect actions.

  • Keep in mind the element for placement and the UI size.

    TIP

    You can find more information about size in the Legacy Emulator Setup section.

  • Keep your interface simple to facilitate learning.

  • Follow general standards for repeated functionalities.

# Onboarding & Authentication

# Website Sign-up

If you would like to access information related to an existing business through app authentication, you can streamline the flow using the Merchant login URL listed below.

The response URL should look similar to the line below:

{URL}?businessId=e3038712-3a08-4a85-859e-c8e0c4b4509d&code=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3BveW50Lm5ldCIsImlhdCI6MTU0NjYyNzE5MiwiZXhwIjoxNTQ2NjI4MDkyLCJzdWIiOiJ1cm46YWlkOmY2YTk3NTMxLWQ3NzItNDBhOC05MTZlLTQ1MDNiZjE4ODA0MyIsInBveW50LmJpeiI6ImUzMDM4NzEyLTNhMDgtNGE4NS04NTllLWM4ZTBjNGI0NTA5ZCIsInBveW50LnVpZCI6MzQ0MTUwODN9.LKX6dSg5hf-xtz0M0uvFtZSOgGKfd90re9z3GouIAkLQo2Yo1AlvAm2Gz43ZvCGyczGDwf7Ja49RE4I4p1iLI75oyhDxn9CRblpDH-HVEoAFVQKmwWFCImwByziKGCwJakCG2KeiZqBISHrqBngMYmIdJCm4PB-znhxBUEXM9X6Ce6UWR7oqcpqwki7majb1Z7rsNEq2Lkj6ORMTqbapsAi2TwuyxSccEnIDvc3RZhF-btPZ5779CrqJz_6ipfHLH5DSo9wQ1fgA9vN_TaVGvZCz7lJV3V2Cvk6iUe3AUOyZk-iN-xHz1DoNt6K2pXhSTPGh_Gj_fjjGk6pBEvkXOA&status=success
  • businessId : The business ID that was authorized

  • code : Encoded JWT with info

  • status : success or fail

The code is an Encoded JWT, decoding it will give you the following block

{
  "iss": "https://poynt.net",
  "iat": 1546627192,
  "exp": 1546628092,
  "sub": "urn:aid:f6a97531-d772-40a8-916e-4503bf188043",
  "poynt.biz": "e3038712-3a08-4a85-859e-c8e0c4b4509d",
  "poynt.uid": 34415083
}
  • sub : The authorized appId

    TIP

    This may be helpful if you have multiple applications

  • poynt.biz : The business ID that was authorized

  • poynt.uid : The GoDaddy Poynt user that performed the authentication

# Terminal Sign-up

If you choose to sign up the merchant on the terminal, you can also pre-fill the information that you can obtain from the Poynt Business Service

# Authentication

Fetch the current logged-in user

 








    sessionService.getCurrentUser(listener);

    private IPoyntSessionServiceListener listener = new IPoyntSessionServiceListener.Stub() {
        @Override
        public void onResponse(Account account, PoyntError poyntError) throws RemoteException {
            Log.d(TAG, account.name);
        }
    };

# Login Prompt

    private View.OnClickListener loginClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.d(TAG, "Login clicked");
            accountManager.getAuthToken(Constants.Accounts.POYNT_UNKNOWN_ACCOUNT,
                    Constants.Accounts.POYNT_AUTH_TOKEN, null, IntroActivity.this,
                    new OnUserLoginAttempt() , null);
        }
    };
    public class OnUserLoginAttempt implements AccountManagerCallback<Bundle>{
        public void run(AccountManagerFuture<Bundle> accountManagerFuture) {
            try {
                Bundle bundle = accountManagerFuture.getResult();
                String user = (String) bundle.get(AccountManager.KEY_ACCOUNT_NAME);
                String authToken = (String) bundle.get(AccountManager.KEY_AUTHTOKEN);
                if (authToken != null) {
                    Toast.makeText(IntroActivity.this, user + " successfully logged in", Toast.LENGTH_LONG).show();
                    Intent loginIntent = new Intent(IntroActivity.this, MainActivity.class);
                    startActivity(loginIntent);
                } else {
                    Toast.makeText(IntroActivity.this, "Login failed", Toast.LENGTH_SHORT).show();
                }
            } catch (OperationCanceledException e) {
                e.printStackTrace();
                Toast.makeText(IntroActivity.this, "Login cancelled", Toast.LENGTH_SHORT).show();
            } catch (IOException | AuthenticatorException e) {
                e.printStackTrace();
            }
        }
    }

# Running your Application

# Using a Poynt Device

If you have an active developer kit, you can run your application following the steps outlined below.

  1. Connect the Smart Terminal to your development machine with a USB cable. If you are using Windows, you may need to Install a USB Driver (opens new window) for your device.

  2. Select your application from the run/debug configurations in Android Studio using the drop-down menu in the tool bar.

  3. In the target device drop-down, select the device on which you want to run your app.

  4. Finally, click on Run to start the app.

    This should automatically install and start your app on the device.

# Using an Emulator

If you are using one of the GoDaddy Poynt Emulators, you can follow the steps below to run your application.

  1. Create a virtual device that the emulator can use to install and start your application.

  2. Find and select your application from the run/debug configurations menu in the tool bar.

  3. In the target device drop-down, select the virtual device on which you want to run your application.

  4. Finally, click on Run to start the app.

    This should automatically install and start your app on the virtual device.

Last Updated: 10/4/2022, 8:01:35 AM