Documentation
Quote a fixed-price API call and release it after confirmed payment and seller authorization.
On this page
Available. Live purchases require a configured seller payment account.
Start with one fixed-price API call. Your backend owns fulfillment. Chitmark tracks the purchase, provider-confirmed capture, seller permission, and execution reservations separately.
Use two Chitmark workspaces with test credentials. The seller owns the resource and connected payment account. The buyer owns the spending ceiling and the agent that will purchase the resource.
Copy the seller's Workspace ID from Dashboard → Agent Paid Access and the buyer's ID from Dashboard → Agent Attribution → Enrollment. Replace org_your_seller and org_your_buyer in the example with those IDs. CHITMARK_SELLER_TENANT_ID identifies which workspace offers the resource. CHITMARK_BUYER_TENANT_ID identifies which workspace funds it. These are Chitmark workspace IDs. The buyer agent's scoped key authenticates the buyer on quote, accept, and status requests.
1. In the seller workspace, choose Test in the dashboard’s workspace environment control. Open Agent Paid Access → Payment setup and start Stripe onboarding. After Stripe returns you to Chitmark, confirm payment readiness, then open Resources to create a test resource or look one up by ID. You can also configure the resource through charge:configure. Save its resource ID. The seller backend uses charge:fulfill for permission, reservation, and delivery.
2. In the buyer workspace, create scoped keys under Dashboard → API keys. Use charge:budget to set how many USD cents the buyer may commit to this seller. Give the agent a charge:buy key from the buyer workspace. Keep the credentials on the server and use the same test environment for each step.
3. Configure agent with the buyer agent key and test API base URL. Use a TypeScript SDK build with client.charge or send the same JSON to POST /v1/charge. On your server, hash the buyer ID, resource, unique operation ID, and material inputs with SHA-256. Keep the 64-character lowercase hex digest and use it again when reserving.
When moving to live purchases, select Live in the dashboard’s workspace environment control. Connect the live payment account and complete commerce billing under Payment setup, then enable and save a live resource. Create live credentials in the matching workspace. An open commerce invoice pauses new live purchases until it is paid.
Request one unit. A successful quote includes purchase.purchaseId, immutable purchase.quote terms, and next: "accept". For example, an illustrative response excerpt is {"ok":true,"next":"accept"}.
Use a unique idempotency key per intent. Reuse that key and the exact same input after a lost response. A changed payload with the same key returns a conflict.
const quoted = await agent.charge({
operation: "quote",
sellerTenantId,
resourceId,
quantity: 1,
operationDigest,
idempotencyKey: quoteKey,
});
if (!("purchase" in quoted)) throw new Error("Missing purchase");
const { purchaseId, quote } = quoted.purchase;
const accepted = await agent.charge({
operation: "accept",
sellerTenantId,
purchaseId,
quoteVersion: quote.version,
maxAmount: quote.amount,
currency: quote.currency,
idempotencyKey: acceptKey,
});
if ("purchase" in accepted && accepted.next === "pay") {
// Hand checkoutUrl to the authorized buyer through your application.
}Accept before the quote expires. The payer completes hosted checkout. Use status on the same purchase to reconcile payment. In the seller dashboard, open Agent Paid Access → Purchases in the same environment and enter that purchase ID. authorized alone is insufficient. settled means the provider confirmed capture. Refunds and disputes can still change the payment state.
At the execution boundary, check your own policy and record it with permission. Call reserve using the original operation digest, one unit, a unique execution ID, and its own idempotency key. Deliver only with current local permission and a fresh reservation.granted: true for that execution before the lease expires. Deduplicate the business effect durably by execution ID.
After delivery, call usage with the execution ID, next sequence, used units, and terminal result. If payment is uncertain, the access window is expired, or reservation fails, withhold the resource. If execution is uncertain, keep its units reserved and reconcile before trying again.
Charge operations and request fields · Pricing and fees · OpenAPI contract
TypeScript and Python expose the same wire fields through client.charge. Use cancel, refund, and reconcile with the role and scope documented in the charge reference.