Overview
An agent asks for a quote, your published rules price it, and a person approves it when it is above your threshold. On execute, Atlas hands the approved quote to the one billing connector you choose in Workspace → Integrations:
| Connector | What Atlas creates | Who collects payment |
|---|---|---|
| Stripe | The customer (if new) and an invoice, as a draft or finalized | Your Stripe account, with your invoice settings |
| Chargebee | The customer (if new) and a quote, or an invoice with auto-collection off | Your Chargebee site |
| Signed webhook | A signed quote.approved event to your endpoint | Whatever your receiver calls |
Every handoff is idempotent: retrying an execute never creates a second invoice or quote. Connector keys are encrypted per seller and never shown again after you save them.
Each buyer is one customer in your billing, the same one on every order and after they rotate their key. The buyer's reference, such as a PO number, goes on the invoice or quote but never picks the customer. Atlas sets the customer's email only when the buyer signed in to PairRail with it, and never changes an email you already set.
A buyer who already pays you can be billed as their existing customer. When you approve a buyer who signed in, Atlas searches your Stripe or Chargebee for customers with their verified email and lets you pick one. You can change it later with Billing customer on the buyer's key in Agent gateway. Atlas only searches emails buyers verified by signing in. If a linked customer is deleted in your billing, the next order stops before any invoice is created, so you can link again.
When buyers get what they bought. Under Handoff and fulfillment in Workspace → Integrations, choose new customers after payment (the default when you first turn billing on), always on order, or always after payment. A known customer is one with a paid order from you, or one you linked to a customer in your billing. When delivery waits, Atlas finalizes the Stripe invoice and gives the buyer's agent its payment link, takes no vault key and calls no provision endpoint until the invoice is paid, then delivers on its own. Waiting needs a way to see the payment: Stripe, Chargebee, or your webhook sending payment.captured. Mock billing always delivers at once.
With Stripe or Chargebee, Atlas reads the invoice status back on its own: every 5 minutes in the first hour, hourly for three days, then daily until 30 days past the due date. A paid invoice is recorded on the quote as captured, once, whether Atlas or your own payment.captured webhook sees it first. Atlas only reads; it never changes or voids an invoice.
Your own sign-up or checkout
If buyers already sign up and pay on your site, send them there. Under Handoff and fulfillment in Workspace → Integrations, set fulfillment mode to Your own sign-up or checkout and enter the URL. When a quote can be accepted, the buyer's agent gets a checkout link instead of execute. The link sends the person to your URL with pairrail_quote=qr_…, or puts the id where your URL has {quote}. Your system creates the account and keys as it does today. Execute is refused for your quotes, so nothing is billed twice.
Your checkout honours the quoted price in one of two ways:
- Lookup (any billing). Create a portal key under Handoff and fulfillment. Your checkout calls
GET /v1/portal/quotes/{id}withAuthorization: Bearer pps_…. It gets the priced lines, totals, validity, thebuyerblock and the signed quote. When the account exists, it callsPOST /v1/portal/quotes/{id}/redeemwith{"accountRef": "…"}and, optionally,"invoiceRef". A quote redeems once. Check the account email againstbuyer.emailbefore you redeem. - Promotion code (Stripe only). When the person opens the link, Atlas creates a one-time promotion code in your Stripe, worth the quote's discount and expiring with the quote, and adds it as
pairrail_promo. Your key needs Coupons and Promotion codes write, and your checkout has to accept codes. A code only covers a price difference: quotes with other items, quantities or terms than your plans need the lookup. Atlas sees the code used in your Stripe and closes the quote.
Either way the quote counts as accepted when it is redeemed or its code is used, the same as an execute.
Custom quotes. By default only standard quotes go to your checkout: one self-serve offer, one month, no person involved. A quote is custom when your deal desk approved or countered it, it covers more than one month, it uses contract pricing, the buyer asked for special terms, or its offer is not on your Self-serve offers list. A custom quote takes the invoice path instead: the agent executes it (or a buyer who signed in places the order), it lands in your billing as an invoice or quote with the exact lines, and it waits in Quotes, under To fulfil, for you to set up access. If your checkout builds the cart from the lookup, choose Every quote and all quotes go to your checkout. A promotion code is only ever used for standard quotes. Custom quotes need billing connected.
Orders from buyers who sign in
Agents connected through sign-in (ChatGPT, Claude and other apps) never get execute. Under Handoff and fulfillment you can let these buyers place orders: their agent gets a link, and the person confirms the order on a PairRail page with a code sent to their verified email. They give billing details once (company, invoice email, address, optional tax ID and PO number). PairRail then signs a mandate for that one quote, at its total, valid for 10 minutes, and the order goes to your billing like any execute. The billing details reach you on the new customer and in the buyer.billing block. Off by default, it needs billing connected, and it does not apply when buyers order on your own checkout.
Delivering by hand
With fulfillment mode Manual, Atlas delivers nothing itself. Each accepted order, or each paid one when delivery waits for payment, appears in Quotes under To fulfil, with the buyer, what they bought, the invoice and how long it has waited. Choose Fulfil to send the buyer an API key or other access (only their agent can read it, once) and a note, or Mark delivered outside PairRail if you sent it another way. You get an email for each order, a chat message if you added a Google Chat or Slack incoming webhook in Settings, a quote.ready_to_fulfil event if your endpoint subscribes to it, and one reminder after 24 hours. Needs attention, beside it, lists handoffs that reached your billing but failed to deliver, with Retry delivery (never a second invoice), and unpaid orders past their due date.
Stripe
- In Stripe, create a restricted key with: Customers write, Invoices write, Products and Prices read. For promotion codes on your own checkout, add Coupons and Promotion codes write. No payment permissions are needed.
- In Workspace → Integrations → Stripe, paste the key and choose what each approved quote becomes: a draft invoice you review (default) or a finalized invoice ready to send. Atlas tests the key before saving it.
- Choose Use for handoff if Stripe is not already your handoff.
Atlas finds the buyer’s customer by metadata.pairrail_buyer_key, or creates it, then creates the invoice with collection_method=send_invoice and one invoice item per quote line (plus a negative line for an approved discount). The invoice carries metadata.pairrail_quote_id and the catalog version, so your team can trace it. The same key imports Stripe products into a catalog draft from Governance → Connect stack.
Chargebee
- In Chargebee, create a full-access or custom API key for your site (
acmeoracme-test). - In Workspace → Integrations → Chargebee, enter the site and key and choose quote (default) or invoice.
Atlas creates the customer with id pr_… (a stable hash of the buyer) if it does not exist, then a quote built from one-off charges, one per quote line, with po_number set to the PairRail quote id. If your site does not have Quotes, Atlas creates an invoice with auto_collection=off instead, so nothing is charged until your team or your Chargebee rules say so. The same key imports Chargebee items into a catalog draft.
Signed webhook
For any other billing system, Atlas POSTs signed JSON to one https endpoint you register in Workspace → Integrations → Signed webhook. You choose which events to receive, the signing secret is shown once, and Send test event delivers a webhook.test event right away. The delivery log shows every attempt with its status code, latency and the start of your response, and lets you resend any event.
Events
| Type | When |
|---|---|
quote.approved | An approved quote is executed. With the webhook as your billing handoff, this event is the handoff (data.handoff: true). With Stripe or Chargebee, it reports the handoff and its reference. |
approval.requested | A quote is above your threshold and waits for a person. |
approval.decided | A person approved or rejected it (data.approval.decision). |
quote.revoked | Your team revoked an open quote. |
quote.ready_to_fulfil | An order is waiting for a person on your team to deliver it (manual delivery). Carries the quote, its buyer block and data.ready_at. Add it to your endpoint's events to receive it. |
quote.expired | A quote passed valid_until without being executed. |
webhook.test | You pressed Send test event. Always delivered, carries no quote. |
Headers
| Header | Value |
|---|---|
PairRail-Signature | t=<unix seconds>,v1=<hex>, with a second v1 during a secret rotation |
PairRail-Event-Id | The event id, the same on every retry and resend |
PairRail-Event-Type | For example quote.approved |
Idempotency-Key | Same as idempotency_key in the body |
Payload (version 2026-10-01)
{
"version": "2026-10-01",
"id": "evt_8c1d2f…",
"type": "quote.approved",
"created_at": "2026-10-01T12:00:00.000Z",
"seller_id": "northstar-compute",
"catalog_version": "catv_42",
"idempotency_key": "pairrail_qr_7f3a_quote.approved",
"data": {
"quote": {
"id": "qr_7f3a",
"offer_id": "off_gpu_a100",
"status": "approved",
"currency": "USD",
"line_items": [
{ "description": "A100 80GB", "quantity": 500, "periods": 1,
"unit_price": "1.89", "amount": "945.00" }
],
"subtotal": "945.00",
"discount": "94.50",
"total": "850.50",
"tax_treatment": "exclusive",
"valid_until": "2026-10-08T12:00:00.000Z",
"buyer_reference": "acme-procurement",
"buyer": {
"id": "sb_4e1c…",
"email": "ops@example.com",
"email_verified": true,
"email_verified_at": "2026-11-08T09:12:00.000Z",
"company": "Example Co",
"contact_name": null,
"label": "Example Co (ops)",
"reference": "acme-procurement",
"stated": null,
"billing": null,
"billing_customer_ref": "cus_Q…"
},
"policy_decision": { "type": "approved", "reasons": [], "required_approvers": [] },
"approver": { "id": "firebase:u_91…", "decided_at": "2026-10-01T11:58:02.000Z", "note": null },
"created_at": "2026-10-01T11:40:00.000Z"
},
"handoff": true
}
}Amounts are decimal strings in the quote currency. approver is null when no approval rule sent the quote to a person. Events never include buyer payment tokens or mandates.
buyer says who the buyer is at your account. id stays the same across the buyer's key rotations. email_verified is true only when the buyer proved the email with a code: by signing in to PairRail, or by confirming the email their agent gave. email_verified_at is when they last did; buyers who sign in through an app prove it again every 90 days. Otherwise the email is what their agent gave, unchecked. stated is what the agent said on this quote, never checked. label is the name you gave the buyer when you approved access, and billing_customer_ref is the customer they are billed as in your Stripe or Chargebee account, once there is one.
Use idempotency_key to ignore duplicates: it is stable per quote and event type.
Each request is signed with HMAC-SHA256 over timestamp + "." + raw body, keyed by your signing secret. Verify against the raw bytes you received, before parsing JSON, and reject timestamps more than 5 minutes from now. During a rotation the previous secret keeps signing for 24 hours, so accept either.
import { createHmac, timingSafeEqual } from "node:crypto";
// rawBody: the exact bytes received (Buffer or string), before JSON.parse.
// secrets: your current signing secret, plus the previous one during a rotation.
export function verifyPairRail(rawBody, header, secrets, toleranceSeconds = 300) {
let timestamp = null;
const signatures = [];
for (const part of String(header || "").split(",")) {
const [key, value] = part.split("=");
if (key === "t") timestamp = Number(value);
if (key === "v1") signatures.push(value);
}
if (!timestamp || !signatures.length) return false;
if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false;
return secrets.some((secret) => {
const expected = createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest();
return signatures.some((signature) => {
const received = Buffer.from(signature, "hex");
return received.length === expected.length && timingSafeEqual(received, expected);
});
});
}app.post("/webhooks/pairrail", express.raw({ type: "application/json" }), async (req, res) => {
const ok = verifyPairRail(req.body, req.get("PairRail-Signature"), [process.env.PAIRRAIL_WEBHOOK_SECRET]);
if (!ok) return res.sendStatus(400);
const event = JSON.parse(req.body);
if (await seen(event.idempotency_key)) return res.sendStatus(200);
if (event.type === "quote.approved") await createInvoiceInYourBilling(event.data.quote);
res.sendStatus(200);
});import hashlib
import hmac
import time
def verify_pairrail(raw_body: bytes, header: str, secrets: list, tolerance: int = 300) -> bool:
timestamp, signatures = None, []
for part in (header or "").split(","):
key, _, value = part.partition("=")
if key == "t" and value.isdigit():
timestamp = int(value)
elif key == "v1":
signatures.append(value)
if timestamp is None or not signatures or abs(time.time() - timestamp) > tolerance:
return False
signed = f"{timestamp}.".encode() + raw_body
for secret in secrets:
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
if any(hmac.compare_digest(expected, signature) for signature in signatures):
return True
return FalseThere is no PairRail SDK package yet; these functions are the whole verification step.
- Success is any
2xxwithin 10 seconds. Respond fast and do slow work afterwards. - Retries follow 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours (each with up to 20% jitter), for at most 24 hours from the event. After that the event is marked failed and stays in the log for a manual resend.
410 Gonedisables the endpoint: nothing more is sent until you re-enable it in the workspace.- Order: events for the same quote are delivered in order. A later event for a quote waits until the earlier one was delivered or failed for good.
- Resend sends the same event id and body with a fresh signature.
- Rotation: Rotate secret shows a new secret once. Both secrets sign for 24 hours, then only the new one.
Endpoints set up before October 2026 keep receiving the earlier field names and the X-PairRail-Signature header alongside the new format until you turn that off in the workspace.
These work via the signed webhook. Your receiver verifies the event and creates whatever your account uses: an invoice, a checkout or a payment link in Dodo, Razorpay or Adyen, or an order in your own system. For example, a Razorpay invoice from quote.approved:
const { quote } = event.data;
await fetch("https://api.razorpay.com/v1/invoices", {
method: "POST",
headers: { Authorization: `Basic ${btoa(`${KEY_ID}:${KEY_SECRET}`)}`, "Content-Type": "application/json" },
body: JSON.stringify({
type: "invoice",
customer: {
name: quote.buyer.company || quote.buyer.label || quote.buyer_reference,
...(quote.buyer.email_verified ? { email: quote.buyer.email } : {})
},
line_items: quote.line_items.map((line) => ({
name: line.description,
amount: Math.round(Number(line.amount) * 100),
currency: quote.currency,
quantity: 1
})),
notes: { pairrail_quote_id: quote.id }
})
});Request a connector
Orb, Metronome and Paddle are not built yet. Choose Request connector on their card in Workspace → Integrations, or email support@pairrail.com. Requests tell us what to build next; the signed webhook covers you in the meantime.
Does PairRail process payments?
No. Atlas creates the quote, invoice or event in your billing system, and your processor collects payment exactly as it does today. See the FAQ for the full answer.
Can I use more than one connector?
One connector receives the handoff. You can still keep a webhook endpoint for notifications (for example approval.requested) while Stripe or Chargebee receives approved quotes.
What happens to approved quotes if my endpoint is down?
The quote is still handed off: the event waits in the outbox and retries for up to 24 hours, in order per quote. Resend it from the delivery log at any time.