NUMUS
Home

Your first API request

List your project’s payment points in the sandbox. Run the example on your server using Node.js 20 or later.

Credentials

Use your partner ID, registered OpenSSH public key and corresponding Ed25519 private key in PEM format.

Run the example

Set the three environment variables in the example. Save the code as points.mjs and run it on your server.

node points.mjs

The JSON response lists accessible points. If access is denied, check permissions, key and server time.

GET /v1/payment-points
import { createHash, randomUUID, sign } from 'node:crypto';
import { readFileSync } from 'node:fs';

const partnerID = process.env.NUMUS_PARTNER_ID;
const key = readFileSync(process.env.NUMUS_PUBLIC_KEY_FILE, 'utf8').trim();
const privateKey = readFileSync(process.env.NUMUS_PRIVATE_KEY_FILE);
const method = 'GET';
const path = '/v1/payment-points';
const timestamp = String(Math.floor(Date.now() / 1000));
const nonce = randomUUID().replaceAll('-', '');
const hash = createHash('sha256').update('').digest('hex');
const message = [timestamp, nonce, method, path, hash].join('\n');
const signature = sign(null, Buffer.from(message), privateKey).toString('base64');

const response = await fetch('https://sandbox-api.numuspay.cc' + path, {
  method,
  redirect: 'error',
  signal: AbortSignal.timeout(10000),
  headers: {
    Accept: 'application/json',
    Authorization: JSON.stringify({ partnerID, key, sign: signature, timestamp, nonce }),
  },
});
if (!response.ok) throw new Error('NUMUS HTTP ' + response.status);
console.log(await response.json());

Essential storage remembers your choice for 180 days. No optional services are currently installed.