SDKs

There are no official client libraries yet. The Merchant API is a small, JSON-over-HTTP API whose only non-trivial part is the HMAC request signature, so a complete client is a thin wrapper around your language's standard HTTP and crypto libraries.

A minimal client

The wrapper below signs and sends any request. Build resource methods (charges.create, orders.list, …) on top of it as you need them.

Minimal client

import crypto from "node:crypto";

export class Fluxa {
  constructor({ keyId, secret, baseUrl }) {
    this.keyId = keyId;
    this.secret = secret;
    this.baseUrl = baseUrl;
  }

  async request(method, path, body) {
    const ts = Math.floor(Date.now() / 1000).toString();
    const payload = body ? JSON.stringify(body) : "";
    const bodyHash = crypto.createHash("sha256").update(payload).digest("hex");
    const [signPath, rawQuery = ""] = path.split("?");
    const canonicalQuery = rawQuery ? rawQuery.split("&").sort().join("&") : "";
    const canonical = [method.toUpperCase(), signPath, canonicalQuery, ts, bodyHash].join("\n");
    const signature = crypto.createHmac("sha256", this.secret).update(canonical).digest("hex");

    const res = await fetch(this.baseUrl + path, {
      method,
      headers: {
        "X-Api-Key": this.keyId,
        "X-Timestamp": ts,
        "X-Signature": signature,
        "Content-Type": "application/json",
      },
      body: payload || undefined,
    });
    const json = await res.json();
    if (!res.ok) {
      throw Object.assign(new Error(json.error?.message), {
        code: json.error?.code,
        status: res.status,
      });
    }
    return json;
  }

  // Example resource method.
  createCharge(input) {
    return this.request("POST", "/api/v1/charges", input);
  }
}

Interactive reference

Your fluxa deployment also serves an interactive Swagger UI at /docs and the raw OpenAPI document at /openapi.yaml. The Swagger UI page can sign Merchant API requests in your browser — paste a key id and secret and it computes the X-Api-Key / X-Timestamp / X-Signature headers for each "Try it out" call.