Skip to main content

Quick start

Make your first API call in three steps:

Credentials

IP allowlists

Exchange and confirm both parties’ public egress IPs before integration testing, separately for UAT and PRD. Do not use private IPs or gateway ingress IPs resolved from DNS. IP allowlisting does not replace authentication or signature verification.

Environments

Authentication & Signing

Accessing OristaPay Open APIs requires dual authentication:
  • OAuth2 Access Token — proves the caller’s identity
  • Request signature — protocol v2 (Ed25519) — proves the request was signed by your private key and has not been tampered with
Every request must pass both checks; otherwise it is rejected.
Signature protocol v1 (HMAC-SHA256) remains supported and is scheduled to reach EOL on 2027-01-31 at 24:00 (UTC+8) for API requests and JSON callbacks. Use signature protocol v2 (Ed25519) for new integrations.
v1/v2 refer to the platform’s signature protocol versions, specified by X-Signature-Version.

1. Obtain Access Token

Standard OAuth2 client_credentials flow (UAT example below). Request (URL-encode form parameter values)
Response
Usage Constraints
  • access_token can be reused within expires_in seconds. Cache it and refresh proactively 30 seconds before expiry.
  • access_token must be issued by the OAuth client corresponding to X-Api-Key.
Using merchant A’s api_key with merchant B’s access_token will be rejected.

2. Signature protocol v2 (Ed25519)

Generate your own Ed25519 key pair. Provide only the public key to OristaPay and keep the private key secure. Generate the key pair using OpenSSL:

String to Sign

Join the following fields with LF (\n), encode as UTF-8, and do not add a trailing newline:

Signature Calculation

Use Ed25519, not Ed25519ph. The signature is 86 Base64URL characters without =. Sign and send the same body bytes; preserve query order and percent-encoding. Do not decode the URL, re-serialize JSON, or reuse a signature after a redirect.

Field Definitions

Reference Implementations

ed25519_example.py

V2 request headers

API requests do not use X-Signature-Key-Id. Re-sign every retry with a fresh timestamp and nonce; v2 nonces are retained for 11 minutes. Keep the business idempotency key unchanged.

3. Callback signature verification

For JSON callbacks, verify the platform’s signature with its public key. OAuth tokens are not required. Business events and payloads are described in the relevant API’s Callback section.

Retrieve and cache the platform JWKS

This public endpoint requires no token or signature. Use your environment’s configured HTTPS gateway.
OristaPay periodically rotates callback signing keys and their kid values. Cache JWKS per environment using Cache-Control and ETag. Select the public key matching X-Signature-Key-Id in the callback headers and validate the JWK fields above. An unknown kid or failed verification may indicate an expired local key cache or key rotation. Refresh /public/callback/keys with rate limiting, then retry verification once using the same kid. Reject if verification still fails, the key is missing, or refresh fails. Never try a different kid, accept a callback-supplied key URL, or fall back to HMAC.

V2 callback headers and payload

Use the same encoding rules as requests. Verify the original external callback path and raw query, including when a reverse proxy rewrites the internal URL.

Verification and acknowledgement

  1. Reject missing or duplicate signature headers. Check version 2, expected client ID, and timestamp (±5 minutes).
  2. Select the platform key by kid and verify against the raw body bytes, before parsing JSON.
  3. After verification, atomically store (client_id, nonce) for at least 11 minutes to prevent replay. Reject if verification or replay storage fails.
  4. Apply business idempotency using a stable event key. Nonce is not an idempotency key: retries receive a new signature and nonce.
  5. Return HTTP 2xx promptly after durable acceptance. Only HTTP status acknowledges delivery; 429, 5xx and network failures are retried, other 4xx are not.

Callback verification examples

Pass the JWKS keys array, callback headers, original path/query and raw body; the expected client ID comes from your configuration. Reject duplicate signature headers first, and apply replay protection and business idempotency after verification.
callback_verify.py

4. Migration checklist

  1. Register your Ed25519 public key and switch API requests to v2.
  2. Add JWKS retrieval and v2 callback verification. Coordinate the callback version separately with the platform.
  3. Complete both migrations before the protocol v1 EOL. Dispatch by version during migration; never fall back after a verification failure.
OAuth2 and its client_secret remain unchanged.

5. Signature protocol v1 (HMAC-SHA256, EOL: 2027-01-31)

V1 uses the shared sign_secret. Omit X-Signature-Version or set it to 1 while v1 is enabled.

String to Sign

Signature Calculation

Field Definitions

Reference Implementations

Legacy v1 request headers

All business requests must carry the following headers:

Legacy v1 callback verification

Before the cutoff, clients explicitly configured for JSON/HMAC callbacks verify using their shared sign_secret:
V1 callbacks omit the version header or use 1, with no kid. Use the decoded URL path without query and compare HMAC in constant time. Apply the client, timestamp, replay and acknowledgement checks in §3.

Request & Response Conventions

Protocol Specification

Response Envelope

Downstream business responses use a single-layer JSON { code, message, data? }, without additional gateway wrapping. Successful response Business code code = 1, business data in data:
Business / Downstream Error Downstream business errors still return HTTP 200, with error details expressed by code / message:
When downstream gRPC is unreachable or times out, HTTP status remains 200, code is a negative integer (negated gRPC StatusCode, e.g. -14 for UNAVAILABLE), with connection error details in message. Gateway-Level Error For routing failures, internal gateway errors, missing descriptors, and similar errors, the HTTP status reflects the error (e.g. 400 / 404 / 500 / 502). The response is a single-layer JSON object with error details in message or reason:
  • HTTP 2xx does not imply business success or guarantee downstream delivery; always check the business code
  • Business code code reflects business layer results: 1 means business success with result in data; other values indicate errors, with details in message or reason
  • How to determine success: HTTP 2xx + business code == 1. Both conditions must be met
  • Authentication/signature errors may use {code, reason}; see the checklist below.

Error Handling

HTTP Status Codes & Business Codes

Responses use a single-layer JSON envelope, with error details in message or reason. HTTP status reflects gateway/transport results; business code code reflects business processing results.

Authentication Failure Checklist

For v2 signature rejection, common outcomes include: Check token expiry/client binding first, then version/key, exact payload bytes, clock and nonce uniqueness.

Rate Limiting

Rate Limit Exceeded Response Example
On business code 429, wait for the number of seconds in Retry-After, then retry with a fresh timestamp, nonce and signature. The delay is calculated dynamically; 30 above is only an example.
To adjust your quota, contact your account manager.

Security Recommendations