pen-to-squareSDK Integration

Use an SDK for the fastest production integration.

Node.js / TypeScript

Install:

npm install @veilio/sdk

Example:

import { VeilioClient } from "@veilio/sdk";

const veilio = new VeilioClient({
  apiKey: process.env.VEILIO_API_KEY!,
  baseUrl: process.env.VEILIO_BASE_URL || "https://app.veilio.xyz/api"
});

export async function createCustomer(email: string) {
  const { token } = await veilio.tokenize({
    data: email,
    type: "email"
  });

  // Store token in your DB, not the raw email.
  return { emailToken: token };
}

export async function sendWelcomeEmail(emailToken: string) {
  const { data: email } = await veilio.detokenize({
    token: emailToken,
    reason: "Send welcome email"
  });

  return email;
}

Bulk operations

For imports, migrations, or high-throughput jobs:

  • tokenizeBulk / tokenize_bulk

  • detokenizeBulk / detokenize_bulk

Use batching and retry logic for 429 responses.

Last updated

Was this helpful?