pactra.
DashboardNew dealMerchantsMy storeBountiesDevelopers

Developers

Pactra for Pi Apps

Create Pactra invoices from your own Pi app and verify Trust Passports without a shared secret.

1. Create an API key

Sign in with Pi, open Settings, and create a key with the permission you need.

2. Sign your request

Send these headers. The signature covers the exact raw body and a timestamp within 5 minutes. The full key is the HMAC secret.

  • x-pactra-api-key: pk_live_…
  • x-pactra-timestamp: <unix seconds>
  • x-pactra-signature: sha256=<hex>
import { createHmac } from "node:crypto";

const key = process.env.PACTRA_API_KEY!; // pk_live_...
const timestamp = Math.floor(Date.now() / 1000).toString();
const body = JSON.stringify({
  type: "INSTANT_INVOICE",
  title: "Monthly retention",
  description: "Monthly retainer, paid on receipt.",
  amountPi: 25,
  clientUsername: "mohdsuefan",
  idempotencyKey: "invoice-2026-11-001",
});
const signature = "sha256=" + createHmac("sha256", key)
  .update(timestamp + "." + body).digest("hex");

await fetch("https://pactra.152.70.21.132.nip.io/api/v1/invoices", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-pactra-api-key": key,
    "x-pactra-timestamp": timestamp,
    "x-pactra-signature": signature,
  },
  body,
});

POST https://pactra.152.70.21.132.nip.io//api/v1/invoices · GET https://pactra.152.70.21.132.nip.io//api/v1/deals?reference=PCT-XXXXX

3. Verify a Trust Passport

Exported passports are Ed25519-signed. Pin the public key from /api/passport/public-key, or call the verification endpoint below.

// 1) GET /api/passport/<username>/signed -> { payload, signature, algorithm, publicKey }
// 2) Verify locally with the pinned Ed25519 public key, or ask Pactra:

await fetch("/api/passport/verify", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify(envelope),
}); // { valid: true, username, tier, verifiedAt }
WebhooksReceive signed deal events on your own server.
© 2026 Pactra · Built for the Pi NetworkDashboardNew dealAnalyticsSettingsWebhooks
DashboardNew dealAnalyticsTrust PassportSettings
© 2026 Pactra · Built for the Pi Network
TermsPrivacySafety