Environments Overview
Staging (Fin) vs production — URLs, keys, and checkout domains.
DigetPay runs two isolated environments. Use Fin staging to build and test; switch to production only after go-live approval.
Rule of thumb: Staging keys → Fin URLs only. Production keys → live URLs only. Never mix them.
Side-by-side comparison
| Item | Staging (Fin) | Production (Live) |
|---|---|---|
| API base URL | https://fin-api.digetpay.com/v1 | https://api.digetpay.com/v1 |
| Checkout page | https://fin-admin.digetpay.com/pay/checkout | https://partner.digetpay.com/pay/checkout |
| Merchant dashboard | https://fin-admin.digetpay.com | https://admin.digetpay.com |
| API key | Staging x-api-key (from Fin onboarding) | Production x-api-key (issued at go-live) |
| Apple Pay domain | Fin staging domain (DigetPay-managed) | Your production domain (verified with Apple) |
| Real money | No — test traffic only | Yes |
| Purpose | Integration, QA, UAT | Live merchant payments |
Authentication (both environments)
Every payment API request requires the following headers:
{
"headers": {
"x-api-key": "YOUR_ENVIRONMENT_API_KEY",
"Content-Type": "application/json"
}
}Key points:
- Replace
YOUR_ENVIRONMENT_API_KEYwith your actual staging or production key - Always include
Content-Type: application/jsonfor JSON payloads - Use the correct key for the environment you're targeting
Security critical: Store keys in environment variables or a secrets manager — never in frontend JavaScript or Git repositories. Exposed keys can compromise your account.
Staging (Fin) — when to use
Use Fin staging when you:
- Complete technical onboarding with DigetPay
- Run quick start guides or implement hosted checkout
- Validate webhooks against test transactions
- Walk through the staging guide checklist before production
Staging benefits:
- Test all payment flows without real money
- Experiment with different currencies and amounts
- Validate your webhook handlers
- Ensure error handling works correctly
Example — create payment link on staging
curl -X POST "https://fin-api.digetpay.com/v1/payment/checkout/intiate" \
-H "x-api-key: YOUR_STAGING_KEY" \
-H "Content-Type: application/json" \
-d '{
"merchantOrderId": "TEST-001",
"amount": 0.20,
"currency": "SAR",
"customerPhone": "501223324",
"successUrl": "https://fin-admin.digetpay.com/pay/checkout/success",
"failureUrl": "https://fin-admin.digetpay.com/pay/checkout/failure"
}'Response example:
{
"checkoutUrl": "https://fin-admin.digetpay.com/pay/checkout?token=...",
"status": "pending",
"merchantOrderId": "TEST-001"
}Production (Live) — when to use
Switch to production only after:
- Business onboarding is complete with DigetPay
- Go-live checklist is signed off by your account manager
- You receive production API credentials from DigetPay
- All staging tests pass and are documented
Production requirements:
- Use HTTPS for all endpoints
- Implement proper error handling and logging
- Monitor transaction success rates
- Have a support contact established with DigetPay
Example — same call on production
curl -X POST "https://api.digetpay.com/v1/payment/checkout/intiate" \
-H "x-api-key: YOUR_PRODUCTION_KEY" \
-H "Content-Type: application/json" \
-d '{
"merchantOrderId": "PROD-001",
"amount": 10.50,
"currency": "SAR",
"customerPhone": "501223324",
"successUrl": "https://yoursite.com/payment/success",
"failureUrl": "https://yoursite.com/payment/failure"
}'Important: Replace successUrl and failureUrl with your own HTTPS endpoints. These must be publicly accessible and return appropriate HTTP status codes.
PHP configuration pattern
Use a single config switch in your integration to manage both environments:
<?php
$config = [
'staging' => [
'api_base' => 'https://fin-api.digetpay.com/v1',
'checkout_base' => 'https://fin-admin.digetpay.com/pay/checkout',
'dashboard' => 'https://fin-admin.digetpay.com',
],
'production' => [
'api_base' => 'https://api.digetpay.com/v1',
'checkout_base' => 'https://partner.digetpay.com/pay/checkout',
'dashboard' => 'https://admin.digetpay.com',
],
];
// Load environment from .env or system variable
$env = getenv('DIGETPAY_ENV') ?: 'staging';
$base = $config[$env]['api_base'];
$apiKey = getenv('DIGETPAY_API_KEY');
// Example usage
$endpoint = $base . '/payment/checkout/initiate';Best practices:
- Store
DIGETPAY_ENVandDIGETPAY_API_KEYin.envfile (never commit to Git) - Use different API keys for staging and production
- Log which environment you're using on startup
- Implement environment validation before making requests
Legacy staging URL
Some older internal documentation references https://staging-api.digetpay.com/v1. Do not use this URL for new integrations. Always use https://fin-api.digetpay.com/v1 for staging, as it:
- Matches the current OpenAPI specification
- Aligns with the Postman collection
- Receives ongoing support and updates
- Is the official staging endpoint
Common integration patterns
Node.js / JavaScript
const API_BASE = process.env.DIGETPAY_ENV === 'production'
? 'https://api.digetpay.com/v1'
: 'https://fin-api.digetpay.com/v1';
const headers = {
'x-api-key': process.env.DIGETPAY_API_KEY,
'Content-Type': 'application/json'
};Python
import os
API_BASE = os.getenv('DIGETPAY_API_BASE', 'https://fin-api.digetpay.com/v1')
API_KEY = os.getenv('DIGETPAY_API_KEY')
headers = {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
}Troubleshooting environment issues
Problem: "Invalid API key" error
- Verify you're using the correct key for the environment
- Check that the key hasn't expired
- Ensure no extra whitespace in the key value
Problem: "Endpoint not found" (404)
- Confirm you're using the correct base URL for your environment
- Check for typos in the endpoint path
- Verify the API version in the URL matches your documentation
Problem: Webhooks not firing
- Ensure your webhook URLs are publicly accessible
- Verify HTTPS is enabled on your endpoints
- Check that your firewall allows DigetPay IP ranges
- Confirm webhook configuration in your merchant dashboard
Checklist before go-live
- All staging tests completed and documented
- Webhook handlers tested with real staging transactions
- Error handling implemented for all payment scenarios
- Production API credentials received from DigetPay
- Production URLs configured in your application
- HTTPS enabled on all callback endpoints
- Logging and monitoring set up
- Support contact established with DigetPay
- Go-live checklist signed off by account manager
- Team trained on production procedures
Reference: API endpoints by environment
Staging (Fin):
- API:
https://fin-api.digetpay.com/v1 - Dashboard:
https://fin-admin.digetpay.com - Checkout:
https://fin-admin.digetpay.com/pay/checkout
Production (Live):
- API:
https://api.digetpay.com/v1 - Dashboard:
https://admin.digetpay.com - Checkout:
https://partner.digetpay.com/pay/checkout
Updated 14 days ago
