Repository navigation
feat(core): split settlement and refunds - #105
Open
alexasomba wants to merge 8 commits into
Open
alexasomba wants to merge 8 commits into
alexasomba wants to merge 8 commits into
Conversation
This was referenced Nov 24, 2026
This was referenced Nov 24, 2026
moset15
reviewed
Nov 24, 2026
moset15
left a comment
Contributor
There was a problem hiding this comment.
Fits Paystack directly. charge.success for a split payment carries split.shares: subaccounts[].amount with subaccount_code → allocations, integration → platformRemainderMinor, paystack → providerFeeMinor. No change needed from the Paystack side.
createVendor stored stripeAccountId: "" and the field has a unique index, so the second vendor failed. The field is now optional and omitted when there is no Stripe account; a missing field is NULL. Also documents the coupon rule for split allocations (the platform absorbs a cart-wide discount; a larger one is a 409) and makes the allocation comments generic for Paystack.
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.
Part of the Flutterwave set described in #97. Items 8 and 9. Builds on #101. Generic core; no Flutterwave code. The split-refund guard from #112 is folded in; no review had started there.
Why
Flutterwave's verify response carries
meta.split_settlement_info, which says what each subaccount actually earned and the platform's commission. Core was discarding it, so a merchant could see the vendor split at checkout but not what the provider settled. This records the provider's own numbers on the order.What
NormalizedPaymentEventcharge.succeededgainssplitSettlement:allocations(accountReference,amountMinor),platformRemainderMinor,providerFeeMinor,currencyand the raw payload.Order.providerSplitsstores the same inMoney, with the account reference mapped to a vendor when core can resolve it fromVendor.paymentAccounts.What does not change
Tests
providerSplitswith both account references mapped tov1/v2, amounts in minor units, platform remainder and provider fee;providerSplits;splitRefunds: falseis refused before the call and writes no refund row;Split refunds (folded in from #112)
A split payment cannot always be refunded through the provider from DashCommerce. Flutterwave answers a split refund with
400 "Refund request successfully logged"and no refund id; Stripe Connect refunds work, but the money comes from the platform balance and vendor shares are not clawed back.PaymentProviderCapabilities.splitRefunds: optional. Missing means yes (existing Stripe behaviour).falsemeans the provider cannot refund a split charge.refundOrderrefuses before loading credentials or calling the provider whenorder.providerSplitsis present and the provider declaresfalse, with a message pointing to its dashboard.splitRefunds: falsein feat(flutterwave): Flutterwave payment provider package #107.Next
The Flutterwave package (#107) parses
meta.split_settlement_infoandapp_feeinto this event shape, so the real split we already tested is recorded on the order.