Environments Overview

Staging (Fin) vs production — URLs, keys, and checkout domains.

DigetPay uses one Payment API base URL and one Merchant Dashboard for both Test Mode and Live Mode. The API key you send decides which mode a request runs in.

Use this page as the source of truth for the API base URL, API keys, and the rules for moving from Test to Live.

📘

Rule of thumb: The API base URL never changes. Your Test API Key runs demo payments and your Live API Key processes real payments. Switch the key and the mode configuration, not the URL.


Test and Live comparison

ItemTest ModeLive Mode
PurposeDevelopment, testing, and validationLive merchant payments
API base URLhttps://api.digetpay.com/v1https://api.digetpay.com/v1
Merchant Dashboardhttps://pay.digetpay.com/https://pay.digetpay.com/
API keyTest API Key (x-api-key)Live API Key (x-api-key)
Checkout pageUse the redirectUrl returned by the APIUse the redirectUrl returned by the API
WebhooksTest Webhook ConfigurationLive Webhook Configuration
Test CardsWork with the Test API KeyNot applicable; customers pay with real cards
Real paymentsNoYes
Typical useIntegration, QA, and UATLive payment processing

Mode rules

Test Mode

Use Test Mode with your Test API Key to:

  • Build and test your integration
  • Validate successful and failed payment flows with Test Cards
  • Test webhook delivery to your Test webhook destination
  • Verify status checks, refunds, and error handling
  • Run integration and UAT testing
  • Complete the required go-live readiness checks

Test Mode transactions do not process real money.

Live Mode

Use your Live API Key only after:

  1. Business onboarding is complete
  2. Your integration has passed the required Test Mode tests
  3. Go-live approval has been granted
  4. You have access to your Live API Key
  5. Your Live webhook configuration, monitoring and callback URLs have been reviewed and are ready for live traffic

Live Mode transactions process real payments.

Live warning: Do not use your Live API Key for development or experimentation. Test new integration changes with your Test API Key before deploying them to Live.


Authentication

Payment API requests use the x-api-key header.

x-api-key: YOUR_API_KEY
Content-Type: application/json

Use the key for the mode you want to run:

  • Test API Key → demo payments
  • Live API Key → real payments

You can find both keys in the Merchant Dashboard at pay.digetpay.com.

Separate credentials

The Merchant Payment API key is different from other credentials such as SDK tokens (for SoftPOS, SmartPOS and mobile SDKs) and Merchant Portal access tokens. Each credential applies only to its own product. See Authentication & Credentials for details.

Keep API keys server-side

Store API keys in a secrets manager or protected environment variable. Never expose API keys in frontend JavaScript, mobile application source code, or public repositories.


Create a payment in Test Mode

Send the request to the API base URL with your Test API Key.

curl -X POST "https://api.digetpay.com/v1/payment/checkout/intiate" \
  -H "x-api-key: YOUR_TEST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantOrderId": "TEST-001",
    "amount": 0.20,
    "currency": "SAR",
    "customerPhone": "501223324",
    "successUrl": "https://your-domain.com/payment/success",
    "failureUrl": "https://your-domain.com/payment/failure"
  }'

Replace YOUR_TEST_API_KEY with your Test API Key. Redirect the customer to the redirectUrl returned in the response and pay with a Test Card.

For the complete request and response schema, see Create Payment Link.


Switch to Live Mode

After go-live approval, replace the Test API Key with your Live API Key and enable your Live webhook configuration. The API base URL stays the same.

curl -X POST "https://api.digetpay.com/v1/payment/checkout/intiate" \
  -H "x-api-key: YOUR_LIVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantOrderId": "LIVE-001",
    "amount": 10.50,
    "currency": "SAR",
    "customerPhone": "501223324",
    "successUrl": "https://your-domain.com/payment/success",
    "failureUrl": "https://your-domain.com/payment/failure"
  }'

The request structure remains the same. Only the following change:

  • API key (Test → Live)
  • Webhook configuration (Test Webhook → Live Webhook)
  • Live callback and redirect URLs, if they differ from your Test URLs

Your successUrl and failureUrl should point to your own publicly accessible application URLs. Redirect URLs are not proof of payment; always confirm the final transaction status with the Status API on your server.


Configuration pattern

Keep the API key outside your application code and load it per deployment. The base URL is a constant.

<?php

$apiBase = 'https://api.digetpay.com/v1';

// Test API Key in development/QA; Live API Key in your live deployment.
$apiKey = getenv('DIGETPAY_API_KEY');
const API_BASE = 'https://api.digetpay.com/v1';

// Test API Key in development/QA; Live API Key in your live deployment.
const API_KEY = process.env.DIGETPAY_API_KEY;
import os

API_BASE = "https://api.digetpay.com/v1"

# Test API Key in development/QA; Live API Key in your live deployment.
API_KEY = os.getenv("DIGETPAY_API_KEY")

Configuration best practices

  • Keep Test and Live API keys separate and name them clearly.
  • Store secrets in protected environment variables or a secrets manager.
  • Never hard-code your Live API Key.
  • Never switch an application to the Live API Key automatically; make it a deliberate deployment step.
  • Use separate webhook URLs for Test and Live so Test events never reach live systems.
  • Test configuration changes with your Test API Key before deploying them to Live.

Migrating from older documentation

Earlier versions of the DigetPay documentation, sample code, Postman collections and plugin guides may refer to separate staging hostnames, a separate staging dashboard, or a different base URL per environment. These instructions no longer apply.

If you integrated using those instructions:

  • Set your API base URL to https://api.digetpay.com/v1.
  • Use the Merchant Dashboard at pay.digetpay.com to get your Test and Live API keys.
  • Remove any logic that switches the API base URL by environment.
  • Remove any code that builds the checkout URL. Use the redirectUrl returned by the API.
  • Re-test with your Test API Key before using your Live API Key.

Troubleshooting

Invalid API key

Check that:

  • You are using the Test API Key or Live API Key you intend to use.
  • The key has been copied correctly from the Merchant Dashboard.
  • The key has not been revoked or replaced.
  • No extra spaces or invalid characters were added.
  • The key is sent in the x-api-key header.

Endpoint not found

Check that:

  • Your API base URL is https://api.digetpay.com/v1.
  • The endpoint path matches the current API reference.
  • The request is using the correct HTTP method.

Payment works with the Test API Key but not the Live API Key

Check that:

  • Go-live approval has been completed.
  • You are using your Live API Key and the same API base URL.
  • Test Cards are not being used for live payments.
  • Your Live webhook configuration and callback and redirect URLs are accessible.
  • The Live configuration matches your approved merchant setup.

Webhooks are not received

Check that:

  • You configured the webhook for the correct mode. Test and Live webhook destinations are configured separately in the Merchant Dashboard.
  • Your webhook URL is publicly accessible.
  • Your endpoint uses HTTPS where required.
  • Your webhook configuration is active.
  • Your application accepts incoming webhook requests.
  • Your server logs show whether the webhook request reached your endpoint.

A webhook is a notification. Always confirm the final payment status with the Status API before fulfilling an order.

See Webhooks for the complete webhook configuration and handling guide.


Before switching to Live

Before you send live traffic with your Live API Key, confirm that:

  • Your integration has been tested successfully in Test Mode with Test Cards.
  • Successful and failed payment scenarios have been tested.
  • Webhook handling has been tested with your Test webhook destination.
  • Your server confirms the final transaction status with the Status API before fulfillment.
  • You have access to your Live API Key.
  • Your Live webhook configuration is set up with its own destination.
  • Callback and redirect URLs are accessible.
  • Secrets are stored securely.
  • Monitoring and error logging are enabled.
  • The required go-live approval has been completed.

Ready to accept live payments? Continue with the Go-Live Checklist.



Did this page help you?