Clavem

Selling an app built with AI coding tools: what to review, what to buy and what you own

An app written with an AI coding assistant can be sold like any other, but the billing and license code is where mistakes cost money. Generate the interface, buy the payment and license pieces, and test the paid path by trying to get around it before a customer does.

The short version

Charging for an app is a different job from building it. A prototype that works on your machine does not yet protect a payment, a key or a customer’s data, and an assistant that writes working code is not judging whether that code is safe to ship. This article assumes you used AI tools to write most of the app and now want to sell it.

It is general information. For ownership and liability, ask a lawyer.

Who owns the code

Ownership of AI-assisted code is a legal question that varies by country and keeps changing. Three points help you ask the right questions.

  • Human authorship matters. The US Copyright Office’s report on copyrightability, published 29 January 2025, deals with outputs created using generative AI. Summaries of it say its central finding is that prompts alone do not give a user enough control to be the author of the output, while human-written material, the selection and arrangement of AI output and human modification of it can be protected. That is United States guidance, and other countries have their own rules.
  • Tool terms differ. Each assistant’s terms say who may use its output commercially and on what conditions. Read the terms of every tool you used, and keep a copy of the version in force when you shipped.
  • Dependencies bring licenses. Generated code pulls in packages, and code that resembles existing open-source code can carry obligations. Run a dependency license scan, and keep a notices file. See writing an EULA for notices.

In practice, the more of the product you wrote, shaped and rewrote yourself, the clearer your position. Keep commit history that shows your own work.

Generate the app, buy the plumbing

Some parts of a paid app are expensive to get wrong and cheap to buy. Others are the product itself.

Part Approach Why
Interface, features, product logic Generate and review This is your product
Checkout page Buy: Stripe Checkout or a Payment Link Card handling and compliance stay with Stripe
Webhook handling that turns payments into access Buy, or use well-tested library code Signature checks, replays and retries are easy to get subtly wrong
License keys, device limits, signed tokens Buy, or use a service Cryptography and abuse handling reward experience
Download delivery with expiring links Buy Signed URLs and storage have sharp edges
Terms, refunds, privacy Write and have reviewed An assistant cannot take legal responsibility

A service that already does keys and fulfilment means the assistant never writes the part that decides who is entitled to what. Your code then asks one question, whether this key is valid, and verifies a signed answer.

Break your own paid path

Do this before launch. It takes an hour and finds most of what matters. Try to get the paid features without paying, as a hostile customer would.

Attack How to try it What it shows
Edit the flag Open the developer tools and set the value your app stores for “pro”, such as localStorage.isPro Whether entitlement lives in the browser
Skip the check Call the paid API endpoint directly, with no license Whether the server enforces it, not just the interface
Fake a webhook Send your webhook URL a payment event without a valid signature Whether it accepts unsigned events
Replay a webhook Send a genuine event a second time Whether it issues two licenses
Trust the redirect Open the post-payment success URL without paying Whether access is granted by the redirect
Read the bundle Search the built files for secret keys Whether a secret ships to customers
Use another product’s token Present a valid token for a different product Whether the app checks the product id

For webhooks, Stripe’s documentation says to verify each request with the Stripe-Signature header, using the raw request body, the header value and the secret of that endpoint, and that only a valid v1 signature authenticates the request. If the assistant wrote a handler that parses the JSON and acts on it, it skipped the one check that matters. Prefer the official library’s verification call over a hand-written comparison.

Search the bundle for secrets

Generated front-end code sometimes holds a key because it was the fastest way to make a demo work. A small script finds the obvious cases. This one scans a build folder for Stripe keys, webhook secrets and Clavem management keys:

const patterns = {
  'Stripe secret or restricted key': /\b[sr]k_(live|test)_[A-Za-z0-9]{10,}/,
  'Stripe webhook secret': /\bwhsec_[A-Za-z0-9]{10,}/,
  'Clavem management key': /\bsk_clavem_[A-Za-z0-9]{8,}/,
};

I ran it on a folder with one file containing a restricted test key and a management key, and one containing only a public verification key. It reported two findings in the first file and nothing in the second, and exited with a failure code, which makes it usable in a build pipeline. A public key is meant to ship. A secret is not.

The rule for a license service is simple. The License API needs no secret, because the key is the credential, so the app holds none. The management key, which starts sk_clavem_, belongs only on your server.

Where the paid check should run

App type Where the check should live Reason
Web app with a backend On the server, on every request that needs it Anything in the browser can be edited
Desktop or mobile app In the app, against a signed token, plus gated downloads and updates The app is on the customer’s machine, so make the cheap path honest and the real value server-side
Command-line tool In the tool, with a cached result See licensing a CLI tool
Browser extension In the background worker, with the key kept in extension storage Page scripts must not see the key

A check in the interface alone is a suggestion. For a web app, the server must refuse the paid request. For a desktop app, accept that someone can patch the binary, and put the effort into the parts they cannot patch: the signed token, the download and the update.

Review checklist for generated billing and license code

  1. No secret key in the front end or the repository.
  2. Webhooks verify the signature on the raw body.
  3. Handlers are idempotent: the same event twice changes nothing the second time.
  4. Access is granted by a verified event or a server-side lookup, never by a redirect or a query parameter.
  5. The license check verifies product, status, expiry and signature, not only that a token exists.
  6. Failure paths are defined: timeout, rate limit, service unavailable, expired, refunded.
  7. Logs do not contain keys, tokens or emails.
  8. A test exists for each row of the break-it table above.

Ask the assistant to write those tests, then read them. Tests that only exercise the happy path are the usual output, so ask specifically for the attacks.

After launch

Support does not become easier because an assistant wrote the code. You will still answer “my key does not work” and “I lost my key”. Keep the app small enough that you understand every file, because a bug in generated code that nobody read will land in your inbox. See support for license issues.

Doing this with Clavem

Clavem is one way to buy the plumbing. It handles the Stripe webhook, issues the key and signs the answer, so the app and the assistant deal with one validate call and a signature check. The documentation has copy-paste code for the common stacks, and none of it requires a secret in the shipped app. Start from the quickstart, and use the table above to test what you build.

Questions

Can I own the copyright to code an AI assistant wrote?

It depends on your country and on how much human authorship the result contains. The US Copyright Office published a report in January 2025 on the copyrightability of AI-generated outputs, and summaries of it say prompts alone do not make a user the author, while human-written code, selection and modification can be protected. Ask a lawyer about your situation.

Is it safe to let an AI assistant write my Stripe and license code?

It can draft it, but you must review it as you would a stranger's code. The common failures are access flags that live in the browser, webhooks accepted without a signature check, secrets in the shipped bundle and fulfilment that trusts a redirect. Use a hosted checkout and an existing license service where you can.

Should the paid-feature check run in the app or on a server?

For a web app, on the server, because anything in the browser can be edited. For a desktop app, check a signed token in the app and keep paid downloads and updates behind the server.

Sources

  1. US Copyright Office, Copyright and Artificial Intelligence (as of November 2026)
  2. IPWatchdog, summary of the Copyright Office report on copyrightability (as of November 2026)
  3. Stripe, verify webhook signatures (as of November 2026)