API reference

Base URL (sandbox): https://sandbox-api.aegispay8.com. Every request except /v1/platform-keys must be signed.

Conventions #

  • Request and response bodies are JSON (UTF-8). Unknown fields are rejected, so typos don't pass silently.
  • Money is a string with exactly two decimals, e.g. "150.00". Never a float.
  • Times are ISO 8601 in UTC, e.g. 2026-11-25T08:00:00.000Z.
  • IDs have a prefix: mch_ merchant, key_ API key, pay_ payment, evt_ webhook event.
  • HTTPS only: plain HTTP gets 403 HTTPS_REQUIRED. Maximum body size is 64 KiB.
  • Errors look like {"error":{"code":…,"message":…,"request_id":…}}. See Errors.

Test your signing #

GET/v1/ping

Does nothing except check your signature. Use it first. POST /v1/ping (any JSON object body, with an Idempotency-Key) also checks body signing and returns the body_sha256 AegisPay computed.

200 OK
{
  "object": "ping",
  "authenticated": true,
  "merchant_id": "mch_xxxxxxxxxxxxxxxxxxxx",
  "key_id": "key_xxxxxxxxxxxxxxxxxxxx",
  "server_time": 1795400000,
  "request_id": "req_xxxxxxxxxxxxxxxxxxxx"
}

Create a payment #

POST/v1/payments

Creates an FPX or DuitNow QR payment and returns its checkout_url. Requires an Idempotency-Key.

Body parameters

ParameterTypeRequiredDescription
amountstringYesTwo decimals, "1.00" to "30000.00".
currencystringNoOnly "MYR" (the default).
methodstringYes"fpx" or "duitnow_qr". Must be enabled for your account.
merchant_referencestringYesYour order ID. 1–64 chars of A-Z a-z 0-9 . _ : / -. Unique forever per merchant: one payment per reference.
descriptionstringNoUp to 255 printable characters. Shown in your dashboard.
customerobjectYesThe payer.
customer.namestringYes1–100 printable characters.
customer.emailstringNoPayer's email address.
return_urlstringNohttps:// URL where the payer's browser returns, with ?aegis_payment_id=… added. Not proof of payment.
callback_urlstringNohttps:// URL for this payment's webhooks. Overrides the default in Settings → Webhooks.
Request body
{
  "amount": "150.00",
  "currency": "MYR",
  "method": "fpx",
  "merchant_reference": "ORDER-1001",
  "description": "Order #1001",
  "customer": { "name": "Siti Aminah", "email": "siti@example.com" },
  "return_url": "https://shop.example.com/orders/1001/return",
  "callback_url": "https://shop.example.com/aegis/webhook"
}

Response

201 Created with a payment object. Normally status is pending and checkout_url is set.

201 Created
{
  "object": "payment",
  "id": "pay_7Hq2xK9mN4pR8sT1aB3c",
  "status": "pending",
  "amount": "150.00",
  "currency": "MYR",
  "method": "fpx",
  "merchant_reference": "ORDER-1001",
  "description": "Order #1001",
  "fee": "2.25",
  "net_amount": "147.75",
  "checkout_url": "https://sandbox-api.aegispay8.com/c/pay_7Hq2xK9mN4pR8sT1aB3c",
  "expires_at": "2026-11-25T08:15:00.000Z",
  "paid_at": null,
  "created_at": "2026-11-25T08:00:00.000Z",
  "updated_at": "2026-11-25T08:00:01.000Z"
}
Status / codeWhenWhat to do
409 DUPLICATE_MERCHANT_REFERENCEA payment with this merchant_reference exists.Use GET to find it, or a new reference for a new attempt.
422 METHOD_NOT_ENABLEDThe method isn't enabled for your account.Ask AegisPay or your agent.
422 AMOUNT_TOO_SMALLThe amount doesn't cover the fee.Use a larger amount.
503 PROVIDER_UNAVAILABLEThe bank network didn't answer in time; outcome unknown.Retry with the SAME Idempotency-Key.
502 PROVIDER_REJECTEDThe bank network refused it; the payment is failed.New payment, new merchant_reference.

Examples

Node.js (aegispay.mjs)
const { status, body } = await aegis.createPayment(
  {
    amount: "150.00",
    method: "fpx",
    merchant_reference: "ORDER-1001",
    customer: { name: "Siti Aminah", email: "siti@example.com" },
    return_url: "https://shop.example.com/orders/1001/return",
  },
  "order-1001-create", // Idempotency-Key
);
if (status === 201) redirectBrowserTo(body.checkout_url);
Python (aegis1.py)
import json, requests
from aegis1 import sign_request, verify_response

body = json.dumps({
    "amount": "150.00", "method": "fpx", "merchant_reference": "ORDER-1001",
    "customer": {"name": "Siti Aminah"}, "return_url": "https://shop.example.com/orders/1001/return",
}, separators=(",", ":")).encode()   # serialise once; send these exact bytes

headers = sign_request(PRIVATE_KEY_PEM, method="POST", host="sandbox-api.aegispay8.com", path="/v1/payments",
                       merchant_id=MERCHANT_ID, key_id=KEY_ID, body=body, idempotency_key="order-1001-create")
headers["Content-Type"] = "application/json"
r = requests.post("https://sandbox-api.aegispay8.com/v1/payments", data=body, headers=headers, allow_redirects=False)

ok = verify_response(PLATFORM_KEYS, status=r.status_code, method="POST", path="/v1/payments", merchant_id=MERCHANT_ID,
                     request_nonce=headers["X-Aegis-Nonce"], headers=r.headers, body=r.content)
if not ok:
    raise RuntimeError("Unverified response: outcome unknown, retry with the same Idempotency-Key")
payment = r.json()

Retrieve a payment #

GET/v1/payments/{id}

Returns your payment by its pay_… ID: the source of truth for its status. Use it on your return page, when a webhook seems late, or to reconcile. Other merchants' payments return 404 PAYMENT_NOT_FOUND.

Node.js
const { status, body: payment } = await aegis.getPayment("pay_7Hq2xK9mN4pR8sT1aB3c");
if (status === 200 && payment.status === "succeeded" && payment.amount === order.amount) {
  // fulfil
}

200 OK with a payment object.

The payment object #

ParameterTypeRequiredDescription
objectstringYesAlways "payment".
idstringYesAegisPay payment ID, pay_….
statusstringYesprocessing, pending, succeeded, failed or expired. See statuses.
amountstringYesAmount the payer pays.
currencystringYes"MYR".
methodstringYesfpx or duitnow_qr.
merchant_referencestringYesYour order ID, as sent.
descriptionstring | nullYesAs sent.
feestringYesAegisPay's fee, fixed at creation.
net_amountstringYesamount − fee: what you receive if it succeeds.
checkout_urlstring | nullYesWhere to send the payer. Set only while pending and not expired.
expires_atstring | nullYesWhen the payer can no longer pay.
paid_atstring | nullYesWhen it succeeded.
created_atstringYesCreation time.
updated_atstringYesLast change.
New fields may be added to responses at any time. Ignore fields you don't know, rather than rejecting the response.

AegisPay's public keys #

GET/v1/platform-keys

Public, no signature needed. Returns the keys AegisPay signs responses and webhooks with. Fetch once and pin them; don't fetch on every request (limit: 120 per minute per IP).

200 OK
{
  "object": "list",
  "algorithm": "RSASSA-PSS-SHA256 (MGF1-SHA256, salt 32)",
  "keys": [
    {
      "key_id": "aegis_xxxxx",
      "status": "active",
      "public_key_pem": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkq...\n-----END PUBLIC KEY-----\n",
      "created_at": "2026-11-23T00:00:00.000Z"
    }
  ]
}

Idempotency #

Every POST needs an Idempotency-Key. Use one key per business operation (e.g. order-1001-create) and reuse it when you retry after a timeout or network error. Each retry still needs a fresh nonce, timestamp and signature.

SituationResult
First request with this keyProcessed normally.
Same key + same request, first one finishedThe original response, returned again (re-signed for your new request).
Same key while the first is still running409 IDEMPOTENCY_IN_PROGRESS: wait a moment and retry.
Same key, different body or path422 IDEMPOTENCY_KEY_REUSED

Keys are kept for 24 hours. merchant_reference is unique forever, so an order can never be charged twice.