Skip to content

Lesson 1 of 9 · 24m

Choosing the Payment Integration Shape Before Writing Code

Compare hosted checkout, embedded elements, server-side payment intents, and PayPal order flows before accidental architecture locks you in.

The worst payment integrations I inherit usually were not written by careless people. They were written by people who started with the API call they could make work fastest, then discovered six months later that taxes, subscriptions, refunds, 3DS, PayPal, and reconciliation all assumed a different model. Payments are a lifecycle problem first and an API problem second.

The three common shapes

Most Stripe integrations choose one of these architectures:

Hosted Checkout       Stripe hosts the payment page
Embedded Elements     your page, Stripe-hosted input fields
Server-first custom   your UI, your orchestration, Stripe API primitives

Hosted Checkout gives the smallest PCI surface and the fewest lifecycle mistakes. Embedded Elements keeps your UX while letting Stripe own sensitive card inputs. Fully custom server-first orchestration is flexible, but now you own payment method collection, confirmation state, authentication edge cases, and recovery UX. PayPal has a similar split: standard redirect checkout is operationally simpler; advanced card fields move complexity and PCI scope back toward you.

Model the lifecycle, not the endpoint

A payment is not charge succeeded. It is a sequence of states that may pause for customer action or fail asynchronously:

created -> requires_payment_method -> requires_confirmation
        -> requires_action -> processing -> succeeded
                                      -> canceled / failed

Stripe PaymentIntents model that explicitly. PayPal Orders move through CREATED, APPROVED, COMPLETED, and related capture states. Your integration should store provider object IDs and statuses rather than treating one API response as permanent truth.

Decide who owns checkout truth

Before choosing endpoints, write down the owner of each responsibility:

product price and currency       your system or provider catalog?
tax                              Stripe Tax, external service, manual?
shipping                         checkout-collected or already known?
customer identity                your user ID mapped to provider customer?
order state                      your database as merchant of record?
receipts                         provider email, your email, or both?

The answer determines whether webhooks are convenience events or mandatory state machines. If money movement affects access, credits, shipment, or entitlement, your database must have its own order state independent of the provider.

A pragmatic default

For a small team selling simple one-time products, start with Stripe Checkout in payment mode and PayPal redirect checkout only if customer demand justifies it. Use embedded or custom flows when you can articulate the product requirement that hosted checkout cannot satisfy — not because it feels more professional.

Field notes

  • Never let the client decide the amount; look it up server-side from your catalog.
  • Currency is part of amount semantics. 1000 means ten dollars in USD but one thousand yen in JPY.
  • Decide whether orders can be retried before choosing a flow; retry design is much harder after launch.
  • If you support both Stripe and PayPal, normalize them behind your own order state machine instead of copying provider states into business logic.
  • Do not store card data 'temporarily' while prototyping. There is no harmless temporary cardholder data.

Was this lesson helpful?

Sign in to rate