Fix plugin payout currency mismatch for non-USD developers#395
Merged
Conversation
Use the source charge's currency for Stripe transfers instead of the developer's payout currency. Stripe requires the transfer currency to match the source_transaction's charge currency; FX to the connected account is handled on the destination side. Previously every non-USD developer's payouts failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
Every plugin payout for a developer whose
payout_currencyis not USD was failing in production with:When a transfer is linked to a specific charge via
source_transaction, Stripe requires the transfer'scurrencyto match the source charge's currency. We were instead setting the transfer currency to the developer'spayout_currency(e.g. EUR), while the source charge was in the customer's payment currency (USD) — so the two never matched and the payout was markedfailed.This affected every non-USD developer, not just a one-off.
Fix
StripeConnectService::processTransfer()now uses the source charge's currency as the transfer currency. Stripe handles FX to the connected account's preferred payout currency on the destination side.getChargeIdFromPayout()→getChargeDetailsFromPayout(), returning both the charge id and currency from the PaymentIntent (no extra Stripe round-trip).payout_currencywhen no payment intent is linked to the license.currencyto the success log for easier future debugging.Tests
Added
tests/Feature/Services/StripeConnectServiceTest.php:usdwithsource_transactionset; payout marked transferred.payout_currencyand omitssource_transaction.Follow-ups (not in this PR)
status = failed; it needspayouts:retry-failed --payout-id=2(or a manual reset topending) once this deploys.ProcessPayoutTransferjob's$tries = 3is inert becauseprocessTransfer()swallows its own exceptions — the queue never sees a failure to retry.PluginPayouthas nofailure_reason/failed_at/attemptscolumns, so failures are only visible in logs.🤖 Generated with Claude Code