Repository navigation
Conversation
admin/settings and admin/settings/validate check paymentProvider against the provider registry and answer 400 naming the registered providers, instead of saving an id that then fails at checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moset15
added a commit
to FIKANOVA/dashcommerce
that referenced
this pull request
Nov 26, 2026
…vider) into fork main [FIK-71] fix(core): reject an unregistered payment provider in settings (fork integration of upstream emdashCommerce#92)
Merged
cavewebs
added a commit
that referenced
this pull request
Nov 30, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @dashcommerce/core@0.5.0 ### Minor Changes - [#99](#99) [`6f81f05`](6f81f05) Thanks [@alexasomba](https://github.com/alexasomba)! - Let a payment provider save a browser public key. - `PaymentProviderCredentials.publicKey` and `credentialFields.publicKey`, saved as `settings:<id>PublicKey` and validated against the prefixes the provider declares. Providers that need it for on-page checkout (Flutterwave Inline) can hand it to their browser client; nothing else changes for providers that do not. - Settings shows the field only for a provider that declares it, beside the secret key and webhook secret. A provider that does not declare one cannot have a public key saved, and its settings row is unchanged. - `loadPaymentProviderCredentials` returns `publicKey` when one is set. - [#101](#101) [`422fc82`](422fc82) Thanks [@alexasomba](https://github.com/alexasomba)! - Let a payment provider split one payment across vendor payout accounts. - `capabilities.splits` and `InitCheckoutInput.allocations` / `platformRemainderMinor`. Core computes exact per-vendor minor amounts from trusted cart prices and the vendor's platform fee; a provider only routes them to the account reference core supplies. - `Vendor.paymentAccounts`, keyed by provider id, for providers other than Stripe: `accountReference`, `status`, and an optional settlement currency and label. Stripe Connect keeps its existing fields. - `Vendor.stripeAccountId` is optional. A vendor paid through another provider omits it, so a shop without Stripe can create more than one vendor; a missing field is NULL, so the unique index does not clash. - A cart-wide discount comes out of the platform remainder, matching the Connect plan; a discount larger than that remainder is refused with a readable 409 instead of silently reducing a vendor's payout. - `admin/vendors/item` accepts `POST` to create a vendor without Stripe, and `PATCH` with `paymentAccount` / `paymentAccounts` to add, replace or remove a provider account. Vendor routes open when Connect is on **or** a split-capable provider is registered. - Settings exposes each provider's `capabilities`. The Vendors page adds a vendor and edits payout accounts when a split-capable provider is active, without requiring Stripe. - A vendor cart is refused with a readable 409 when the active provider cannot split, or when a vendor has no active account for it, instead of silently charging the platform account. ### Patch Changes - [#91](#91) [`05f9d34`](05f9d34) Thanks [@moset15](https://github.com/moset15)! - Docs: an on-page checkout's `client` data is public. `create-session` sends it to the browser, so provider authors must never put a secret key or webhook secret in it. - [#93](#93) [`07f19e7`](07f19e7) Thanks [@moset15](https://github.com/moset15)! - The log line for a skipped duplicate webhook now reads "Webhook deduped" and names the provider, instead of "Stripe webhook deduped" for every provider. Its fields are now `providerId`, `eventId` (was `stripeEventId`) and `type`. - [#92](#92) [`016dc31`](016dc31) Thanks [@moset15](https://github.com/moset15)! - Settings refuse a `paymentProvider` that isn't registered on the server, with a 400 that names the registered providers. Before, a typo or a provider whose package wasn't imported saved fine and then failed at checkout. ## @dashcommerce/paystack@0.1.0 ### Minor Changes - [#85](#85) [`222a14b`](222a14b) Thanks [@moset15](https://github.com/moset15)! - New package: a Paystack payment provider for DashCommerce, built on core's PaymentProvider interface. - Card and M-Pesa payments through Paystack's hosted page, or its Popup over your checkout. Currencies: KES, NGN, GHS, ZAR and USD. - Orders are created only from a signed `charge.success`, confirmed against Paystack before the order is written. `Paystack-Signature` (with a `whsec_` secret, 300-second replay window) and `x-paystack-signature` (with the `sk_` key) are both verified. - Repeat and overlapping webhook deliveries run once: each `charge.success` and `refund.*` event carries an event id core can deduplicate on. - Refunds by transaction reference, guarded against duplicates on retry, with `refund.*` webhooks moving each refund to succeeded or failed. - "Test Paystack connection" in Settings checks the saved key in test or live mode. Needs `@dashcommerce/core` 0.4.0 or later. Register it with `import "@dashcommerce/paystack"` in a server module, add `api.paystack.co` to `allowedHosts`, and point Paystack's webhook at `…/checkout/webhook?provider=paystack`; see the package README. ## @dashcommerce/starter@0.3.13 ### Patch Changes - Updated dependencies [[`05f9d34`](05f9d34), [`07f19e7`](07f19e7), [`6f81f05`](6f81f05), [`422fc82`](422fc82), [`016dc31`](016dc31)]: - @dashcommerce/core@0.5.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up from your #81 review. Independent of #85 and of the other follow-ups; merge in any order.
Problem
The settings API checks only that
paymentProviderlooks like an id. A typo (paystak) or a provider whose package isn't imported on the server saves fine, then checkout fails.Change
admin/settingsandadmin/settings/validatecheck the value against the provider registry. An unregistered id gets a 400 undererrors.paymentProvider:The schema module still only checks the shape, so the admin bundle doesn't import the registry. Saves that don't include
paymentProviderare unaffected.Tested
Two route tests in
provider-credentials-settings.test.ts: the save refuses an unregistered id and stores nothing, a registered one still saves, and the single-field validator flags it too. Both fail without the change. Core: 317 pass.🤖 Generated with Claude Code