Overview
The Waypay API uses API keys to authenticate requests. You can view and manage your API keys in the Waypay Dashboard.API Keys
Waypay provides two types of API keys:Test Keys
Use these keys during development and testing. They start with
pk_test_Live Keys
Use these keys in production. They start with
pk_live_Key Characteristics
- Test keys process transactions in test mode - no real money is moved
- Live keys process real transactions and charge actual payment methods
- Both environments have separate databases and don’t share data
- API behavior is identical in both environments
Authentication Method
Include your API key in theSWICH-API-Key header:
Example Request
Storing API Keys Securely
Environment Variables (Recommended)
Store your API keys in environment variables:Best Practices
Use Environment Variables
Never hardcode API keys in your source code. Use environment variables or secure configuration management.
Separate Keys by Environment
Use different API keys for development, staging, and production environments.
Restrict Key Permissions
Create separate keys with limited permissions for different services or applications.
Authentication Errors
401 Unauthorized
This error occurs when:- No
SWICH-API-Keyheader is provided - The API key is invalid or has been revoked
- The API key format is incorrect
- Verify your API key is correct and active
- Ensure the header format is exactly:
SWICH-API-Key: YOUR_API_KEY - Check that you’re using the correct key for the environment (test vs live)
- Confirm the key hasn’t been revoked in the dashboard
403 Forbidden
This error occurs when:- The API key doesn’t have permission for the requested resource
- The account is suspended or restricted
API Key Management
Creating API Keys
- Log in to your Waypay Dashboard
- Navigate to Settings → API Keys
- Click Create API Key
- Choose the environment (Test or Live)
- Set permissions and restrictions
- Save the key securely - it will only be shown once
Revoking API Keys
If you suspect a key has been compromised:- Go to Settings → API Keys in your dashboard
- Find the compromised key
- Click Revoke
- Create a new key to replace it
- Update your application with the new key
Testing Authentication
Test your authentication setup with a simple API call:Security Recommendations
Use HTTPS Only
Use HTTPS Only
Always use HTTPS for API requests. Never send API keys over unencrypted HTTP connections.
Implement Key Rotation
Implement Key Rotation
Rotate API keys every 90 days or immediately after team member departures.
Monitor API Usage
Monitor API Usage
Regularly review API logs in your dashboard for unusual activity.
Principle of Least Privilege
Principle of Least Privilege
Grant each API key only the permissions it needs to perform its function.
Secure Key Storage
Secure Key Storage
Use secure key management services (AWS KMS, Azure Key Vault, HashiCorp Vault) in production.
Additional Headers
While theSWICH-API-Key header is required, you may also include optional headers: