Environment Variables
Create a .env file (recommended):
SALIGPAY_CLIENT_ID=your_client_id
SALIGPAY_CLIENT_SECRET=your_client_secret
SALIGPAY_ENV=sandbox
SDK Configuration Options
interface SaligPayConfig {
/** OAuth Client ID */
clientId?: string;
/** OAuth Client Secret */
clientSecret?: string;
/** Admin API Key for platform operations */
adminKey?: string;
/** Custom base URL (overrides env setting) */
baseUrl?: string;
/** Environment: 'production' | 'sandbox' */
env?: "production" | "sandbox";
/** Request timeout in milliseconds (default: 30000) */
timeout?: number;
/** Enable debug logging */
debug?: boolean;
/** Webhook signature verification secret */
webhookSecret?: string;
}
| Option | Type | Description |
|---|
clientId | string | OAuth Client ID |
clientSecret | string | OAuth Client Secret |
adminKey | string | Admin API Key for platform operations |
baseUrl | string | Custom base URL (overrides env setting) |
env | string | Environment: production or sandbox |
timeout | number | Request timeout in milliseconds (default: 30000) |
debug | boolean | Enable debug logging |
webhookSecret | string | Webhook signature verification secret |
Base URLs
| Environment | URL |
|---|
| Production | https://api.saligpay.com |
| Sandbox | https://sandbox.saligpay.com |
Timeout Option
The timeout option controls the maximum time to wait for API responses. The default is 30000ms (30 seconds).
const saligpay = new SaligPay({
clientId: process.env.SALIGPAY_CLIENT_ID!,
clientSecret: process.env.SALIGPAY_CLIENT_SECRET!,
env: "production",
timeout: 60000, // 60 seconds for slower connections
});
Debug Option
Enable debug mode to log all requests and responses:
const saligpay = new SaligPay({
clientId: process.env.SALIGPAY_CLIENT_ID!,
clientSecret: process.env.SALIGPAY_CLIENT_SECRET!,
env: "sandbox",
debug: true, // Logs requests/responses to console
});
Webhook Secret
The webhookSecret is used to verify incoming webhook signatures:
const saligpay = new SaligPay({
clientId: process.env.SALIGPAY_CLIENT_ID!,
clientSecret: process.env.SALIGPAY_CLIENT_SECRET!,
webhookSecret: process.env.SALIGPAY_WEBHOOK_SECRET!,
env: "production",
});
Example Configuration
// Using environment variables (recommended)
const saligpay = new SaligPay({
clientId: process.env.SALIGPAY_CLIENT_ID,
clientSecret: process.env.SALIGPAY_CLIENT_SECRET,
env: process.env.SALIGPAY_ENV as "production" | "sandbox",
});
// Custom base URL for staging/testing
const saligpayStaging = new SaligPay({
clientId: "your-id",
clientSecret: "your-secret",
baseUrl: "https://staging-api.saligpay.com",
});
// Full configuration with all options
const saligpayFull = new SaligPay({
clientId: process.env.SALIGPAY_CLIENT_ID!,
clientSecret: process.env.SALIGPAY_CLIENT_SECRET!,
adminKey: process.env.SALIGPAY_ADMIN_KEY,
env: "production",
timeout: 30000,
debug: false,
webhookSecret: process.env.SALIGPAY_WEBHOOK_SECRET,
});
Last modified on