Selling: Shop and Stripe
Selling online usually means a shop system, a payment provider, a plugin that connects them, and a monthly bill for each. The ForgeCMS shop is a module: a list of products in your content repo, an order form ForgeCMS builds, and three ways to get paid. This chapter covers euros, by bank transfer and by card; the next one covers Ğ1.
Goal
By the end of this chapter you can:
- put products on your site, physical and digital,
- take orders with the legal texts in place,
- get paid by bank transfer or card (Stripe),
- deliver digital products automatically.
Switching it on
The shop decides where money goes, so everything about payment lives in app.sml on the server, never in the content repo. Ask the AI:
Please add a shop. Orders go to shop@mybakery.com. Customers pay in euros by
bank transfer to my account (IBAN ..., holder ...). Terms are at /terms,
the withdrawal policy at /withdrawal, privacy at /privacy.
In app.sml:
Shop {
notify: "shop@mybakery.com"
iban: "DE.. .... .... .... .... .."
accountHolder: "Our Bakery GmbH"
terms: "/terms"
withdrawal: "/withdrawal"
privacy: "/privacy"
}
The shop needs mail on the server (chapter 10): orders and confirmations go out by email.
Products
The products are in shop.sml in your content repo, one line each:
Catalog {
Product { id: "rye-1kg" title: "Sourdough rye, 1 kg" priceEur: "5.20" text: "Dark rye, 24 hours of rest." image: "shop/rye.jpg" }
Product { id: "honey-500" title: "Forest honey, 500 g" priceEur: "9.00" text: "From the beekeeper next door." image: "shop/honey.jpg" }
Product { id: "recipe-book" title: "Our recipe book (PDF)" priceEur: "12.00" type: "digital" text: "38 recipes from our bakery." }
}
| Line | Meaning |
|---|---|
id |
lower case, digits, -; unique |
title, text |
name and short description (title_de, text_de for translations) |
priceEur |
price in euros. price is the price in Ğ1 (next chapter); a product may have both, then the buyer chooses |
type |
physical (default) or digital |
image |
picture below static/ (optional) |
On a page, Products { } shows them all as cards with an order button; Products { ids: "rye-1kg honey-500" } shows only these, in this order.

The price is always taken from shop.sml, never from what the browser sends. Nobody can order your honey for one cent.
The order
The order button opens a form: quantity, name, email, the delivery address (only for physical products), the payment method if there is more than one, and the links to your terms, withdrawal policy and privacy policy. The button says "Place order (payment required)" (in German "Zahlungspflichtig bestellen"), as German law requires.
After ordering, the buyer sees a payment page and gets an order mail. That mail contains your terms and your withdrawal policy in full: the law wants them on a "durable medium", and an email is one. You get a mail too.
For a digital product the form has a required box: the buyer wants it right away and knows that this ends the right of withdrawal. The time of that consent is stored with the order.
You can change which fields the form has (a phone number, a delivery date) with Field lines in Shop { }, like in the contact form.
Bank transfer
With iban and accountHolder, the payment page and the buyer's mail show your account and the order number as the payment reference. There is no bank connection, so you confirm payments yourself: your order mail contains a link, and when the money is on your account you open it and press Confirm payment. The buyer gets a mail, and a digital product is delivered right then.
Unconfirmed bank transfer orders expire after 14 days.
Card and more: Stripe
For payment by card, SEPA direct debit, Apple Pay or Google Pay, ForgeCMS uses Stripe. The buyer pays on Stripe's own page; card numbers never touch your server.
Please add Stripe card payments to my shop. Start in test mode.
You need a Stripe account (stripe.com). The AI adds Stripe { admins: "me@mybakery.com" } to app.sml. The keys do not go into app.sml: they go into a separate file on the server, stripe.sml in the data folder, that only the server can read. The AI shows you where to find your keys in the Stripe dashboard and how to set up the "webhook", the address where Stripe reports payments to your site.
Products with priceEur then get the option "Card, SEPA and more". The buyer is sent to Stripe, pays, and comes back; the order is booked at once.
Test first. In test mode, Stripe accepts the test card 4242 4242 4242 4242 with any future date and any three digits. Buy something from yourself. When everything works, switch to live at /stripe/admin. Refunds are made in the Stripe dashboard.
Stripe charges a fee per payment; see their price page. Bank transfer costs you nothing, but you confirm by hand.
Digital products
A digital product needs its file on the server, never in the public content repo. The AI puts it into the data folder and adds a line:
Delivery { product: "recipe-book" file: "files/recipe-book.pdf" }
After payment the buyer gets a mail with a download link and a receipt number. The link works five times within 30 days. A digital product without a Delivery is shown but cannot be ordered.
Orders
Every order is a small file on your server; nothing is in a database or at a third party (except the card payment at Stripe). Order mails are your overview. If you want a list, ask the AI: "Show me all orders of October with name and total."
The legal part
A shop in the EU needs a legal notice, terms, a withdrawal policy and a privacy policy. ForgeCMS links and mails them at the right places, but it cannot write them for you. The AI can make a first draft; for a real shop, have them checked, or use a service that provides legal texts for small shops.
Pitfalls
- The products do not appear: a product with only
priceEuris hidden while there is neither an IBAN nor Stripe. The local preview shows such products with a red note. - "Cannot be ordered" on a digital product: its
Deliveryline is missing. - Mails land in spam: chapter 10, the DNS entries.
- Stripe payments do not get booked: the webhook is missing or has the wrong secret. Ask the AI to check
/stripe/admin.
What you learned
Shop { }inapp.smlholds everything about money; products are inshop.smlon Codeberg.- The order form, the order mails with the full legal texts, and the consent for digital products are built in.
- Bank transfer: free, confirmed by you with a link. Stripe: card and more, keys only on the server, test mode first.
- Digital products are delivered by download link right after payment.
