In a Nutshell:To interact with the Transactpay API, you must authenticate every request using your Secret or Public Key. Your account supports both Test Mode and Live Mode, and keys differ by mode.
Understanding authentication is essential for working with the Transactpay API. This guide covers the differences between Test and Live modes, how to find your API keys, and how to securely authorize your API requests.
Test Mode vs Live Mode
Your Transactpay account supports two environments:
Mode | Description |
---|---|
✅ Live | For real money transactions. Use only in production. |
🧪 Test | Simulates payments. Perfect for testing and development environments. |
Test Mode Note:In Test Mode, you can still receive webhooks, email alerts, and simulate transactions with test accounts. Most features work the same as Live Mode.
Switching Between Modes
Toggle between Live Mode and Test Mode in the top-right corner of your Transactpay Dashboard.

API Keys
When your account is created, Transactpay generates three types of API keys:
Key Type | Description |
---|---|
Secret Key | Full access to your account. Keep it private and secure. |
Public Key | Safe to expose in front-end code. Used for client-side interactions. |
Encryption Key | Used to encrypt payloads for Direct Card Charges. |
How to Retrieve Your API Keys
- Log in to your Transactpay Dashboard
- Go to Settings
- Open the API Keys & Webhooks tab
- Copy your Public, Secret, or Encryption keys as needed
Security Warning:
- Do NOT share your Secret Key.
- Do not commit it to source control.
- Always store it in environment variables or secret managers.
How to Authorize API Requests
To authenticate with the API, send your Secret Key in the Authorization
header as a Bearer token:
Authorization: Bearer YOUR_SECRET_KEY
If a request is made without proper authentication, you’ll receive a 401 Unauthorized
error.
Example in JavaScript (Node.js)
const axios = require('axios');
let data = JSON.stringify({
"data": ""
});
let config = {
method: 'post',
url: 'https://payment-api-service.transactpay.ai/payment/order/create',
headers: {
'Authorization': 'Bearer YOUR_SECRET_KEY',
'Content-Type': 'application/json'
},
data: data
};
axios.request(config)
.then(response => {
console.log(JSON.stringify(response.data));
})
.catch(error => {
console.error(error);
});
Other Languages
Prefer cURL, Python, or Java?Check out the Code Samples section in our docs for examples in multiple programming languages.