Quickstart
This guide walks through a full Paid integration using a real-world example: an AI chatbot where customers subscribe to monthly plans, receive Chat Credits, and consume them with every message.
By the end you will have signals, AI cost tracking, delivered value, balance enforcement, and checkout working together.
The example
Your product is an AI chatbot. It offers three monthly plans, each granting a different number of Chat Credits. Every chat message consumes 1 credit.
Prerequisites
- A Paid API key
- The Paid SDK installed in your project
Node.js
Python
1. Create your product
Set up the credit currency and product in the Paid dashboard.
- Go to Settings > Credit currencies and create a currency named
Chat Creditswith the keychat_credits. - Go to Products and create a product named
ChatBotwith external IDchatbot. - Add three plans to the product. Each plan needs two pricing lines: a Recurring fee for the monthly charge ($29, $79, or $199), and a Prepaid credits line for the usage metering with event name
chat_message, credit currency Chat Credits, and credit cost1. Add a credit benefit to each plan that grants the monthly allowance shown in the table above.
You can also create products via the API or the CLI.
2. Send signals
Signals represent actions your agent takes, like a chat message, tool call, or completed workflow. They can drive billing, track delivered value, or do both. In this example, send one every time a customer sends a chat message; because the product’s pricing rule matches on the event name chat_message, Paid automatically deducts 1 Chat Credit per signal.
Node.js
Python
The data field is optional. Include any metadata you want to see in the dashboard or use in delivered value calculations later.
3. Track AI costs
Cost traces capture what each AI call costs you. Initialize autoinstrumentation once at startup, then wrap your AI calls in a tracing context. Paid records the provider, model, token counts, and cost automatically.
Node.js
Python
Pass the library names you use ("openai", "anthropic"), or call with no arguments to instrument all supported libraries.
4. Link signals to AI costs
Cost-attributed signals combine steps 2 and 3. Send the signal inside a tracing context and Paid links the agent action to the AI costs captured in the same trace. This gives you per-signal margin visibility.
Node.js
Python
The customer and product are inherited from the tracing context, so you do not need to pass them again in the signal.
5. Track delivered value
Add data fields to your signals that describe the value delivered to the customer. Paid uses these to calculate metrics like time saved or money saved, which appear on value receipts and in the customer portal.
Configure value types in Signals > Signal values to tell Paid how to calculate delivered value from your signal data.
Node.js
Python
Duration fields need a value and a _unit suffix (seconds, minutes, hours, or days). Monetary fields are always in cents. See Delivered value for the full list of parameter types and binding modes.
6. Check credit balances
Before processing a message, check whether the customer has credits remaining. This lets you show upgrade prompts or block usage when the balance hits zero.
Node.js
Python
7. Add checkout
Create a checkout session when a customer wants to subscribe. Paid handles payment collection, plan selection, customer creation, and credit provisioning in one flow.
Node.js
Python
The customer picks their plan during checkout. After payment, Paid creates an order and grants that plan’s Chat Credits.
When the customer returns, verify the checkout before granting access:
Node.js
Python
Next steps
- Checkout: session expiration, metadata, currency locking, and reusable links
- How credit balances work: allocation lifecycle, ledger entries, and balance breakdown
- Examples of plans with included credits: seat-level credits, rollover, and allocation cadence
- Webhooks: react to billing events in real time
- Delivered value: value types, parameter binding, backfills, and custom formulas
- Value receipts: surface delivered value to your customers