The ways I've used Stripe, and what each one taught me
On this page
I have wired Stripe into four different kinds of product over the last few years. Each one is a different shape of problem and each one taught me something I now do by default.
A payment field inside a Statamic form
The first was an addon: a fieldtype that takes a card payment as part of a normal Statamic form submission. Stripe Elements renders the card input, the browser gets a token, and a FormSubmitted listener charges it before the submission is saved. If the charge throws, the listener throws a ValidationException, so the form shows an error and nothing is stored. The receipt URL goes into the submission data.
What it taught me: hooking the form lifecycle is the right place, because validation and payment fail together. What I would change: it uses the legacy Charges API with a card token. Today it would be a PaymentIntent with the confirmation on the client, which also handles 3D Secure properly.
SaaS subscriptions with Cashier
Two of my apps, a feedback tool and a structured-data tool, sell monthly plans to users who have accounts. That is exactly what Cashier is for: newSubscription('default', $priceId), an embedded Checkout (ui_mode => embedded) so the card form lives on my page, and Cashier's webhook controller keeping the local subscription in sync.
What it taught me: when the customer has a login, let Cashier own the customer and subscription tables. The amount of state you would otherwise mirror by hand is bigger than it looks.
One-time product licenses, no Cashier
My desktop app sells a license once. There are no accounts, so Cashier would be dead weight. It is plain stripe-php: a Checkout Session in payment mode with product metadata, a success page, and a webhook.
$session = $this->stripe->checkout->sessions->create([
'mode' => 'payment',
'line_items' => [['price' => config('office.stripe.price'), 'quantity' => 1]],
'metadata' => ['product' => 'uncanny-office'],
'success_url' => route('checkout.success').'?session_id={CHECKOUT_SESSION_ID}',
]);
The license key is issued from both the success page and the checkout.session.completed webhook, whichever lands first, and the issuing code is idempotent on the session id: look up an existing license inside a transaction, create one if missing, and let the unique index settle the race on SQLite where lockForUpdate is a no-op. charge.refunded and a lost dispute revoke the key by payment intent. The webhook verifies the Stripe signature, and the test suite signs its own payloads with HMAC so it can exercise every branch without Stripe.
What it taught me: metadata on the Checkout Session is how you know an event is yours when one Stripe account serves more than one product.
A client billing portal
The biggest one. Invoices and estimates are paid through emailed links with no login. Retainers are Stripe subscriptions built from a Price created lazily the first time a client sets one up, then a subscription-mode Checkout. Processing fees can be passed through as an extra line. Checks and Zelle are recorded as manual payments next to the Stripe ones, so the invoice has one balance regardless of how it was paid.
The hard-won rules came from ACH. ACH is a delayed-notification method: settlement is about four business days, a PaymentIntent can read succeeded and still fail afterwards, and the dispute that follows is final. So nothing gates access on succeeded alone, and any grace period has to outlast settlement plus Stripe's retries. ACH is also unsupported in the Customer Portal, so the portal has its own cancel flow. Apple Pay and Google Pay are card wrappers, not separately priced methods. And surcharging depends on state law and card network rules, so the fee is a per-business setting, not a constant.
The rule across all of them
Return a 2xx for every event you do not act on, and make every handler idempotent. The portal's markPaid checks for the payment intent before writing because checkout.session.completed and payment_intent.succeeded can both land for one charge. The license webhook ends in default => 'Ignored' and still answers 200. I wrote up the why in Return 200 from webhooks you don't act on.
What I would pick today
- One-time purchase: Checkout plus a webhook, no Cashier.
- Recurring with user accounts: Cashier, embedded Checkout, Billing for the invoices.
- Recurring without logins: subscription-mode Checkout from emailed links, your own tables.
- Payment inside a CMS form: the fieldtype, rebuilt on PaymentIntents.