Getting Started
SDKs

SDKs

Two official SDKs are published for server-side integration: Node.js and PHP. Both are thin wrappers over the REST API, and both take three repetitive jobs off your hands: Ed25519 request signing, caching the token and renewing it when it expires, and unwrapping the response envelope.

Client SDKs that run in the browser or inside a mobile app are a separate family. → Web SDK Overview · Mobile SDK Overview

Node.js

npm install @lunixi/node-sdk
const { LunixiClient } = require('@lunixi/node-sdk');
 
const lunixi = new LunixiClient({
  baseUrl: 'https://api-gateway.lunixi.com',
  keyId: process.env.LUNIXI_KEY_ID,
  privateKey: process.env.LUNIXI_PRIVATE_KEY_PEM,
});
 
const token = await lunixi.tokens.getToken();
OptionRequiredDefault
baseUrlyes—
keyIdyes—
privateKeyyes—
timeoutMsno30000
maxRetriesno2

Node.js 18 or newer is required. You can also generate the key pair with the SDK:

const { publicKey, privateKey } = LunixiClient.generateKeyPair();

Register the public key in the dashboard and keep the private key on your own server only.

TypeScript type definitions ship with the package.

What the Node.js SDK covers:

ProductAccess
Paymentslunixi.payments
Payment linkslunixi.paymentLinks
Fraud decisions and eventslunixi.fraud
Webhook signature verificationWebhookVerifier

Subscription, KYC, sanction, marketplace and identity endpoints are not in the Node.js SDK; use the PHP SDK or the REST flow below for those.

PHP

composer require lunixi/php-sdk
use Lunixi\Sdk\LunixiClient;
 
$lunixi = LunixiClient::create([
    'baseUrl'     => 'https://api-gateway.lunixi.com',
    'keyId'       => getenv('LUNIXI_KEY_ID'),
    'privateKey'  => getenv('LUNIXI_PRIVATE_KEY_PEM'),
    'environment' => 'LIVE',
]);
 
$decision = $lunixi->fraud()->evaluate($request);

PHP 7.4 or newer with ext-sodium, ext-curl, ext-json and ext-hash. environment accepts only LIVE or TEST.

Clients reachable through the facade: payments(), paymentLinks(), subscriptions(), fraud(), kyc(), sanction(), marketplace(), identity(), webhooks().

Other languages

Official server-side SDKs exist only for Node.js and PHP. From any other language you can call the REST API directly; the section below describes the signing flow.

REST without an SDK

Using an SDK is not mandatory. The only difference is that you handle signing and token management yourself.

The flow has two steps. First you obtain a token with a request signed by your Ed25519 private key:

curl -X POST https://api-gateway.lunixi.com/api/v1/auth/token \
  -H "X-Key-Id: $LUNIXI_KEY_ID" \
  -H "X-Date: $DATE" \
  -H "X-Nonce: $NONCE" \
  -H "X-Signature: $SIGNATURE"

Then you call endpoints with the returned access_token:

curl -X POST https://api-gateway.lunixi.com/api/v1/fraud/decisions/evaluate \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "transactionRef": "order-2026-0001", "subjectId": "order-2026-0001" }'
⚠️

Your API key does not go into the Authorization header directly. The key only produces the signature that obtains a token; the value you send to endpoints is the access_token returned by that call. → Authentication

A token lives for 5 minutes. Rather than minting a new one on every call, cache it and renew based on expires_at — the SDKs do this for you.

Related