Payment Tokens
This payment token system is being deprecated and will be replaced with a more streamlined authentication approach in the near future. We recommend staying tuned for updates on the new authentication system. While this system will continue to function for existing implementations, we encourage new integrations to wait for the upcoming authentication solution.
Overview
Payment tokens are used to securely authenticate and authorize API requests to the NGnair Payments platform. This guide will walk you through managing payment tokens, including creating, listing, and deleting tokens.
Authentication
All API requests must include your authentication token in the request headers:
token: Your authentication token
Example:
-H 'token: tok_123456789'
API Reference
List Payment Tokens
Retrieve a list of all payment tokens associated with your account.
POST /api/gateway/getServiceTokens
-H 'token: string'
-H 'Content-Type: application/json'
{
"data": {}
}
Response:
{
"tokens": [
{
"groupID": "string",
"token": "string",
"secret": "string",
"active": boolean,
"ipWhitelist": ["string"],
"allowedMethods": ["string"],
"createdAt": "string",
"updatedAt": "string",
"expiresAt": "string"
}
]
}
Create Payment Token
Create a new payment token with specified permissions and IP whitelist.
POST /api/gateway/createServiceToken
-H 'token: string'
-H 'Content-Type: application/json'
{
"data": {
"groupID": "string",
"permissions": ["string"],
"ipWhitelist": ["string"]
}
}
Response:
{
"groupID": "string",
"token": "string",
"secret": "string",
"active": boolean,
"ipWhitelist": ["string"],
"allowedMethods": ["string"],
"createdAt": "string",
"updatedAt": "string",
"expiresAt": "string"
}
Delete Payment Token
Remove a payment token from your account.
POST /api/gateway/deleteServiceToken
-H 'token: string'
-H 'Content-Type: application/json'
{
"data": {
"id": "string"
}
}
Response:
{
"id": "string"
}
Sample API Requests
List Payment Tokens Example
Request:
POST /api/gateway/getServiceTokens
-H 'token: tok_123456789'
-H 'Content-Type: application/json'
{
"data": {}
}
Response:
{
"tokens": [
{
"groupID": "group_123",
"token": "tok_abc123",
"secret": "sec_xyz789",
"active": true,
"ipWhitelist": ["192.168.1.1", "10.0.0.1"],
"allowedMethods": ["GET", "POST"],
"createdAt": "2024-03-20T10:00:00Z",
"updatedAt": "2024-03-20T10:00:00Z",
"expiresAt": "2025-03-20T10:00:00Z"
}
]
}
Create Payment Token Example
Request:
POST /api/gateway/createServiceToken
-H 'token: tok_123456789'
-H 'Content-Type: application/json'
{
"data": {
"groupID": "group_123",
"permissions": ["read", "write"],
"ipWhitelist": ["192.168.1.1"]
}
}
Response:
{
"groupID": "group_123",
"token": "tok_new123",
"secret": "sec_new456",
"active": true,
"ipWhitelist": ["192.168.1.1"],
"allowedMethods": ["GET", "POST"],
"createdAt": "2024-03-20T10:00:00Z",
"updatedAt": "2024-03-20T10:00:00Z",
"expiresAt": "2025-03-20T10:00:00Z"
}
Delete Payment Token Example
Request:
POST /api/gateway/deleteServiceToken
-H 'token: tok_123456789'
-H 'Content-Type: application/json'
{
"data": {
"id": "tok_abc123"
}
}
Response:
{
"id": "tok_abc123"
}