Skip to content

Feat/kkiapay widget flow - #8

Merged
jules-mahounou merged 2 commits into
mainfrom
feat/kkiapay-widget-flow
Oct 6, 2026
Merged

jules-mahounou merged 2 commits into
mainfrom
feat/kkiapay-widget-flow

Conversation

@jules-mahounou

Copy link
Copy Markdown
Collaborator

What & why

Checklist

  • Commits are signed off (git commit -s) — see DCO
  • Tests added or updated
  • If this touches routing/fallback: tests prove no double charge is possible
  • Docs and CHANGELOG.md (Unreleased) updated if behavior changed
  • No real secrets or personal data in code, tests, or fixtures

jules-mahounou and others added 2 commits October 5, 2026 18:40
Some providers (Kkiapay, and most checkout-style aggregators) cannot start
a payment from the server: the customer starts it in the provider's
widget, and the server verifies it afterwards.

- NextAction `widget` ({ provider, params }) tells the front end which
  widget to open
- Capability `widget` + CollectRequest `supportedWidgets`: widget routes
  are only used when the front end can open them; they can serve as a
  fallback after a server-push provider failed safely
- ProviderResult `merchantReference` and `amount`, recorded on attempts
- payenv.confirm(key, providerRef) links the provider transaction after
  checking with the provider that it carries this payment's merchant
  reference and amount, so a customer cannot confirm an order with
  another (e.g. cheaper) transaction; rejected confirmations leave the
  payment unchanged
- refresh leaves a widget payment untouched until it is confirmed
- new error code REFERENCE_MISMATCH

Anti-fraud tests were checked against removing each verification.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jules Mahounou <234069818+jules-mahounou@users.noreply.github.com>
Kkiapay payments start in its widget; the official server SDK can only
verify (`/api/v1/transactions/status`) and refund. The connector:
- returns a `widget` next action with the widget parameters (public key
  only; partnerId = the payment's idempotency key), only when the front
  end lists `kkiapay` in supportedWidgets
- verifies transactions server-side (status, amount, partnerId, failure
  codes) for payenv.confirm
- verifies (constant-time shared secret) and parses webhooks
- opt-in sandbox tests driven by .env

demo: loads the Kkiapay widget, "Simuler une panne FedaPay" makes FedaPay
fail before any money can move so Payenv falls back to the widget, and
the widget's transaction id is confirmed server-side. Verified with the
server: fallback, refusal without widget support, rejected confirmation
leaves the payment unchanged, normal path stays on FedaPay.

docs: ADR 0005, architecture, getting started, connectors, quirks, and a
changeset (minor) adding the connector to the fixed version group.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jules Mahounou <234069818+jules-mahounou@users.noreply.github.com>
@jules-mahounou
jules-mahounou merged commit bcd8ecb into main Oct 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant