You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(payments): Comgate first checkout activation and failure policy
Persist pending payment_checkout_sessions at Comgate checkout creation
so webhooks can resolve userId/planType on first purchase. Align
payment.failed to past_due (matching GoPay). Document Comgate secrets in
AGENTS.md and update payments README to reflect the real provider.
Co-authored-by: Jakub Doboš <kubo6472@users.noreply.github.com>
RSS_SECRET — 32+ random chars used only to sign/tokenize personal account RSS URLs (`/api/feed/:userId/:token` and `/api/account/rss`); not required for the public feed endpoint (`/api/feed/public`)
308
311
VMP_API_PIPELINE_SECRET — shared with media-pipeline for `POST /api/admin/videos/:id/pipeline-status` HLS availability callbacks
309
312
REPLICATION_TARGET_URL — full URL to Deno ingest (`/api/internal/replication/ingest` on api-node)
Copy file name to clipboardExpand all lines: packages/payments/README.md
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,11 +66,33 @@ From [GoPay docs](https://doc.gopay.cz/#android-a-ios) (also tracked in [#442](h
66
66
67
67
This draft therefore never promises native Apple/Google Pay; checkout always redirects to `gw_url`.
68
68
69
+
## Comgate draft behaviour
70
+
71
+
1.**Checkout** — `POST /api/payments/payment` creates a Comgate payment with `initRecurring=true` and returns a `redirect` URL. A pending row in `payment_checkout_sessions` (keyed by `refId` / `transId`) stores the user and plan until the webhook fires.
72
+
2.**Webhook** — Comgate sends **POST** callbacks with a `secret` field. The Worker verifies the secret, re-fetches status via `/v1.0/status`, and resolves the paying user from the pending checkout session (first purchase) or an existing subscription row (renewals).
73
+
3.**Cancel** — `POST /v1.0/cancel` on the stored `provider_subscription_id` (Comgate `transId`).
74
+
4.**Failed renewal** — maps to `past_due` (same grace-period policy as GoPay), not immediate cancellation.
75
+
76
+
### Comgate admin_settings (no hardcoded prices)
77
+
78
+
| Key | Purpose |
79
+
|---|---|
80
+
|`comgate_monthly_price` / `comgate_yearly_price` / `comgate_club_price`| Plan amounts in **major** units (e.g. `199` = 199 CZK) |
2. Register in `src/registry.ts``PROVIDER_FACTORIES`.
73
96
3. Wire config in the API composition root (`packages/api/src/paymentProviders.ts`).
74
97
4. Add webhook route `/api/payments/webhook/<id>` or dispatch by path.
75
-
76
-
Comgate remains a registered stub — enable in settings only after a real implementation lands.
98
+
5. For redirect providers without embeddable user metadata (Comgate), persist a pending `payment_checkout_sessions` row at checkout creation so webhooks can resolve the paying user.
0 commit comments