Skip to content

feat(flutterwave): in-admin payout onboarding and cart discounts - #104

Closed
alexasomba wants to merge 14 commits into
emdashCommerce:mainfrom
alexasomba:feat/flutterwave-payout-onboarding
Closed

alexasomba wants to merge 14 commits into
emdashCommerce:mainfrom
alexasomba:feat/flutterwave-payout-onboarding

Conversation

@alexasomba

Copy link
Copy Markdown

Part of the Flutterwave set described in #97. Item 7. Builds on #98, #102 and #103 (the core payout-onboarding seam). Review those first.

What

In-admin vendor payout onboarding. The package now implements the three optional provider methods from #103:

  • listPayoutBanks → GET /v3/banks/{country}; maps { code, name } and drops malformed rows.
  • resolvePayoutAccount → POST /v3/accounts/resolve with account_number + account_bank; returns the account holder's name.
  • createPayoutAccount → POST /v3/subaccounts with the documented fields (account_bank, account_number, business_name, business_email, business_mobile, country, split_type, split_value, optional contact fields and meta). Returns the RS_… id, resolved name, bank and masked last four.

The Vendors page now shows the whole flow: country → bank → account number → Verify account → business details → default split → Create payout account. The full account number is never stored. A manually created RS_… id can still be pasted.

Cart discounts. capabilities.coupons is now true. Flutterwave charges the discounted total core computes; no provider-side coupon object is needed. The previous false made core refuse any discounted cart.

Split defaults. The create-subaccount API accepts a default split_type of percentage or flat. The form exposes both. DashCommerce still overrides the default on every payment with flat_subaccount + the exact vendor amount, so the shares stay exact; the default is only the fallback for payments made outside DashCommerce.

API facts checked

  • GET /v3/banks/{country} → { code, name }.
  • POST /v3/accounts/resolve → { account_number, account_name }.
  • POST /v3/subaccounts requires account_bank, account_number, business_name, country, business_mobile, split_value (and business_email in practice); split_type is optional. Response includes subaccount_id, full_name, bank_name, account_bank, id.
  • Country-specific meta (SWIFT/routing/branch) is supported by the provider method but not collected by the form yet; the README says to add it via the API until the form covers those countries.

Live test-mode evidence (24 Nov 2026)

Check Result
listPayoutBanks("NG") 598 banks, e.g. { code: "560", name: "Page MFBank" }
resolvePayoutAccount("0690000033", "044") Bale Gary
createPayoutAccount(...) RS_043B…, name Bale Gary, ACCESS BANK NIGERIA, masked ••••0033
Probe cleanup DELETE /v3/subaccounts/27717 → Subaccount deleted

Tests

  • 97 package tests (was 90): banks, resolve, create + stored metadata, split validation, missing fields, missing subaccount id, and a discounted-amount checkout.
  • 352 core tests pass in this branch, including the feat(core): provider-managed payout account onboarding #103 onboarding routes.
  • Typecheck clean; Biome clean on the new files; changeset minor.

Still to do

  • Split reconciliation from meta.split_settlement_info (next item).
  • Country-specific meta in the form.
  • The real webhook delivery, which is still waiting on the dashboard pointing at the tunnel.

@alexasomba

Copy link
Copy Markdown
Author

Superseded by #107 — the Flutterwave package is now reviewed as one PR. The commits are preserved on the consolidated branch, and the core PRs (#99, #101, #103, #105) stay separate.

@alexasomba alexasomba closed this Nov 24, 2026
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