# Pix, card and boleto with Pagar.me; Stripe and Polar review

Pagar.me joins Stripe, Polar and RevenueCat as an optional billing provider with an in-app checkout, and every provider call now works on the deployed Worker.

<Callout title="Fix: provider calls on the deployed Worker">
workerd refuses `fetch` with `redirect: "error"`, so every billing provider call failed on a
deployed Worker: Stripe webhooks answered 503 after verifying, checkout and portal could not
start, RevenueCat reconciliation never succeeded. Calls now use `redirect: "manual"`; a redirect
is still never followed. Redeploy to get it.
[Commit](https://github.com/CarlosZiegler/template-cloudflare/commit/b9d03966)
</Callout>

- **Pagar.me as a fourth provider.** Off until `pagarme` is in `BILLING_PROVIDERS`. Pix (one period, QR and copy-and-paste code, 30-minute expiry by default), card tokenized in the browser (renewing, or one period in up to 12 installments) and boleto (renewing or one period), in BRL. `/api/billing/pagarme` verifies Pagar.me's RS256 signature when present and always re-reads the order or subscription by id before granting, so refunds and chargebacks revoke. Pagar.me has no recurring Pix. See [Payments](/docs/features/payments) and the [ADR-0004 amendment](/docs/adr/0004-payments-providers). [Commit](https://github.com/CarlosZiegler/template-cloudflare/commit/a50c1d8e)
- **In-app checkout on `/billing`.** With Pagar.me as the checkout provider, choosing a plan opens a dialog: billing details once (CPF or CNPJ, phone, address), then the method; a Pix screen with a countdown and status polling, a boleto screen, paying the next period ahead, and Cancel renewal. Copy in English, German, French and Brazilian Portuguese. [Commit](https://github.com/CarlosZiegler/template-cloudflare/commit/f30f8337)
- **Stripe review.** The pinned `2026-09-30.endive` is current. Portal cancellations in flexible billing mode (`cancel_at`) now show as ending; `invoice.paid`, `invoice.payment_failed` and `checkout.session.async_payment_failed` re-read the subscription; `STRIPE_PAYMENT_METHOD_CONFIGURATION` pins Checkout's payment methods, for example card and boleto for BRL prices. [Commit](https://github.com/CarlosZiegler/template-cloudflare/commit/aec92f0d)
- **Polar review.** The pinned `2026-10` is current until Polar's January 2027 cycle. A subscription payload that no longer parses (a webhook endpoint created on another API version) now answers 400 instead of being recorded and dropped. [Commit](https://github.com/CarlosZiegler/template-cloudflare/commit/adf62fc9)
- **Payment settings stay secrets.** `scripts/check-production-config.mjs` refuses `BILLING_*`, `STRIPE_*`, `POLAR_*`, `PAGARME_*` and `REVENUECAT_*` in `wrangler.jsonc` `vars`, printing names only.

[PR #218](https://github.com/CarlosZiegler/template-cloudflare/pull/218)
