Prompt
I need to accept payments on a website and send invoices, refunds, and cancellations through an API; what setup makes sense?
Latest observation
Oct 14, 2026
OpenAI APIWeb search: off
A sensible setup is usually:
Recommended architecture
Use a payment processor plus a billing/invoicing service (or your own backend layered on top of the processor).
1) Payment processor
Pick one that supports:
- one-time payments
- subscriptions/recurring billing
- refunds
- webhooks
- customer/invoice APIs
Common choices:
- Stripe — strongest all-around option for APIs, invoices, subscriptions, refunds, and webhooks
- PayPal — useful if you need PayPal wallet support, but API/billing flow is often less clean
- Adyen / Checkout.com — better for larger/global setups
- Square — good for smaller businesses, especially if in-person payments are also needed
2) Your backend
Your website should not talk directly to the payment provider for business logic. Instead:
- your frontend collects payment details via the provider’s hosted fields/checkout
- your backend creates payments/invoices/refunds/cancellations via API
- webhooks update your database when payment status changes
3) Invoicing / billing flow
Depending on your needs:
- If you only need invoices after payment: generate them in your app or use the processor’s invoice API
- If you need recurring billing: use subscriptions + automatic invoicing
- If you need manual invoices: use hosted invoice pages or send invoices through the provider
Practical setup if you want the simplest path
Best default: Stripe
Use:
- Stripe Checkout for accepting card payments
- Stripe Invoicing for invoices
- Stripe Billing for subscriptions/cancellations
- Refund API for refunds
- Webhooks to keep your app in sync
This gives you:
- hosted payment pages or embedded checkout
- invoice creation/sending
- subscription cancellation and proration handling
- refunds via API
- strong developer docs and reliable webhook support
Typical request flow
- User places order on your site
- Your backend creates a Stripe Checkout Session or Payment Intent
- User pays on Stripe-hosted UI
- Stripe sends a webhook confirming success
- Your backend marks the order paid
- For invoices, create/send invoice through API
- For refunds/cancellations, call API and listen for webhook updates
If you need more control
If you want:
- custom invoice PDF generation
- multiple payment providers
- advanced accounting workflows
Then use:
- payment gateway: Stripe/Adyen/etc.
- internal billing service in your backend
- optional accounting integration: QuickBooks, Xero, etc.
Suggested stack
- Frontend: any framework
- Backend: Node.js / Python / Java / .NET
- Payments: Stripe
- Webhooks: your backend endpoint
- Database: store customers, orders, invoices, payment state
- Accounting: optional sync to QuickBooks/Xero
Rule of thumb
- Small/medium SaaS or ecommerce: Stripe
- Need PayPal specifically: Stripe + PayPal
- Enterprise/global: Adyen or Checkout.com
- Marketplace/platform: Stripe Connect or Adyen for Platforms
If you want, I can recommend a specific setup based on:
- one-time vs subscriptions
- countries/currencies
- need for VAT/GST invoices
- your backend language/framework