Search
K
Links
Comment on page

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 following this path:
Login to NearPay dashboard here -> Go to Apps -> Add New App -> Add the Package Name after that the name of the android 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:
Login to NearPay dashboard here -> Go to Terminals -> Create Terminal ->Create TRSM (Any 6 Digits) -> Choose whether to assign this an existing merchant (if there's a merchant) or a new merchant.

🔗
Login from SDK

We have 4 methods 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"});
}