Sub topic 3
Taking Payments
Assume you understand pages, forms, accounts, and spreadsheets, and you have a product idea to test. This chapter focuses on the later MVP decisions: charging users, protecting data, learning from users, and deciding whether your platform is still suitable.
Take payments safely
Start with a hosted checkout page from a payment provider. Your app creates a checkout session, and the provider collects card details. After payment, a webhook tells your app that the payment succeeded. Verify the webhook and make the handler idempotent, meaning repeated notifications produce only one result.
Track payment status separately from access. A user should receive paid features only after your server confirms the payment. Plan for refunds, failed payments, cancellations, and provider fees.
Add AI features carefully
Add AI only when it supports the product hypothesis. For example, an MVP might summarize a user's task list, but it does not need a full assistant. Set limits for requests and spending. Tell users when content is AI-generated, avoid sending unnecessary personal data, and provide a way to correct important output.
Protect security and privacy
Use authentication to identify users and authorization to decide what each user may access. Enforce ownership rules in the database, not only in the interface. Keep API keys in environment variables. Collect the minimum personal data, explain its use, and define deletion and retention rules.
Test with real users
Test payments in sandbox mode first. Then invite a small group of real users. Observe whether they complete the core flow, understand the price, and return to the product. Ask specific questions instead of “Do you like it?” Record failures and repeated requests.
Launch and deploy
Deploy a small, reversible release. Configure production secrets separately, enable error logging, back up important data, and test the payment return and webhook paths in production. Keep a rollback plan.
Measure and iterate
Choose metrics tied to the hypothesis:
| Question | Useful measure |
|---|---|
| Do users activate? | Percentage completing the core flow |
| Do they pay? | Checkout conversion rate |
| Do they stay? | Weekly retention and cancellations |
Change one important thing at a time and compare results.
Recognize limits and lock-in
Check export options, API quotas, pricing changes, custom-domain support, and whether you can access your database. A tool is risky when leaving requires rebuilding data or workflows.
Move to custom code when needed
Migrate when platform limits block a validated business need, operating costs exceed the benefit, performance is inadequate, or security and compliance require control you cannot obtain. Migrate gradually: export data, reproduce one core flow, test it, then move remaining features.
Exercise
What should happen before a user receives paid access?
Show answer
Your server should verify a valid payment event from the payment provider.