Skip to content

feat(core,paystack): vendor payout accounts where the provider can't look up names - #153

Open
moset15 wants to merge 1 commit into
emdashCommerce:mainfrom
FIKANOVA:feat/payout-verification-countries
Open

moset15 wants to merge 1 commit into
emdashCommerce:mainfrom
FIKANOVA:feat/payout-verification-countries

Conversation

@moset15

@moset15 moset15 commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

What and why

A shop in Kenya or South Africa can't set up a vendor's Paystack payout account from the Vendors page. The form makes "Verify account" compulsory for any provider with resolvePayoutAccount, but Paystack's /bank/resolve only works in Nigeria and Ghana. Elsewhere Verify always fails ("Could not resolve account name"), so Create never unlocks. Paystack's own dashboard creates these subaccounts without a look-up.

This lets a provider say where its look-up works. Everywhere else the form skips the Verify step and saves the account as unverified, as the form already does for a provider with no look-up at all.

Part of the roadmap in #108. Pairs with the Paystack splits PR (#152), but neither depends on the other.

Behaviour

  • New optional field on PaymentProvider: payoutVerificationCountries?: readonly string[] (ISO 3166-1 alpha-2). Omit it when the look-up works wherever the provider pays out; nothing changes for those providers.
  • Vendors page: in a country outside that list there is no Verify button. The info box keeps its title and reads "This provider cannot verify account names here. Check the number with the vendor; the account will be saved as unverified." Create is enabled once the required fields are filled.
  • Create route: in a country the look-up covers, it still refuses an account the provider returned without a name (502), as now. Outside it, the account is created with verified: false unless the provider says otherwise.
  • Settings API: each provider row gains payoutVerificationCountries (upper-cased, invalid entries dropped, null when the provider sets none or has no look-up).
  • Paystack declares ["NG", "GH"].

Changes

  • packages/core/src/payment-provider/types.ts: the new field, documented.
  • packages/core/src/routes/admin-api.ts: the settings row and the create route read it.
  • packages/core/src/admin/pages/VendorsPage.tsx: requiresVerification is country-aware; the info box asks the admin to check the number.
  • packages/core/README.md: one sentence on the field.
  • packages/paystack/src/provider.ts: payoutVerificationCountries: ["NG", "GH"].
  • Changeset: minor for @dashcommerce/core, patch for @dashcommerce/paystack.

Tests

  • packages/core/test/provider-payout-onboarding.test.ts: the settings row reports the countries (normalised) or null; an account in a country the look-up doesn't cover is created unverified (201); one in a covered country still needs the name (502).
  • packages/core/test/provider-credentials-settings.test.ts: the expected row includes the new field.
  • packages/paystack/test/paystack-provider.test.ts: Paystack declares Nigeria and Ghana.

6 of these fail without the change (upstream's src, tests kept). Suites run locally: core 442, paystack 124, flutterwave 137, all passing. tsc --noEmit and the build are clean; Biome reports nothing on the changed lines; bun.lock is unchanged.

Also tested by hand on a running shop (EmDash 1.6, Paystack test mode, store country Kenya). In Edit vendor, with Kenya and M-PESA chosen, the form showed no Verify button, only the info box above. Create made the Paystack subaccount (active, is_verified: false, M-PESA, KES), the vendor went from pending to active, and the stored account is marked unverified. No look-up was called. The same vendor's split payment had already settled to an unverified M-PESA subaccount in the splits hand test.

Review points

  • Why a country list on the provider, not a capability flag? The same provider can look up names in some countries and not others; the Vendors form already knows the country, so the list is the smallest thing that answers "ask for Verify here?".
  • Is saving unverified safe? It's the path the form already takes for providers without a look-up, and the warning now tells the admin to confirm the number with the vendor. Paystack itself creates Kenyan subaccounts unverified.
  • Not in this PR: a few small things in the same form, found while testing: the Business mobile placeholder shows +234… whatever the country; Business mobile is required even though Paystack doesn't need it; Save with nothing changed fails with a 400; a disabled Create doesn't say why. I'll propose those separately.

…look up names

A provider can now list the countries its account-name look-up covers
(`payoutVerificationCountries`). In any other country the Vendors page
shows no Verify step, warns the admin to check the number with the
vendor, and creates the payout account saved as unverified.

Paystack's /bank/resolve only works in Nigeria and Ghana, so Kenyan and
South African vendors could not be set up from the shop: Verify always
failed and Create never unlocked. Paystack now declares ["NG", "GH"].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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