Skip to content

feat(core): a public-key credential for payment providers - #99

Open
alexasomba wants to merge 1 commit into
emdashCommerce:mainfrom
alexasomba:feat/provider-public-key
Open

alexasomba wants to merge 1 commit into
emdashCommerce:mainfrom
alexasomba:feat/provider-public-key

Conversation

@alexasomba

@alexasomba alexasomba commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of the Flutterwave set described in #97. Item 2 — a generic core seam, independent of #85 (Paystack) and #98 (the Flutterwave package). No Flutterwave code in core.

Why

Flutterwave Inline, its on-page checkout, is a browser SDK initialised with the account's public key (FLWPUBK-…). Core's provider settings stored only secretKey and webhookSecret, and a provider has no KV access, so the server could not hand the browser client the key it needs.

The shortcut — deriving the public key from the secret key — is not available. I checked a real test pair: FLWPUBK_TEST-991d… and FLWSECK_TEST-03d5… have different hash segments.

What

  • PaymentProviderCredentials.publicKey and credentialFields.publicKey (label, prefixes, help).
  • settings:<id>PublicKey in the settings schema, providerCredentialSetting and GET admin/settings _providers, validated against the prefixes the provider declares and masked like the other credentials.
  • A third field in Settings → Payment provider, rendered only for a provider that declares one.
  • loadPaymentProviderCredentials returns publicKey when set.

What does not change

  • Stripe's fields, keys and behaviour.
  • Providers that do not declare a public key: their settings row is byte-for-byte the same, and a publicKey value is refused for them (so a typo cannot save a key nothing reads).
  • The secret key and webhook secret are still offered for every provider, as before.

Tests

  • provider-credentials-settings.test.ts: saves and loads the public key, validates its prefix, refuses one for a provider that does not declare it, never returns the value (only set/hint), and omits the row entirely for such a provider.
  • 12 tests in that file, 58 across the provider/credentials/webhook-header files, tsc --noEmit clean.
  • Changeset: minor for @dashcommerce/core.

Next

Item 3 is #100: the provider declares the field, returns on_page with { publicKey, txRef, amount, currency, customer… }, and ships a ./checkout-client that loads checkout.flutterwave.com/v3.js only when the customer presses Pay. The split seams are #101 (core) and #102 (Flutterwave). All are open.

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