Payments
Take payments with Stripe. Test your checkout in a sandbox, connect your live account, sell pricing plans, and handle refunds and cancellations.
Take payments with Stripe. Your agent sets up Stripe for your company, builds and tests your checkout in a sandbox that charges no one, and takes real payments once you connect your live Stripe account.
Check Where Things Stand
Your agent starts with cofounder payments get. It shows whether the
company has a test sandbox, whether you've claimed it, whether a live
account is connected, and how far your app's payment setup has progressed.
Use Cofounder Payments
Cofounder Payments is the built-in checkout, so your product app can take
payments without a merchant account of your own. Your agent runs
cofounder payments cofounder setup --mode test to try checkout without real
payments, then --mode live when you're ready. Setup installs checkout
credentials for the app's next deployment: follow the returned next_steps and
notices, deploy the app, then confirm with cofounder payments get. Identity
verification is needed only to withdraw revenue from the Wallet page. Payment
accounts this setup creates pay Cofounder 1% of each payment, on top of payment
processing fees. Buyers pay the listed price plus any sales tax that applies,
which is added at checkout; Cofounder Payments collects that tax and files and
pays it for you.
Setup also sends payment notifications to the app, which run its
onPaymentEvent handler. The company's payment account holds every app's
payments, so only the company's sole product app gets them, once it has a
public URL, and only in a mode where no other app has started a checkout or
subscription, even an unpaid one. When the app gets none in the mode you set
up, setup returns a warning. The app still reads its purchases and memberships
either way.
Switch the Company's Payment Provider
Use payments_setup with method select and provider to switch the company's
payment provider for new checkouts. The provider must already be set up. For
example, cofounder payments setup --method select --provider stripe selects
Stripe after a test connection is ready.
The result's app is the product app whose production setting was saved.
Follow its hosting.deploy step, then read payments_get to confirm. The app
needs the current @cofounder/billing block for the setting to take effect.
Selecting the same provider again repairs the setting without changing the
choice. Existing subscribers stay on their own provider; switching does not
disconnect it. If the app setting cannot be saved, the call names the app and
does not record the choice; retry the same selection.
Try It in a Test Sandbox
Your agent creates a Stripe test account for the company, for the country
your business is in, using cofounder payments setup --method sandbox --provider stripe --country <country>.
Without --provider stripe, sandbox setup follows the company's current provider,
which is Cofounder Payments for new companies. If another provider is already
set up or selected, creating a Stripe connection preserves that choice;
select Stripe after it is ready.
Nothing in the sandbox charges real cards. To own it,
you open a link in your browser and claim it under your own Stripe login.
Your agent can give you the link again any time.
After live keys are saved to a single-app project's production environment, managed test verification requires a separate stable test deployment and webhook URL. Preview keys alone do not provide that endpoint; verification reports the missing prerequisite instead of checking the live app.
Connect Your Live Stripe Account
When you're ready for real payments, your agent gives you a link to approve the Cofounder Stripe App on your existing Stripe account. You don't need a sandbox first. Connecting doesn't turn on payments in your app by itself.
These links point to Cofounder, not Stripe, because Stripe's own claim and dashboard links open only in your signed-in browser. Never paste Stripe keys into chat or command arguments.
Test or Live
Plans are always edited in the test sandbox. Publishing is the only step that copies them to your live account. Customer lookups, revenue, refunds, and cancellations use your live account as soon as one is connected, and the test sandbox until then. Once live, those hit your real Stripe account and real customers.
If a refund or cancellation fails partway, your agent can retry it without Stripe doing it twice, for about 24 hours. After that, it checks whether the first try went through before retrying.
Sell a one-time offer
With Stripe connected, your agent can create a product with a fixed price in test or live mode. Give it the product name, what the buyer receives, when you will deliver it, and the price. It returns a price ID for checkout. Use the same offer key and terms on a retry to recover the original IDs. Test the offer through the app as described in Check Stripe Reaches Your App.
Share a reusable payment link
Your agent can turn a Stripe price into a hosted checkout URL that multiple customers can use. No Stripe dashboard login is needed after the account is connected. It can let buyers adjust quantity, collect shipping addresses in specified countries, and ask for up to three custom text fields, such as "Crest text" on a personalized mug order.
The link and its prices must use the same explicit test or live mode. Creating a link does not charge anyone or switch your app's payment provider. Your agent saves the link ID, can read its status and checkout fields, and can deactivate it to stop new purchases. Deactivating a link does not refund existing payments or cancel subscriptions. Test checkout and fulfillment before sharing a live link.
For an uncertain creation request, retry with the same idempotency key and unchanged arguments within 24 hours. After that, Stripe may create a new link.
Read Your Revenue
Ask your agent how the business is doing. In one check it reports:
- Monthly recurring revenue per currency.
- Gross, refunded, and net charges over the last 30 days.
- Your Stripe balance (available and pending).
- The five most recent payouts.
To keep watching cheaply, your agent passes the previous answer's
next_since as --since and gets only the charges and refunds since then.
Nothing is skipped or repeated across checks within the same Stripe mode,
though items can arrive out of order. The first check returns the starting
point and no new items. If payments switch between test and live mode, a
cursor from the other mode starts a fresh baseline in the active mode
(delta is null, with a revenue_since_reset notice and a new next_since).
When next_since is null there is no incremental stream, so read a fresh
snapshot without --since.
Sell a Pricing Plan
Your agent sets the plans your app shows on its pricing page. A plan has monthly and yearly prices, for example a Pro plan at $29 a month or $290 a year. For a single purchase, create a one-time offer. Your agent can preview a change before making it, or reuse a price you already have in Stripe.
The app shows active Stripe prices whose lookup keys match
plan_<key>_month or plan_<key>_year. Amounts are in the currency's
smallest unit: 2900 in usd is $29.00.
Removing a plan archives its prices and product. Existing subscribers keep paying.
Check Stripe Reaches Your App
Before going live, run cofounder payments setup --method sync --mode test.
Sync checks the test keys, deployed billing code, and webhook endpoint.
For subscription plans, sync creates a test subscription through the Stripe API, checks that the app processed its webhook, and attempts to cancel the test subscription. Test the customer checkout and paid access separately in the app.
For a catalog with only one-time offers, sync checks the endpoint configuration and skips the subscription probe. Complete a test checkout in the app and confirm that the app processed the checkout webhook, issued a receipt, and fulfilled the order.
Go Live With Your Plans
Publishing puts real prices in front of real customers, so your agent does it in two steps. First it previews what would be created, updated, and archived to make live match test. Then it applies exactly those changes. It refuses if test or live plans changed in between. If live already matches test, there's nothing to publish.
Help a Customer
Your agent finds a customer by email or customer ID and shows their 10 most recent subscriptions and charges (an email can match up to 10 customers, and the result says when more were cut off). It looks the customer up before every refund or cancellation and passes along what it saw. A refund needs the charge's amount, amount already refunded, and currency. A cancellation needs the subscription's status and customer.
- A refund covers everything refundable unless you name an amount.
- A cancellation takes effect at the end of the billing period unless you ask to cancel now.
- Your agent refunds or cancels only when you ask. Each customer it finds is marked live or test, and a refund or cancellation acts in that customer's mode: on a live customer it moves real money.
- Through MCP, you approve each refund or cancellation before it runs: your agent gets a link to approve that exact one in your browser, then repeats the same call. The Cofounder Agent asks for your permission in the chat instead. Company admins can run either one directly from the CLI or API, with no approval step.
Add a Tracking Number
When you sell something that ships, Cofounder Payments holds the payout for
that sale until it has a tracking number. Your agent adds it to the payment
with the charge ID from the customer lookup, and the result shows the carrier
and a tracking link. An app that ships its own orders can add the number from
its code instead: when it marks an order shipped, it sends the tracking number
to POST /app/payments/checkout/{checkout_id}/shipment with its payments key,
for a checkout that has been paid. If Cofounder Payments doesn't confirm the
number, send the same request again; a repeat never adds a second shipment.
Watch for Money Problems
Once you're live, your agent also watches for what costs you money if ignored: disputes needing a response, past-due subscriptions, and failed or paused payouts. It acts on every critical notice. Each notice has a deadline or next step. For a dispute, you get a link to it in Stripe. Your agent can draft evidence but never submits it. You respond in Stripe yourself.
Commands
| MCP | CLI | API |
|---|---|---|
| then | ||
manual_keys returns a link to the dashboard Stripe setup page, where
you enter the keys yourself; they never pass through your agent.
This page is available before Stripe is selected as the checkout provider.
Your agent polls cofounder payments get --provider stripe to check the connection.
Customer payment analytics
The current billing block automatically sends confirmed live invoices from the app backend to its configured PostHog project. It uses the existing Stripe webhook and analytics settings, so there is no additional connection button or Stripe authorization. Existing apps need the billing block upgrade and deployment. Capture starts with newly delivered invoices; historical payments are not backfilled.
Events use the authenticated user ID from the billing customer mapping, a stable invoice-derived event
UUID, the original payment time, and amount paid in currency minor units. They
represent amount paid per confirmed invoice, including renewals. They exclude test,
unpaid, zero-paid and unmapped-customer invoices. They do not represent net
revenue, MRR, refunds, or ad attribution. New app versions send
payment_completed with provider: "stripe"; old versions send
stripe_invoice_paid. Query event IN ('stripe_invoice_paid', 'payment_completed')
in the customer project to include both. Each app version sends one name per
invoice, so this does not double count; history is not rewritten. This does not create a native Stripe
warehouse source or configure the Revenue tab.
New product apps connect browser analytics to the same authenticated user ID.
Existing apps can add @cofounder/analytics-identity to their current initialized
PostHog client, retaining collection controls and resetting identity on sign-out.
Set the server setting GIC_BILLING_REVENUE_ANALYTICS_ENABLED=false when the app
collection policy excludes financial analytics. Advertising delivery still needs
its own current consent; see Ads measurement.