API and webhooks

Put Pix in your product with 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 here

Built for devs: 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 charges arrive signed in the x-troqpay-signature header. You trust the event 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

Receiving a Pix is reacting to an event.

From key to confirmation, the path is short. The webhook tells your system right away, with no watching 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 the link ready to pay.

Confirm via webhook

The checkout.paid event tells your system the moment the Pix lands.

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 where you already work. The SDK is JS/TS; the API, any language.

JavaScriptTypeScriptPythonPHP

Your AI already knows how to integrate TroqPay.

/llms.txt hands your AI the context of our API and SDK. Open it in Claude, ChatGPT or Lovable and let the 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 the first charge.

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