Connect API
Production API keys for every platform
Hash-only secrets (zb_live_ / zb_test_), scoped access, origin allowlists, and per-key rate limits — wire real orders into LedgerMesh.
Platform connectors
React / Next.js
Server-side fetch with zb_live_ key. Never expose secrets in the browser.
Suggested preset: invoicing · npm i (no SDK required — fetch)
// server-only (API route / server action)
const res = await fetch('https://books.tinyzipper.com/api/v1/books/connect?action=invoices', {
headers: {
Authorization: 'Bearer ' + process.env.ZIPPERBOOKS_API_KEY,
},
cache: 'no-store',
});
const data = await res.json();
// Create invoice from checkout
await fetch('https://books.tinyzipper.com/api/v1/books/connect', {
method: 'POST',
headers: {
Authorization: 'Bearer ' + process.env.ZIPPERBOOKS_API_KEY,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
action: 'create_invoice',
party: { display_name: 'Customer', email: 'buyer@example.com' },
lines: [{ description: 'Order #1001', quantity: 1, unit_price_cents: 4999 }],
}),
});
WordPress
Paste key in wp-config.php. Use for forms, membership, and custom plugins.
Suggested preset: invoicing · define('ZIPPERBOOKS_API_KEY', 'zb_live_…');
<?php
// functions.php or custom plugin
function zb_create_invoice($name, $email, $amount_cents, $desc) {
$body = wp_json_encode([
'action' => 'create_invoice',
'party' => ['display_name' => $name, 'email' => $email],
'lines' => [[
'description' => $desc,
'quantity' => 1,
'unit_price_cents' => (int) $amount_cents,
]],
]);
$res = wp_remote_post('https://books.tinyzipper.com/api/v1/books/connect', [
'headers' => [
'Authorization' => 'Bearer ' . ZIPPERBOOKS_API_KEY,
'Content-Type' => 'application/json',
'Idempotency-Key' => wp_generate_uuid4(),
],
'body' => $body,
'timeout' => 20,
]);
return json_decode(wp_remote_retrieve_body($res), true);
}
WooCommerce
Hook thankyou / payment_complete → orders:write posts sale into LedgerMesh.
Suggested preset: commerce · ZipperBooks Woo plugin or snippet below
<?php
add_action('woocommerce_payment_complete', function ($order_id) {
$order = wc_get_order($order_id);
if (!$order) return;
wp_remote_post('https://books.tinyzipper.com/api/v1/books/connect', [
'headers' => [
'Authorization' => 'Bearer ' . ZIPPERBOOKS_API_KEY,
'Content-Type' => 'application/json',
'Idempotency-Key' => 'woo-' . $order_id,
],
'body' => wp_json_encode([
'action' => 'sync_order',
'external_id' => 'woo_' . $order_id,
'platform' => 'woocommerce',
'customer' => [
'display_name' => $order->get_formatted_billing_full_name(),
'email' => $order->get_billing_email(),
],
'total_cents' => (int) round($order->get_total() * 100),
'currency' => $order->get_currency(),
'memo' => 'WooCommerce order #' . $order->get_order_number(),
'paid' => $order->is_paid(),
]),
]);
});
Shopify
Admin app or webhook worker posts paid orders with orders:write scope.
Suggested preset: commerce · Private app / custom app → store zb_live_ as secret
// Node webhook handler (orders/paid)
export async function POST(req) {
const order = await req.json();
await fetch('https://books.tinyzipper.com/api/v1/books/connect', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ZIPPERBOOKS_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': `shopify-${order.id}`,
},
body: JSON.stringify({
action: 'sync_order',
external_id: `shopify_${order.id}`,
platform: 'shopify',
customer: {
display_name: order.customer?.first_name + ' ' + (order.customer?.last_name || ''),
email: order.email,
},
total_cents: Math.round(Number(order.total_price) * 100),
currency: order.currency,
memo: `Shopify #${order.name}`,
paid: order.financial_status === 'paid',
}),
});
return new Response('ok');
}
Wix
Velo backend HTTP function — keep the key in Secrets Manager.
Suggested preset: invoicing · Wix Secrets → ZIPPERBOOKS_API_KEY
// Backend → http-functions.js
import { ok, badRequest } from 'wix-http-functions';
import { getSecret } from 'wix-secrets-backend';
import { fetch } from 'wix-fetch';
export async function post_createBooksInvoice(request) {
const body = await request.body.json();
const key = await getSecret('ZIPPERBOOKS_API_KEY');
const res = await fetch('https://books.tinyzipper.com/api/v1/books/connect', {
method: 'post',
headers: {
Authorization: 'Bearer ' + key,
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'create_invoice',
party: { display_name: body.name, email: body.email },
lines: [{ description: body.item || 'Wix order', quantity: 1, unit_price_cents: body.amount_cents }],
}),
});
const data = await res.json();
return data.ok ? ok(data) : badRequest(data);
}
Joomla
System plugin or module using Joomla Http factory.
Suggested preset: invoicing · Store key in configuration.php custom constant
<?php
use Joomla\CMS\Http\HttpFactory;
function zb_sync_sale($name, $email, $cents, $ref) {
$http = HttpFactory::getHttp();
$payload = json_encode([
'action' => 'sync_order',
'external_id' => 'joomla_' . $ref,
'platform' => 'joomla',
'customer' => ['display_name' => $name, 'email' => $email],
'total_cents' => (int) $cents,
'paid' => true,
'memo' => 'Joomla sale ' . $ref,
]);
$response = $http->post('https://books.tinyzipper.com/api/v1/books/connect', $payload, [
'Authorization' => 'Bearer ' . ZIPPERBOOKS_API_KEY,
'Content-Type' => 'application/json',
'Idempotency-Key' => 'joomla-' . $ref,
]);
return json_decode($response->body, true);
}
cURL / any stack
Raw REST — Authorization: Bearer zb_live_… or X-ZipperBooks-Key.
Suggested preset: full · Export ZIPPERBOOKS_API_KEY
curl -sS 'https://books.tinyzipper.com/api/v1/books/connect?action=whoami' \
-H "Authorization: Bearer zb_live_YOUR_KEY"
curl -sS -X POST 'https://books.tinyzipper.com/api/v1/books/connect' \
-H "Authorization: Bearer zb_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"action":"create_party","kind":"customer","display_name":"Acme Co","email":"billing@acme.test"}'