engineer
Node.js Examples
Validated REST wrapper examples for integrating with VertexY from Node.js.
Reviewed 2026-06-21Product 1.1
This is not an official SDK package. The examples below show the recommended REST wrapper pattern.
Install dependencies
bash
npm install axiosExample client
javascript
import axios from "axios";
import crypto from "crypto";
const BASE_URL = "https://api.getvertexy.com/api";
export class VertexYClient {
constructor({ companyId, accessToken, webhookSecret }) {
this.companyId = companyId;
this.accessToken = accessToken;
this.webhookSecret = webhookSecret;
this.http = axios.create({
baseURL: BASE_URL,
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
});
}
async assess(payload) {
const { data } = await this.http.post("/risk-engine/assess", payload);
return data;
}
async submitFeedback(payload) {
const { data } = await this.http.post("/risk-engine/feedback", payload);
return data;
}
async getSubscription() {
const { data } = await this.http.get("/subscriptions/me");
return data;
}
async ingestEvent(event) {
const body = JSON.stringify({
...event,
companyId: this.companyId,
});
const timestamp = String(Math.floor(Date.now() / 1000));
const nonce = crypto.randomUUID();
const signature = crypto
.createHmac("sha256", this.webhookSecret)
.update(body)
.digest("hex");
const { data } = await axios.post(`${BASE_URL}/events/ingest`, body, {
headers: {
"Content-Type": "application/json",
"x-event-signature": signature,
"x-event-timestamp": timestamp,
"x-event-nonce": nonce,
},
});
return data;
}
}Usage
javascript
import { VertexYClient } from "./vertexy-client.js";
const client = new VertexYClient({
companyId: process.env.VERTEXY_COMPANY_ID,
accessToken: process.env.VERTEXY_ACCESS_TOKEN,
webhookSecret: process.env.VERTEXY_WEBHOOK_SECRET,
});
const assessment = await client.assess({
transactionId: "txn_100001",
userId: "user_123",
amountMinor: 4999,
currency: "USD",
email: "buyer@example.com",
ipAddress: "203.0.113.10",
});
console.log(assessment.action);
console.log(assessment.riskScore);
await client.ingestEvent({
eventSource: "checkout-service",
externalEventId: "evt_100001",
idempotencyKey: "evt_100001",
userId: "user_123",
eventType: "payment_succeeded",
timestamp: new Date().toISOString(),
metadata: {
email: "buyer@example.com",
ipAddress: "203.0.113.10",
deviceId: "device_abc_001",
},
});Suggested environment variables
bash
export VERTEXY_COMPANY_ID="..."
export VERTEXY_ACCESS_TOKEN="..."
export VERTEXY_WEBHOOK_SECRET="..."Billing checkout is frontend-managed. The SDK examples intentionally do not expose direct checkout helpers.