Skip to content

Store payments

Checkout payments inside your deployed store. Template: store-cay-starter.

Gateway Browser Server Notes
Stripe Payment Element PUBLIC_STRIPE_KEY STRIPE_SECRET_KEY Webhook: STRIPE_WEBHOOK_SECRET
PayPal Checkout PUBLIC_PAYPAL_CLIENT_ID PAYPAL_CLIENT_SECRET PAYPAL_ENV=sandbox|live

You can develop without payment keys; checkout may use a manual / mock path depending on configuration.

  1. Create keys in the Stripe Dashboard.
  2. Set env / secrets — see Environment variables.
  3. Webhook endpoint:
https://<your-store-domain>/api/stripe/webhook
  1. Events: payment_intent.succeeded, payment_intent.payment_failed, charge.refunded.
  1. Create a REST app in the PayPal Developer dashboard.
  2. Set PUBLIC_PAYPAL_CLIENT_ID + PAYPAL_CLIENT_SECRET.
  3. Match PAYPAL_ENV to sandbox or live credentials.
  1. Cart → /checkout
  2. Address → shipping options (/api/shipping-options) → optional discount
  3. Pay with Stripe, PayPal, or configured fallback
  4. Order written via /api/orders + payment confirm
  5. Redirect to /order/confirmed with guest token; later lookup at /order/lookup

Shipping rates and discount codes are edited in Admin → Settings (D1), not in env vars.