Amwal Tech logoDocs

Integration & API Keys

Before integrating with Amwal, make sure you have retrieved your API keys from the Amwal Merchant Dashboard. You need these keys to configure plugins, initialize client checkout components, and authenticate server-side REST API calls.

Amwal Integration Keys Dashboard

Rendering diagram...

Key Types & Scopes

Key TypeEnvironment / ScopeConfiguration & UsageSecurity Level
Sandbox KeyTest EnvironmentUsed as merchant_id or X-Amwal-Key to test services, preview checkout, and simulate payments with test cards.Public (Client-side & Testing)
Production KeyLive EnvironmentGenerated after Go Live approval. Used as merchant_id or X-Amwal-Key for live customer installment transactions on your registered domain.Public (Live Storefronts)
Secret API KeyBackend ServerUsed for secure server-to-server operations, custom API integrations, transaction lookups, and automated refunds.Private / Keep Secret

Retrieving Your Keys

  1. Log in to the Amwal Merchant Dashboard.
  2. Select your Store from the top dropdown menu.
  3. Open the Integration tab:
    • Sandbox Key: Copy the key value directly to initialize test checkouts.
    • Production Key: Click "Go Live" to submit your corporate details for compliance approval. Once verified, your Production Key is displayed here.
    • Secret API Key: Click Reveal to view and copy your private server key.

Authentication & Headers

1. Server-to-Server REST API Requests

When calling the Amwal REST API backend from your secure server (e.g. issuing refunds or retrieving transaction data), provide your credentials in the request headers:

POST /transactions/refund/60b43176-5991-4475-8ef6-c73c2417c805/ HTTP/1.1
Host: backend.sa.amwal.tech
Authorization: YOUR_SECRET_KEY
X-Amwal-Key: YOUR_SANDBOX_OR_PRODUCTION_KEY
Content-Type: application/json
HeaderDescriptionRequired
AuthorizationYour private Secret Key (used to authorize backend operations).Yes
X-Amwal-KeyYour public Sandbox or Production Key (identifies your store entity).Yes
Content-TypeMust be set to application/json.Yes

2. Client-Side Storefront & E-Commerce Plugins

In frontend storefront integrations, mobile apps, or turnkey e-commerce plugins, provide only your public Merchant ID (Sandbox Key or Production Key). Never expose your Secret Key on the client side:

Enter your public Merchant ID (and optional Secret Key for backend automated refunds) in your store administration panel:

Load the official Amwal web component bundle and supply your public key via the merchant-id attribute:

<script
  type="module"
  src="https://cdn.jsdelivr.net/npm/@amwaljs/checkout-button@latest/dist/checkout/checkout.esm.js"
></script>

<amwal-checkout-button
  merchant-id="YOUR_SANDBOX_OR_PRODUCTION_KEY"
  amount="250.00"
  currency="SAR"
  country-code="SA"
  locale="en"
  enable-installments="true"
></amwal-checkout-button>

3. Incoming Webhook Authentication Headers

When Amwal dispatches real-time event notifications to your webhook listener endpoint, the request includes cryptographic verification headers:

HeaderDescriptionExample
X-SignatureBase64-encoded RSA-PSS SHA-256 cryptographic signature.eyJhbGciOiJSUzI1NiJ9...
X-Api-KeyWebhook API key fingerprint.8a7d42f1c4e6ba957beec92f2cad51d0b3ec4f8c9...
Content-TypePayload format.application/json

Security Best Practices

Private Key Governance

  • Never expose your Secret API Key in client-side HTML, frontend JavaScript, mobile app bundles, or public GitHub repositories.
  • Always store private keys in secure backend environment variables (.env).
  • If you suspect your Secret Key has been compromised, generate a new key immediately in the Amwal Merchant Portal and update your backend services.

On this page