Overview
88Pay uses a two-layer authentication system to ensure secure API access:- API Credentials (API Key + Merchant ID) - Long-lived identifiers
- Access Tokens (JWT) - Short-lived authorization tokens
All API requests must include both a valid Access Token and Session ID in the headers.
Authentication Flow

Step 1: Obtain API Credentials
Get Your API Key and Merchant ID
1
Login to Dashboard
Visit dash.88pay.io and log in with your credentials.
2
Navigate to Settings
Click on Settings in the bottom left of the navigation menu.
3
Upload Required Documents
Go to Account Details and upload all required documents. Your credentials will only be available after document approval.
4
Get API Credentials
Navigate to API Credentials section. You’ll find:
- API Key: Your pre-generated authentication key
- Merchant ID: Your unique merchant identifier
Step 2: Generate Access Token
Use your API credentials to generate a short-lived JWT token.Endpoint
Headers
| Header | Type | Required | Description |
|---|---|---|---|
x-api-key | string | ✅ Yes | Your API Key from the dashboard |
x-merchant-id | string | ✅ Yes | Your Merchant ID |
Request
Success Response (200 OK)
Error Responses
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
Solution: Contact [email protected]
429 Too Many Requests
429 Too Many Requests
Solution: Implement token caching and respect rate limits
Step 3: Use Token in API Requests
Include the access token and session ID in all subsequent API requests.Required Headers
| Header | Value | Description |
|---|---|---|
Authorization | Bearer {access_token} | JWT token from auth response |
x-session-id | {session_id} | Session identifier from auth response |
Content-Type | application/json | Required for POST requests |
Example Request
Token Management
Token Lifecycle
1
Generate
Call
/api/auth/token with your credentials2
Use
Make API requests within 60 seconds
3
Expire
Token automatically expires after 60 seconds
4
Refresh
Generate a new token when needed
Best Practices
Cache Tokens
Store tokens for up to 50 seconds and reuse them for multiple requests
Handle Expiration
Implement automatic token refresh when receiving 401 errors
Secure Storage
Never store credentials in client-side code
Rate Limiting
Don’t generate tokens too frequently (max 10/minute)
Token Caching Example
Security Best Practices
Environment Variables
Environment Variables
Store credentials in environment variables, never in code:
Server-Side Only
Server-Side Only
Never expose credentials on the client side:❌ Don’t do this:✅ Do this instead:
HTTPS Only
HTTPS Only
Always use HTTPS for API requests. HTTP requests will be rejected.
IP Whitelisting
IP Whitelisting
Enable IP whitelisting in your dashboard for production environments.
Rotate Keys Regularly
Rotate Keys Regularly
Rotate your API keys every 90 days and immediately if compromised.
Environments
88Pay provides separate credentials for each environment:- Sandbox
- Production
Base URL:
https://api-sandbox.88pay.io- Use for development and testing
- No real money is transferred
- Test cards and accounts available
- Separate credentials from production
Rate Limits
Token generation is rate-limited to prevent abuse:| Limit Type | Sandbox | Production |
|---|---|---|
| Requests per minute | 10 | 10 |
| Requests per hour | 100 | 100 |
Testing Authentication
Use this checklist to verify your authentication setup:1
Verify Credentials
✅ API Key starts with
✅ Merchant ID follows format
sk_test_ (sandbox) or sk_live_ (production)✅ Merchant ID follows format
MCH-{COUNTRY}-{ID}2
Test Token Generation
✅ Successfully generate a token
✅ Receive
✅ Token expires after 60 seconds
✅ Receive
access_token and session_id✅ Token expires after 60 seconds
3
Test API Request
✅ Make a request with the token
✅ Include both Authorization and x-session-id headers
✅ Receive successful response
✅ Include both Authorization and x-session-id headers
✅ Receive successful response
4
Test Error Handling
✅ Handle expired tokens (401)
✅ Handle invalid credentials (401)
✅ Handle rate limiting (429)
✅ Handle invalid credentials (401)
✅ Handle rate limiting (429)
Troubleshooting
401 Unauthorized - Invalid token
401 Unauthorized - Invalid token
401 Unauthorized - Invalid credentials
401 Unauthorized - Invalid credentials
Missing x-session-id header
Missing x-session-id header
Problem: Session ID not included in requestSolution:
- Include
x-session-idheader in all requests - Use the session_id from the token generation response
429 Rate Limit Exceeded
429 Rate Limit Exceeded
Problem: Too many token generation requestsSolution:
- Implement token caching
- Wait before retrying
- Reduce request frequency

