---
title: "Payments"
description: "Payment sessions, authorization, capture, refunds, and provider webhooks in EdgeCart."
---

> Documentation Index
> Fetch the complete documentation index at: https://edgecart.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Payments

The Payments module handles the money side of checkout: it creates a payment
session, authorizes the shopper's payment method, and later captures or refunds
the money. EdgeCart supports Stripe and a manual provider.

## Features

- **Payment collections and sessions** — one collection per cart, with a session
  for the selected provider.
- **Authorization** — confirm that the shopper's payment method can cover the
  order.
- **Capture** — move authorized money into the merchant account.
- **Refunds** — full or partial refunds against a captured payment.
- **Provider webhooks** — receive asynchronous payment and refund updates from
  the provider.
- **Reconciliation** — keep the local payment state aligned with the provider.

## Key concepts

| Concept | What it means |
|---|---|
| Payment collection | The payment container for a cart or order. |
| Payment session | A provider-specific attempt inside the collection. |
| Authorization | A hold that reserves the amount before capture. |
| Capture | The action that transfers authorized money. |
| Refund | Returning captured money to the shopper. |
| Provider webhook | An asynchronous event from Stripe or another provider that updates the payment state. |
| Manual provider | A provider that records payments without an external gateway. |

## How it fits

- **Cart and checkout** — checkout creates a payment collection and session for
  the cart. The storefront renders the provider's payment element.
- **Orders** — the order is created after payment authorization. The order page
  owns the capture and refund controls.
- **Order changes** — return refunds are recorded separately; moving money still
  happens through the payment panel.
- **Observability** — payment events (`payment.captured`, `payment.refunded`)
  are delivered through the outbox.

> **Payment keys are deployment secrets**
>
> Stripe keys are configured by the deployment operator as Worker secrets, not
> in the merchant admin. The storefront needs both `STRIPE_SECRET_KEY` and
> `STRIPE_PUBLISHABLE_KEY` from the same Stripe account; without them, paid
> checkout is blocked.

## Common tasks

- **Merchant** — capture or refund a payment from the order detail page. The
  payment panel shows the current state and the available actions.
- **Developer** — browse the Storefront and Admin operations in the
  [API reference](https://edgecart.dev/api). Webhook signatures and retry behavior are described in
  the [API conventions](https://edgecart.dev/reference/api-conventions).

## Current boundaries

- Stripe supports one capture per PaymentIntent; a partial capture releases the
  remainder. The manual provider supports cumulative captures.
- Only `pending` and `requires_action` provider refunds wait for a later webhook;
  `failed` and `canceled` attempts are stored as audit rows.
- A late refund success that would exceed the captured amount is rejected and
  acknowledged instead of retried forever.
- Webhook URL validation is lexical; DNS rebinding cannot be detected inside the
  Workers runtime, so only subscribe endpoints you control.

See [current limitations](https://edgecart.dev/reference/limitations) for the full list.

## Related modules

- [Orders](https://edgecart.dev/modules/orders) — the order that owns the payment state.
- [Cart](https://edgecart.dev/modules/cart) — the cart that creates the payment collection.
- [Order changes](https://edgecart.dev/modules/order-changes) — returns and claims.
- [Observability](https://edgecart.dev/modules/observability) — payment events and webhook delivery.

Source: https://edgecart.dev/modules/payments/index.mdx
