PayOrc
Testing

API Keys

Generate, manage, and secure your PayOrc API keys for live and test environments.

API Keys Overview

PayOrc API keys authenticate your requests to the payment gateway. You need both a merchant-key and a merchant-secret for every API call. Keys are environment-specific — separate keys exist for live (production) and test (sandbox) environments.

API keys are generated per channel. Each integration type (Hosted Solution, SDK, Payment Link, etc.) has its own dedicated key pair.

Generating API Keys

To generate your API keys:

  1. Log in to the PayOrc Merchant Dashboard.
  2. Navigate to Developers → API Keys.
  3. Click Add new API key.
  4. Select the channel for this key.
  5. Copy and securely store both the key and secret immediately — the secret is only shown once.

API Key Channels

Each channel serves a specific integration type:

ChannelUse Case
Hosted SolutionPayment Request API and Manage Payment APIs
SDK/PluginsSDK and plugin integrations
Payment LinkPayment Link APIs
SubscriptionSubscription Plan APIs
InvoiceInvoice APIs
S2SServer-to-Server Seamless API (Payment, MOTO, CAUTH)

Do not reuse keys across channels. A key generated for the Hosted Solution channel will not work for S2S integrations.

Live vs Test Keys

PayOrc provides two environments with separate credentials:

EnvironmentKey FormatSecret FormatPurpose
Livelive-XXXXXXXXXXsec-XXXXXXXXXXProduction transactions with real money
Testtest-XXXXXXXXXXsec-XXXXXXXXXXSandbox testing with no real charges

When to Use Test Keys

  • During development and integration testing
  • QA and staging environment validation
  • Demo and proof-of-concept implementations
  • Training new team members on the API

When to Use Live Keys

  • Production deployments only
  • After completing thorough testing in the sandbox
  • When processing real customer payments

Never use live keys in development, staging, or client-side code. Accidental live transactions are difficult to reverse.

Using API Keys in Requests

Include both keys in the request headers for every API call:

curl -X POST "https://api.payorc.com/orders/v1/create" \
  -H "merchant-key: live-XXXXXXXXXX" \
  -H "merchant-secret: sec-XXXXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{"amount": 100, "currency": "AED"}'

Key Rotation

Key rotation is the practice of periodically generating new API keys and retiring old ones. This limits the impact of compromised credentials.

Rotation Schedule

Risk LevelRecommended Rotation
LowEvery 90 days
MediumEvery 60 days
HighEvery 30 days or immediately after suspected breach

Rotation Steps

  1. Generate a new key pair in the Merchant Dashboard under Developers → API Keys.
  2. Update your application to use the new key pair.
  3. Test thoroughly in the sandbox environment with test keys first.
  4. Deploy the changes to production.
  5. Delete the old key from the Dashboard once you confirm the new key works.

Never delete an old key before confirming the new key is working in production. Keep both keys active during the transition period.

Environment Variables

Store your API keys in environment variables — never hardcode them in source code.

export PAYORC_MERCHANT_KEY="live-XXXXXXXXXX"
export PAYORC_MERCHANT_SECRET="sec-XXXXXXXXXX"
export PAYORC_ENV="live"  # or "test"

Add .env files to your .gitignore to prevent accidental credential leaks to version control.

Security Best Practices

Follow these guidelines to keep your API credentials secure:

Do's

  • ✅ Store keys in environment variables or a secrets manager (e.g., AWS Secrets Manager, HashiCorp Vault)
  • ✅ Use test keys during development and CI/CD pipelines
  • ✅ Rotate keys periodically
  • ✅ Restrict key permissions by channel (only generate keys for channels you use)
  • ✅ Monitor API usage for unusual patterns
  • ✅ Use HTTPS for all API calls (never HTTP)

Don'ts

  • ❌ Never hardcode keys in source code
  • ❌ Never commit keys to Git repositories
  • ❌ Never expose keys in client-side JavaScript or mobile apps
  • ❌ Never share keys over unencrypted channels (email, Slack DMs)
  • ❌ Never use live keys for testing
  • ❌ Never reuse keys across multiple applications without isolation

Using a Secrets Manager

import boto3
import json

client = boto3.client('secretsmanager')
secret = client.get_secret_value(SecretId='payorc/api-keys')
keys = json.loads(secret['SecretString'])

# Use keys['merchant_key'] and keys['merchant_secret']

Set up alerts in your monitoring system for failed authentication responses (HTTP 401/403). This can indicate a key has been compromised or rotated prematurely.

On this page