Search
⌃K
Links

Security

How you can securely connect to SoftPOS SDK

Android Package Name

You need to Register your package name in Nearpay , you can register the package name using Nearpay dashboard
1- You need to login to nearpay dashboard here.
2- go to Apps tab and click add new app to add new package name.
3-add the package name of you android app and the name of the app.
if the package name is not registered in NearPay system , you won't be able to communicate with our system .

Setting up terminals

you need to set up the terminal in order to use it for performing transaction
1- login to Nearpay dashboard
2- add new merchant
3- Go to TRSMs tab and Create TRSM (any 6 digits)
4- Go to Terminal tab and Create Terminal by selecting the merchant and the TRSM

​
🔗
Login from SDK

We have 4 method for login
1- Let the user enter the mobile number or email to Login
AuthenticationData.UserEnter
2-Login with existing mobile number
AuthenticationData.Mobile("+966500000000")
3-Login with existing email
AuthenticationData.Email("[email protected]")
4- Login with JWT
AuthenticationData.Jwt("jwt here")

Allowing your user to login using mobile, email and UserEnter

There are few steps to do in Nearpay Dashboard to allow the user to login from SDK using email and mobile number.
1- Login to Nearpay Dashboard
2- Go to Terminals Tab
3- Go to terminal details
4- Access -> Invite user -> enter user details and invite.
Once the user is added to the terminal , they can login from SDK and select the terminal to perform transaction

Allowing your user to login using JWT

To be able to connect your user device to a terminal id please use your backend to sign the JWT with flowing data
1- Login to Nearpay Dashboard.
2- Go to credentials page.
3- You will find the following:
  • Client UUID : you will use as client_uuid
  • JWT Key : Once you click generate , it will download a file which is the private key (pos_key.pem) that you will use to sign the JWT.
4- for terminal_id , you can find all the terminals you have in terminals page and select one
TypeScript
JavaScript
import * as fs from 'fs';
import * as jwt from 'jsonwebtoken';
​
function getToken() {
var privateKey: Buffer = fs.readFileSync('./pos_key.pem');
​
var terminal:any = {
data:{
ops: "auth",
client_uuid: "212f66c6-bbfd-4fc7-9f50-31a749145cd1", // provided by nearpay
terminal_id: "1000003000000006"// get this number from mada
}
}
​
return jwt.sign(terminal, privateKey, { algorithm: "RS256"});
}
​
const fs = require('fs');
const jwt = require('jsonwebtoken');
​
function getToken() {
var privateKey = fs.readFileSync('./pos_key.pem');
​
var terminal = {
data:{
ops: "auth",
client_uuid: "212f66c6-bbfd-4fc7-9f50-31a749145cd1", // provided by nearpay
terminal_id: "1000003000000006"// get this number from mada
}
}
​
return jwt.sign(terminal, privateKey, { algorithm: "RS256"});
}