Documentation

Official JavaScript SDK for Benchmark — secure escrow, vendor trust verification, and payment infrastructure for e-commerce platforms.

npm install squadbenchjs

Installation

npm install squadbenchjs

Quick Start

const Benchmark = require('squadbenchjs');

const benchmark = new Benchmark({
  apiKey: process.env.BENCHMARK_API_KEY,
  baseUrl: 'https://api.benchmark.dev',
  webhookSecret: process.env.BENCHMARK_WEBHOOK_SECRET,
});

For Marketplaces and Platforms

Create a developer account, generate your API key, and start creating escrow transactions.

For Vendors

const Benchmark = require('squadbenchjs');

const benchmark = new Benchmark({
  baseUrl: 'https://api.benchmark.dev',
});

const { vendor, token } = await benchmark.vendors.register({
  business_name: 'Chukwu Electronics',
  category: 'Electronics',
  phone: '+2348012345678',
  payout_account_number: '0123456789',
  payout_bank_code: '000013',
  location_state: 'Lagos',
});

Vendors API

Register Vendor

await benchmark.vendors.register({
  business_name: 'Chukwu Electronics',
  category: 'Electronics',
  phone: '+2348012345678',
  nin: '12345678901',
  payout_account_number: '0123456789',
  payout_bank_code: '000013',
  location_state: 'Lagos',
});

Start Verification

const { session_id } = await benchmark.vendors.startVerification();

Get Vendor Score

const score = await benchmark.vendors.getScore('vendor-uuid');

Get Vendor Badge (SVG)

const svgMarkup = await benchmark.vendors.getBadge('vendor-uuid');

Escrow API

Create Escrow Transaction

const escrow = await benchmark.escrow.create({
  vendor_id: 'vendor-uuid',
  amount: 45000,
  item_description: 'Samsung Galaxy A54',
  buyer_phone: '+2348099999999',
});

console.log(escrow.checkout_url);

Confirm Delivery

await benchmark.escrow.confirmDelivery(confirmationToken);

Submit Dispute (AI-Powered)

const dispute = await benchmark.escrow.dispute(transactionId, 'I never received my package.');

B2B API (For Marketplaces)

Create Escrow on Behalf of Vendor

const escrow = await benchmark.b2b.createEscrow({
  vendor_id: 'vendor-uuid',
  amount: 25000,
  item_description: 'Order #12345',
  buyer_phone: '+2348088888888',
});

List Verified Vendors

const { vendors } = await benchmark.b2b.listVendors({
  category: 'Electronics',
  location_state: 'Lagos',
  page: 1,
  limit: 20,
});

Programmatic Fund Release

await benchmark.b2b.releaseEscrow(transactionId, confirmationToken);

Webhooks

app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  const valid = benchmark.webhooks.validate(
    req.body.toString(),
    req.headers['x-squad-signature']
  );

  if (!valid) return res.status(401).send('Invalid signature');

  const event = benchmark.webhooks.parse(req.body);

  switch (event.event) {
    case 'charge.successful':
      // Trigger AI anomaly detection pipeline
      break;
    case 'transfer.success':
      // Vendor funds released
      break;
  }

  res.sendStatus(200);
});

Ready to integrate?

Get your API key and start protecting transactions in minutes.