Test mode: Ducat runs on Stripe's test mode for now, so no real card is charged.

← Docs

Agents on Ducat

What an agent may do through Ducat on a product's behalf. Levels as in Astropause's docs/agents.md:

A product that sells its plans through Ducat (sign-up, checkout, the plan switched on, a billing page) starts with selling.md, "How a product sells through Ducat".

The product's webhook (selling.md section 9): PUT /v1/webhook-endpoint {url} / webhook_endpoint_set (limits: it says where the product's events go, and a second call rolls the secret, which breaks the product's check until its secret is replaced) answers the whsec_… once; GET / webhook_endpoint_get (free) shows the url and whether deliveries are ok, retrying or failing, never the secret; DELETE / webhook_endpoint_delete (limits). An agent that sets one puts the secret straight into the product's secrets and never into a message or a log. A checkout, subscription or plan change sells only the product's own prices (another's is 404).

Every level is enforced by Ducat's API, not by any client: an agent calls the API with its own Harpora token, and sees only the customers of the product whose token it holds. Agents reach it through the MCP server at /mcp (decisions.md) or the HTTP API.

Stories

1. Take a payment from a customer who is there

StepActionLevel
Make the customerPOST /v1/customersfree (payments:write)
List the product's customers (made through Ducat since 2026-12-04, and any an event has shown to be its own since 2026-12-05), oldest first, or see them on view_customersGET /v1/customers?after&limitfree (payments:read)
List the customers Stripe holds with the product's mark that the list doesn't have yet (older ones, those made in Checkout, with no event since), from Stripe's Search, at their own creation time; up to 1,000 a call, next goes onPOST /v1/customers/backfill {page?} / customers_backfillfree (payments:write): reads Stripe, changes nothing there
Send them to Stripe's page to pay or subscribePOST /v1/checkout-sessionsfree: the customer pays themselves
... at your own prices, without a Stripe price (test mode only)POST /v1/checkout-sessions with line_items: [{price_data: {currency, unit_amount, product_name}, quantity}]free inside the standing limit, past it a nod; a currency with no limit, tax or a promotion code: refused; with your own seller (able to take charges), a destination charge with the fee on the inline total
See whether they paidGET /v1/checkout-sessions/{id} (payment_status paid, not just status complete: a bank debit is complete and unpaid until it clears), GET /v1/eventsfree (payments:read)

2. Charge a saved card

StepActionLevel
Charge inside the limit for its currencyPOST /v1/chargeslimits
Charge past it, or in a currency with no limitPOST /v1/chargesnod (spend)

3. Refund

StepActionLevel
Refund inside the limitPOST /v1/refunds {payment_intent, amount}limits
Past it, or everything that's left of a payment past itPOST /v1/refundsnod (spend)

4. Subscriptions

StepActionLevel
Subscribe with a saved card, a period's amount inside the limitPOST /v1/subscriptionslimits
Past it, or a price that isn't fixedPOST /v1/subscriptionsnod (spend)
CancelDELETE /v1/subscriptions/{id}free: it stops charges
Cancel at the period's end, or take that backPATCH /v1/subscriptions/{id} {cancel_at_period_end: true \| false} (on its own)free: it stops charges, or goes on with the plan the customer has
List a customer's subscriptions (newest first, every status)GET /v1/customers/{id}/subscriptionsfree (payments:read)
Find the subscription a checkout madeGET /v1/checkout-sessions/{id} (subscription, once complete)free (payments:read)
Start with a free trialPOST /v1/subscriptions {trial_period_days | trial_end} / subscription_createas creating one: the period's amount is checked, trial or not
See what a plan or quantity change would cost: credit for unused time, the rest at the new price, the totalGET /v1/subscriptions/{id}/upcoming-invoice / subscription_previewfree (payments:read): no money moves
Change the price or quantity, prorating (create_prorations, none or always_invoice), passing the preview's proration_datePATCH /v1/subscriptions/{id} / subscription_changelimits: a change that keeps or lowers the amount, or raises it inside the limit
Raise the amount per period past the limit, or to a price that isn't fixedthe samenod (spend), naming the subscription, price and quantity
End a trial nowPOST /v1/subscriptions/{id}/end-trial / subscription_end_triallimits: it charges the first period, which was inside the limit or approved

4b. Discounts, invoices and the customer portal

StepActionLevel
Make a coupon (percent or amount off; once, repeating, forever) and a promotion code for itPOST /v1/coupons, POST /v1/promotion-codes / coupon_create, promotion_code_createlimits, and an operator's: needs payments:operator, so a product can't give itself a discount
Apply a code a customer typed to a checkout, a new subscription or an existing onepromotion_code on POST /v1/checkout-sessions / checkout_create, POST /v1/subscriptions, PATCH /v1/subscriptions/{id}free or limits as that call is (payments:write); a code made for another product is 404
List and read a customer's invoices, with the hosted invoice URL and the PDF linkGET /v1/customers/{id}/invoices, GET /v1/invoices/{id} / invoices_list, invoice_getfree (payments:read)
Give a customer Stripe's billing portal (update a card, read invoices, change plan, cancel)POST /v1/customers/{id}/portal-sessions {return_url} / billing_portal_linkfree (payments:write): a short-lived page for the customer, no money moves by the agent
Give a customer Ducat's own portal for an hour: their subscriptions and invoices; a switch of any item to one of the plans offered (previewed first, same currency and, beside other items, cycle), a quantity up to max_quantity, cancelling at the period's end, replacing the card (on Stripe's page) and setting the billing address and tax IDs, and applying a promotion code (one the product may use) if offeredPOST /v1/customers/{id}/portal-sessions {return_url, own: {prices, max_quantity, cancel, card, details, codes}} / billing_portal_link with ownfree (payments:write): what the customer does there is theirs (their card, plans the product offered), so no nod; needs PAYMENTS_PUBLIC_URL

4c. Usage-based billing

StepActionLevel
Make a meter (sum, count or last)POST /v1/meters / meter_createfree (payments:write): no money moves
Put a metered price on itPOST /v1/meters/{id}/prices / metered_price_createlimits: it sets what a customer will be charged, only on the product's own meter
Subscribe a customer to itPOST /v1/subscriptions / subscription_createnod (spend) every time: the amount isn't known, so no limit can hold it
Report usage, once per identifier (or Idempotency-Key): a retry never counts twicePOST /v1/meters/{id}/events / usage_reportlimits: it adds to a bill a person approved with the subscription
What a customer used over a rangeGET /v1/meters/{id}/usage / usage_getfree (payments:read)
List, read, deactivate a meterGET /v1/meters, GET /v1/meters/{id}, POST /v1/meters/{id}/deactivate / meters_list, meter_get, meter_deactivatefree

4d. Failed payments (dunning)

StepActionLevel
See the subscriptions whose renewal failed (past_due or unpaid), their open invoices, attempts and the next attemptGET /v1/dunning / dunning_listfree (payments:read)
Try the card now, inside the limitPOST /v1/invoices/{id}/pay / invoice_paylimits
Past the limitthe samenod (spend), naming the invoice
Let the customer fix their card (Stripe then retries on it)POST /v1/customers/{id}/portal-sessions / billing_portal_linkfree
Give upDELETE /v1/subscriptions/{id}free: it stops charges

Stripe does the retrying, on the schedule set in its Dashboard (Billing, Revenue recovery); Ducat can't change it.

StepActionLevel
Make a price to sell (once, monthly or yearly)POST /v1/prices / price_createfree (payments:write): it moves no money
List your prices, turn one offGET /v1/prices?active / prices_list, POST /v1/prices/{id}/deactivate / price_deactivatefree
Make a link to share (fixed prices)POST /v1/payment-links / payment_link_createfree (payments:write): whoever opens it pays themselves
List, readGET /v1/payment-links?active, GET /v1/payment-links/{id} / payment_links_listfree (payments:read)
Turn one offPOST /v1/payment-links/{id}/deactivate / payment_link_deactivatefree: it only stops

4f. Tax (Stripe Tax)

Ducat is not a merchant of record: the product (the seller) owes its own tax. Stripe Tax works it out and Stripe's reports help file it, but registering with the tax authority, filing and the liability stay with the seller. Tax is on per product (PAYMENTS_TAX); a product that has it on prices every price it sells as tax inclusive or exclusive.

StepActionLevel
Give a customer an address (a country and a postal code, at least: where tax is worked out)POST /v1/customers {address}, PUT /v1/customers/{id}/address / customer_create, customer_address_setfree (payments:write): customer data; Stripe refuses an address that can't give a tax location
Put a tax ID (VAT, GST, ABN…) on a customer; list and remove themPOST, GET /v1/customers/{id}/tax-ids, DELETE …/{tax_id} / tax_id_add, tax_ids_list, tax_id_deletefree: Stripe refuses a malformed number (tax_id_invalid) and reports whether the authorities found a valid one (verification.status: pending, verified, unverified, unavailable); a business's tax ID can remove the tax (reverse charge), so a product reads the status
See the tax on a cart, before sellingPOST /v1/tax/previews {customer, line_items} / tax_previewfree (payments:read): no money moves; its total is what the limits count
Take a payment or subscribe with taxPOST /v1/checkout-sessions, POST /v1/subscriptions, POST /v1/payment-linksas before: tax is on the session, subscription or link, and the invoice shows it per line
Subscribe, change a plan, or pay an invoice nowthe same callslimits or nod as before, on the total including tax: 9,000 with 19% on top is 10,710 against a limit of 10,000
Charge a saved card with taxPOST /v1/charges {customer, currency, tax_calculation} (the preview's calculation; leave amount out) or {amount, tax_behavior: inclusive \| exclusive} (Stripe Tax calculates now) / charge_createlimits or nod as any charge, on the total including tax; once it succeeds the sale is recorded with Stripe Tax (the answer's tax.transaction); a calculation is one sale (a second charge on it is refused, 409 tax_calculation_used, before any payment; retry the same charge with the same Idempotency-Key) and lasts 90 days
Refund such a chargePOST /v1/refunds / refund_createas any refund; the answer's tax_reversal says the reversal was recorded (a failed one never undoes the refund)
See where the account collects taxGET /v1/tax/registrations?status / tax_registrations_listfree (payments:read), read-only: a person adds a registration in Stripe's dashboard (Tax, Registrations), never an agent

An agent sees only its own product's customers' tax data. The overview's Payments part shows tax collected on one-time checkouts and its Billing part tax on paid invoices, per currency over 30 days, and each invoice's tax per line. A charge without tax_calculation or tax_behavior is the amount given: Ducat adds no tax to it.

4g. Credit notes

Give back part of an invoice, or all of it. For invoices of your own customers (a subscription's); on an invoice with tax, Stripe reverses the tax with the credit note (Ducat does nothing for it).

StepActionLevel
Find the invoice and its linesGET /v1/customers/{id}/invoices / invoices_list (each line has an id)free (payments:read)
See what a credit note comes toPOST /v1/credit-notes/preview {invoice, lines: [{invoice_line_item, amount \| quantity}] \| amount, to} / credit_note_previewfree: nothing made; the answer has subtotal, tax, total, refund_amount or credit_amount, within_limit
Make itPOST /v1/credit-notes (same body, reason, memo) / credit_note_createlimits: its total counts against the refund limit (PAYMENTS_LIMITS); past it, a nod (spend) for exactly this note, then call again with approval
Choose where the money goesto: refund (the default: the payment) or to: balance (credit on the customer, off their next invoices)on an open invoice, what it still owes is credited first and to covers only the rest
List, readGET /v1/credit-notes?customer\|invoice&limit&after, GET /v1/credit-notes/{id} / credit_notes_list, credit_note_getfree (payments:read)
VoidPOST /v1/credit-notes/{id}/void / credit_note_voidfree: only while its invoice is open (Stripe's rule); nothing is paid out

A line's amount is before tax (Stripe adds the line's tax); an amount instead of lines is the total, tax included. The overview's Billing part lists the newest credit notes.

5. Pay with a card (Ducat's virtual cards)

StepActionLevel
See its own cards, their rules and spendGET /v1/cards, GET /v1/cards/{id}free (payments:read)
Pay inside the card's rulesPOST /v1/cards/{id}/paylimits (the card's controls)
Pay past themdecline with a challenge; Nod; POST /v1/cards/{id}/approvals; pay againnod (spend)
Freeze or cancel its own cardPOST /v1/cards/{id}/freeze, /cancelfree: it stops spending
Its historyGET /v1/card-transactionsfree
Say what a purchase was forPUT /v1/card-transactions/{authorization}/memo {memo?, category?} (its own only)free
Find what still owes a receipt (its card's controls.receipt_over)GET /v1/card-transactions?missing_receipt=truefree
Attach the receiptPUT /v1/card-transactions/{authorization}/receipt, the file as the body with its Content-Type (PNG, JPEG, WebP, PDF or plain text, at most 1 MiB)free
Its transactions for accountingGET /v1/card-transactions/export?since=&until= (CSV; an agent: its own)free
Issue a card, change its rules, unfreeze, replacepayments:cards, and never as an agenta person's

An agent never sees a card number, nor a key to its details: it pays through the payment tool only. The card's details view (POST /v1/cards/{id}/view) is for the card's person's own session token, in their own browser, and is refused to agents.

6. Pay the people who sell through a marketplace (Connect)

StepActionLevel
Make a connected account for a sellerPOST /v1/sellers / seller_createlimits (the product's own sellers)
Get their onboarding link, send it to themPOST /v1/sellers/{id}/links / seller_linklimits
See their status (details submitted, charges and payouts enabled) and balanceGET /v1/sellers/{id}, /balance, /payouts, view_seller {account}free (payments:read)
Charge for a seller, the product's fee keptPOST /v1/charges or /v1/checkout-sessions (price ids or inline price_data) with seller, once it can take charges (charges_enabled)as any charge: inside the limit, else a nod (naming the seller)
Set when Stripe pays them outPUT /v1/sellers/{id}/payout-schedule / seller_payout_schedulelimits
Pay out their balance now, inside the product's payout limitPOST /v1/sellers/{id}/payouts / payout_createlimits (PAYMENTS_PAYOUT_LIMITS: per seller per day, 1000 by default)
Pay out past it, or in a currency with no payout limitthe samenod (spend)

An agent never sets the fee (Ducat's configuration does) and sees only its own product's sellers. Ducat's Connect is built and tested against a fake Stripe (docs/decisions.md says what is faked); not yet run against Stripe.

7. See the whole product at a glance

StepActionLevel
Open the overview: payments (last 30 days' succeeded, refunded and net per currency, recent checkouts, failures, refunds), billing (subscriptions created, updated, cancelled; invoices paid, failed; trials ending within 7 days; the latest invoices with their links; subscriptions in dunning; usage meters), payment links (the active ones), marketplace (sellers with status, recent payouts), agent spend (cards, recent card transactions)view_ducat {}free (payments:read)
Find a payment by id, customer, description or amount (the last 30 days)payments_findfree
List the product's sellersGET /v1/sellersfree (payments:read)

Payments and billing are worked out from the product's Stripe events (GET /v1/events), so Stripe's webhook must send checkout.session.completed, payment_intent.succeeded, payment_intent.payment_failed, refund.created, customer.subscription.*, invoice.paid, invoice.payment_failed and invoice.finalized. Each part reads with the caller's own token; one it can't read (a missing scope, no card issuer) comes back empty and named in unreadable with the route's reason, so the page still opens. The result's contexts are ducat:card {card} and ducat:seller {account}.

Whose nod

The org's Nod policy decides (kit-nod challenge_in, the account PAYMENTS_NOD_ORG, class spend). On a refusal the agent reads the action from WWW-Authenticate, asks Nod for it, and retries with the approval in Nod-Approval. The approval is for exactly that customer (or payment, or seller), amount and currency, and is good once.