Skip to main content

Authentication

Getting an Access Token

Endpoint

POST https://api.paysecurez.com/api/token

Request Examples

curl -X POST "https://api.paysecurez.com/api/token" \
-H "Content-Type: application/json" \
-d '{"client_id": "your-client-id", "client_secret": "your-secret"}'

Response

{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 1800,
"token_type": "Bearer"
}

Using the Token

Include the token in all API requests using the Authorization header:

curl "https://api.paysecurez.com/some-endpoint" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
warning

Tokens expire after 30 minutes. If a token expires, the API will return a 401 Unauthorized response. Request a new token when needed.

Security Recommendation

For optimal security, we recommend requesting a new token for each transaction. This minimizes the risk of token exposure and ensures your integration follows security best practices.

Token Expiration Response

When a token expires or is invalid, the API returns:

{
"statusCode": 401,
"message": "Unauthorized",
"error": "Invalid or expired token"
}

Security Best Practices

  1. Request a new token for each transaction (recommended)
  2. Keep your client credentials secure
  3. Rotate client secrets periodically
  4. Use HTTPS for all API calls
  5. Don't share tokens between applications
  6. Implement proper token storage
  7. Handle 401 responses by requesting a new token