Payments Guide for AI Coders
How to accept payments on your website. Payment providers, checkout flows, and subscription billing. You'll need authentication so you know who's paying.
In this chapter
- Which payment provider to pick (and why)
- How checkout flows and subscriptions work
- What to tell your AI tool to set up payments
- Whether you even need payments right now (hint: maybe not!)
Payment Providers
Checkout Flow Types
Subscription Billing
Pricing Page Patterns
A visual mockup of a typical 3-tier pricing table you can ask AI to build:
Integrate Payments with AI
Step-by-step AI prompts to set up each provider. Copy the prompts, paste into your AI tool, and follow along. Make sure your site is deployed before testing with real payments.
Stripe Recommended
Stripe is the most popular choice. You'll create a Stripe account, get your API keys, and use AI to wire everything up. No coding needed on your part.
“Add Stripe Checkout to my app for a product called [Product Name] priced at [amount] USD. When the visitor clicks 'Buy Now', send them to Stripe's hosted checkout page so Stripe handles the whole payment. After a successful payment, bring them back to my /success page. Keep my Stripe keys in a safe place so they're never visible to visitors.”
“Create a /success page that shows a thank-you message after payment. Also set up a listener so Stripe can tell my app whenever a payment actually goes through. When that happens, save the customer's email and the amount they paid. Make sure the listener checks that the message is really from Stripe (using the secret Stripe gives me for this), so nobody can fake a payment.”
“Add a 'Manage Subscription' button that sends the signed-in customer to Stripe's Customer Portal. The portal is a page hosted by Stripe where customers can update their payment method, view past invoices, and cancel their subscription. When they're done, bring them back to my /account page.”
Stripe Managed Payments Handles Tax
Stripe Managed Payments makes Stripe your Merchant of Record, so Stripe handles sales tax worldwide for you. It works with Stripe Checkout and Payment Links. Create your product in the Stripe dashboard first, then use these prompts.
“I'm using Stripe Managed Payments so Stripe handles sales tax for me. Add a 'Buy Now' button to my pricing page that sends visitors to a Stripe Checkout page for my product [product name or price ID], with Managed Payments turned on. Pass the customer's email if they're logged in so the checkout form is pre-filled.”
“Set up a listener so Stripe can tell my app whenever a purchase or subscription change happens. When a checkout completes, mark the customer as having purchased. When a subscription changes plans, update their plan in my database. Make sure the listener checks that the message is really from Stripe (using the secret Stripe gives me for this), so nobody can fake a purchase.”
The customer portal works the same way as in the Stripe steps above.
PayPal Wide Reach
PayPal is great when your customers already have PayPal accounts. Get your Client ID and Secret from the PayPal Developer Dashboard, then use these prompts.
“Add PayPal Smart Payment Buttons to my checkout page. Show both a PayPal button and a Debit/Credit Card button. When the visitor clicks Pay, start an order for [amount] USD with the description [Product Name]. Once PayPal confirms the payment, send the visitor to my success page. Keep my PayPal keys in a safe place so they're never visible to visitors.”
“When a visitor finishes paying with PayPal, have my server double-check with PayPal that the payment is real (don't trust the visitor's browser for this). Once it's confirmed, save the order details (customer email, amount, and the PayPal transaction ID) in my database. Keep my PayPal keys in a safe place so they're never visible to visitors.”
“Set up PayPal subscription billing. I already created a subscription plan in the PayPal dashboard with Plan ID [plan_id]. Add a 'Subscribe' button that starts the PayPal sign-up flow. Once the visitor approves the subscription, save the subscription ID against their account. Also set up a listener so PayPal can tell my app whenever a payment goes through or a subscription gets cancelled, and update that customer's status in my database.”
Paddle SaaS
Paddle handles payments, taxes, and invoicing as a Merchant of Record. Create your products in the Paddle dashboard, grab your API key and Client Token, then use these prompts.
“Add Paddle checkout to my app. Add a 'Buy Now' button that opens Paddle's checkout popup for my product (price ID [price_id]). If the visitor is already signed in, pre-fill the form with their email so they don't have to type it. After a successful payment, send them to my /success page.”
“Set up a listener so Paddle can tell my app whenever a purchase or subscription goes through. When that happens, save the customer's Paddle ID and their subscription status in my database, handling both one-time purchases and new subscriptions. Make sure the listener checks that the message is really from Paddle (using the secret Paddle gives me for this), so nobody can fake a purchase.”
“Add subscription management to my app. On the account page, add an 'Update Payment Method' button and a 'Cancel Subscription' button. When the signed-in customer clicks either one, send them to the matching Paddle page for their subscription. Keep my Paddle key in a safe place so it's never visible to visitors.”
Frequently Asked Questions
Which payment provider should I choose?
Stripe if you want the most flexibility and ecosystem support. Stripe Managed Payments or Paddle if you want someone to handle sales tax for you (they act as your Merchant of Record). PayPal if your customers specifically prefer it. For most projects, start with Stripe: it's the industry standard.
Do I need to handle sales tax?
Yes, if you're selling to customers in regions that require it (which is most places). With plain Stripe you handle tax yourself or add Stripe Tax. Stripe Managed Payments and Paddle handle tax automatically as Merchants of Record: they charge and remit tax on your behalf.
Can I test payments without using real money?
Yes. Stripe has a test mode with test card numbers (4242 4242 4242 4242 is the classic test card). Paddle has a sandbox environment too. Always build and test with fake payments before going live.
Will adding payments cost me money?
Setting up payments is free. You only pay when someone actually buys something (typically 2.9% + $0.30 per transaction for Stripe). There are no monthly fees on any provider's free tier.
Do I need payments for my first project?
Probably not! Most first projects don't need payments. Add them only when you have something to sell: a product, subscription, or service. Focus on building your app first.
What is the easiest payment provider for beginners?
For digital products, Stripe Managed Payments or Paddle are the easiest: they handle payments AND sales tax globally, so you don't need to worry about tax compliance. Plain Stripe is more flexible but leaves tax to you. (Lemon Squeezy, an old favorite, stopped taking new sign-ups in November 2026.)
Do I need to handle taxes?
If you use Stripe Managed Payments or Paddle, they handle sales tax automatically as your Merchant of Record. With Stripe or PayPal, you're responsible for tax collection and reporting, so consider Stripe Tax or a service like TaxJar.