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 over the entire {bizType, data} envelope 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. The synthetic JWKS below matches the worked example in this section; obtain the actual keys from your environment for live callbacks.
kid identifies a platform signing public key; it is not the public key itself. The platform sends this identifier in the callback’s X-Signature-Key-Id header; its value in this example is example-callback-key. Find the object in the JWKS keys array whose kid exactly matches this header. That object’s decoded x is the verification public key. Put the header’s kid string in the verification payload, not x or the public-key contents. OristaPay periodically rotates callback signing keys and their kid values. Cache JWKS per environment using Cache-Control and ETag, 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

The callback URL is the public HTTPS address you provide to OristaPay to receive callbacks. OristaPay sends a POST to that address; this example uses https://merchant.example.com/webhooks/order-status. The order notification below uses synthetic values and abbreviated business fields. For a real callback, use the complete body you receive.
callback-example.http
Derive target from that same callback URL that OristaPay POSTs to: remove the scheme, host and port, keeping the path starting with /. If query parameters are present, also keep the ? separator and the original query after it. This is also the part between POST and HTTP/1.1 in the external HTTP request line above. If the callback URL you provide includes query parameters, for example:
callback-target-example.txt
Do not pass the full URL, an OristaPay business API URL you call, your website’s home page, or an internal route rewritten by a reverse proxy. Build the verification payload from the callback you just received, in this order. example-client-id and example-callback-key are demonstration values from the two headers above; do not hardcode these example strings in your integration. For the complete POST example above without query parameters, the body is one line of UTF-8 JSON, 133 bytes with no trailing newline. Its SHA-256 is the last line below. Joining the nine lines with LF (\n) gives this exact verification payload:
callback-example-payload.txt
Encode this payload as UTF-8, with no trailing newline. Select the public key with the same kid from the example JWKS above, decode X-Signature, and verify it against these bytes. The signature is valid; the customer verifies the received signature rather than generating a new one.

Details that affect verification

  • Hash the raw body before parsing JSON. Do not parse and re-serialize it, change field order, remove empty fields, trim whitespace, or add a newline. Each changes the signed bytes. Pass the raw byte array to the verification function.
  • Use the original external target. Include the leading /, path and raw query, without scheme or host. Preserve path case, a trailing /, query order and duplicate parameters. Do not decode %2F to / or + to a space. If a reverse proxy rewrites the internal URL, preserve the original external path/query. The example target is /webhooks/order-status.
  • Keep every payload value and line exact. Use CALLBACK and include kid. Copy the received timestamp and nonce unchanged; do not generate replacements or convert milliseconds to seconds or a date string. Use LF, not CRLF, with no indentation or newline after the final hash. X-Signature-Version selects protocol v2 but is not an extra payload line.
  • Use the specified encodings. The body hash is lowercase hex. X-Signature is unpadded Base64URL: 86 characters decoding to 64 bytes. JWK x decodes to a 32-byte Ed25519 public key. Use Ed25519 directly on the payload bytes, not Ed25519ph or an extra hash of the payload. HTTP header names are case-insensitive; preserve their values.
  • Use the platform key for the correct environment and kid. The public key used to verify callbacks comes from the platform JWKS, separately from your API request-signing key.
  • Separate signature checks from freshness checks. This is a fixed historical example. For an offline replay of the complete sample function, set the test clock to its timestamp. Live receivers must retain the ±5-minute check and replay protection; an old callback can have a valid signature and still be rejected as expired.

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.

Notification type and business reference

The JSON body is an envelope with two fields: After verifying the complete raw body and applying replay protection, parse the envelope, require a string bizType and object data, then dispatch by the exact bizType value. Do not dispatch by kid, nonce, an order status or guessed body shapes. The callback types documented in the Digital Wallet and ISV APIs are: For orders, match data.orderNo to the platform order number returned when creating the order. If you supplied extOrderNo, data.extOrderNo links to your own original order. Refunds additionally carry data.refundOrderNo. Onboarding uses application references; whitelist notifications identify an address item rather than an order. These references are separate from the notification type. Keep verified notifications with an unsupported bizType for investigation and alert rather than guessing a handler or marking the business operation complete. Only acknowledge HTTP 2xx after durable acceptance; use 5xx if you cannot retain the notification. Accept additional business fields for forward compatibility. Some payloads have no unique event ID or operation version. Apply idempotency to the relevant business operation/state; do not permanently suppress future operations merely because an address or order ID repeats. Reconcile with the corresponding query API when the current state or event order is uncertain.
This envelope requires the corresponding platform callback release. Older JSON callbacks placed business fields at the root; clients must read them from data after migration. This is a body-format change, separate from X-Signature-Version. Keep the existing signature function and pass the entire raw envelope, not only data. During a rolling release, previously created deliveries may still have the old body shape; coordinate the migration window with the platform. There is no per-customer format switch.

Callback verification examples

Pass the JWKS keys array, callback headers, target derived from the actual callback URL as shown above, and raw body bytes; 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