Built an app in Lovable? Here's how to let it take money safely
A practical layout: the interface stays in Lovable, Bolt or v0, data stays in Supabase, a payment provider takes the cards, and Dirygent keeps balances, bookings and processes. Step by step, using a studio that sells class passes.
A familiar story. In one evening, Lovable gave you a lovely app: a schedule, an account page, a "Buy" button. Your friends love it. Then a thought creeps in: "What happens when real money starts flowing through this?"
Good question. This post is about answering it without throwing anything away.
The example we'll use
A small yoga studio. It sells passes for 10 classes, and each class has 12 spots. Cancel at least 12 hours ahead and the class goes back on your pass.
Sounds simple. But it already has everything apps usually break on:
- a balance: how many classes a person has left;
- a booking: how many spots a class has left;
- a payment that arrives from a bank or provider separately from the button press;
- rules over time: cancellations, refunds, no-shows.
Who does what
Four layers. Each does what it's best at.
- Screens: Lovable (or Bolt, v0, anything). Schedule, account page, buttons. Nothing changes here.
- Sign-in and profiles: Lovable Cloud or Supabase, as before.
- Cards: a payment provider, Stripe or one that works in your country. It takes the card safely and reports the payment with a webhook.
- Books and processes: Dirygent. Every customer's class balance, every class's spots, the cancellation rules.
In words, the layout looks like this:
Customer
→ screens (Lovable)
→ Dirygent endpoints
→ books and processes
Card payment (provider)
→ webhook
→ Dirygent process → +10 classes
Lovable draws. The provider takes the card. Dirygent remembers who owes what, and doesn't let it drift.
Step by step
1. Connect your agent to Dirygent. In Claude, ChatGPT or Cursor, paste:
Read https://dirygent.com/agents.md and connect me to Dirygent. Then help me build the books for a studio: passes for 10 classes, classes with 12 spots, cancelling 12 hours ahead returns the class.
2. The agent builds the books. Each customer gets a "classes" account, each class gets a "spots" account. Booking is one process: first a spot in the class is reserved, then a class is taken off the pass. If there are no spots, nothing comes off the pass, and a reservation nobody confirms releases itself after a set time.
3. The platform checks the agent. An endpoint that moves money or classes won't save without authentication. Quantities and amounts have limits. The provider's key must live in secrets, not in the text of a process. Nobody has to remember these rules: the platform simply won't save something unsafe.
4. Allow your frontend. Dirygent has a list of allowed origins (CORS) in its settings. Add your Lovable app's address, and its screens can call your endpoints on Dirygent.
5. Wire up the provider's webhook. When a payment goes through, the provider sends a webhook and a Dirygent process adds 10 classes. The payment's ID becomes the operation's key. Providers resend a webhook when they don't get an answer in time, and that's fine: a repeat with the same key doubles nothing.
6. Run it all in the sandbox. The money there isn't real, so break things freely: two people grab the last spot at once, the webhook arrives twice, someone cancels 11 hours and 59 minutes ahead. See what happens and fix it if needed.
7. Go live. In one deliberate step, after your "yes".
Three tips that will save your nerves
- The price lives on the server, not in the button. The screen can show "$30", but the amount charged has to come from rules on the server. Otherwise a clever customer will change it in the request.
- Secret keys belong in secrets. The provider's key must never end up in frontend code, or in a chat with your agent as plain text.
- Treat retries as normal. Networks drop answers, people double-click, providers resend webhooks. Every money operation needs a key that lets a repeat be recognised.
Do you even need Dirygent?
Honest answer: not always.
If you sell one thing with a one-off payment and the provider handles everything, the integration Lovable already has may be enough. Great.
Dirygent is worth adding when you have balances, credits, passes, bookings, refunds, splits between several parties (as in a marketplace), or processes that stretch over time: subscriptions, no-shows, reminders. In other words, when a mistake already costs money and trust.
We mapped all the tools in "Lovable, Bolt, Replit, v0, Supabase and Dirygent: who does what", and why a plain table in a database isn't enough for money in "Why a database is not yet a ledger".
Dirygent is in early access. Tell us what you're building and we'll help with your first app.