API and webhooks

Add Pix to your product with just a few lines.

A straightforward REST API, signed webhooks and a JS/TS SDK. Integrate in minutes, or let your AI do it for you with /llms.txt.

$npm install @troqpay/sdk
checkout.ts
import { Troqpay } from "@troqpay/sdk";

const troqpay = new Troqpay({
  apiKey: process.env.TROQPAY_API_KEY!,
});

// create a Pix charge
const checkout = await troqpay.checkouts.create(
  {
    amount: 12990,
    description: "Pro plan",
    externalId: "order_1001",
  },
  { idempotencyKey: "order_1001" },
);

console.log(checkout.checkoutUrl);
Why integrate with TroqPay

Built for developers: clear, predictable and reliable.

Simple REST API
Clear endpoints, separate test and production keys, and idempotency to retry without charging twice.
Signed webhooks
Created, paid or expired payment events arrive with an x-troqpay-signature header, so you can verify them without calling the API.
Official SDK, optional
@troqpay/sdk in JavaScript and TypeScript to go faster. Or call the API directly, in any language.
Quickstart

A Pix payment is an event.

From API key to confirmation, the path is short. Webhooks update your system without polling the API.

Get your key

Generate a trq_test_ key in the dashboard and integrate without touching production.

Create the charge

One call creates the Pix checkout and returns a payment link.

Confirm via webhook

The checkout.paid event tells your system as soon as the Pix payment is confirmed.

webhook.ts
// your endpoint receives TroqPay events
app.post("/webhooks/troqpay", (req, res) => {
  const signature = req.headers["x-troqpay-signature"];

  // validate the signature before trusting it
  if (!isValidSignature(req.body, signature)) {
    return res.sendStatus(400);
  }

  if (req.body.type === "checkout.paid") {
    // release access or settle the order
  }

  res.sendStatus(200);
});

REST API: call it from your existing stack. The SDK supports JS/TS; the API works with any language.

JavaScriptTypeScriptPythonPHP

Your AI already knows how to integrate TroqPay.

/llms.txt gives your AI the context it needs from our API and SDK. Open it in Claude, ChatGPT or Lovable and let AI write the integration.

View /llms.txt
prompt for your AI

Help me integrate payments with TroqPay. Use the documentation as context: /llms.txt

FAQ

Integration questions

The essentials before opening the editor.

Get your key and create your first payment request.

The docs are open. Start with a test key and move to production when you're ready.