Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Added Stripe transfer reversals on refund (#15000)

Łukasz Adamczyke95a418bd843
diff --git a/docs/developer/core-concepts/commissions.mdx b/docs/developer/core-concepts/commissions.mdx
index 18e323b13d..1c19ba5cbf 100644
--- a/docs/developer/core-concepts/commissions.mdx
+++ b/docs/developer/core-concepts/commissions.mdx
@@ -317,7 +317,7 @@ Commission lines say what the marketplace charged. They don't move money, and th
That is the [payout ledger's](/developer/core-concepts/sellers#payouts) job: when an order is fulfilled, a seller transfer is written for the sale *less these lines*, and payouts settle those transfers on the seller's schedule — by the built-in provider, which keeps the books and leaves the operator to pay by bank, or by Stripe Connect, which performs the transfer. A commission line is an input to that ledger, never a row in it.
<Note>
-Refund clawbacks and netting across settlements, reconciliation and seller tax reporting are Spree Enterprise.
+Reconciliation against provider statements and seller tax reporting are Spree Enterprise.
</Note>
## Related
diff --git a/docs/developer/core-concepts/sellers.mdx b/docs/developer/core-concepts/sellers.mdx
index 7859cfe321..726e958197 100644
--- a/docs/developer/core-concepts/sellers.mdx
+++ b/docs/developer/core-concepts/sellers.mdx
@@ -347,6 +347,8 @@ A refund never edits an earning. `refund.created` writes a second row of kind `r
A reversal takes back only the seller's share of what was refunded. When a return or claim refunds goods and their tax, the goods come back less the commission charged on them; the tax comes back from the seller only if the seller collected it, and stays with the marketplace when the marketplace remits it.
+Whether money actually comes back is the provider's part. The built-in provider records the reversal and moves nothing; [Stripe Connect](/integrations/payments/stripe-connect) reverses the seller's share of the transfer that paid them. A reversal the provider refuses stays pending and is retried, after its earning when that has not been sent yet.
+
### Payouts — what was sent
On schedule, a seller's confirmed, unsettled earnings are batched into one `Spree::SellerPayout` per currency and handed to the provider. A payout names exactly which transfers it settled, which is what a seller needs to reconcile a deposit.
@@ -463,7 +465,7 @@ A connected provider confirms settlements through `POST /api/v3/webhooks/payouts
See [Stripe Connect for marketplaces](/integrations/payments/stripe-connect) for the shipped provider.
<Note>
-Refund clawbacks and netting across settlements, reconciliation, KYC operations and seller tax reporting (DAC7) are Spree Enterprise.
+Reconciliation against provider statements, KYC operations and seller tax reporting (DAC7) are Spree Enterprise.
</Note>
## The seller panel
diff --git a/docs/developer/how-to/build-a-marketplace.mdx b/docs/developer/how-to/build-a-marketplace.mdx
index 51e2c0f699..e86e8ba76b 100644
--- a/docs/developer/how-to/build-a-marketplace.mdx
+++ b/docs/developer/how-to/build-a-marketplace.mdx
@@ -639,7 +639,7 @@ A connected provider confirms settlements through `POST /api/v3/webhooks/payouts
**Read more:** [Payouts](/developer/core-concepts/sellers#payouts) for the ledger, [Stripe Connect for marketplaces](/integrations/payments/stripe-connect) for the shipped provider, [Seller payouts](/developer/providers/payouts) to write your own, and [Payouts settings](/user/settings/marketplace) for the operator's screen.
<Note>
-Refund clawbacks and netting across settlements, reconciliation, KYC operations and seller tax reporting (DAC7) are Spree Enterprise.
+Reconciliation against provider statements, KYC operations and seller tax reporting (DAC7) are Spree Enterprise.
</Note>
## Stand up the seller panel
diff --git a/docs/developer/providers/payouts.mdx b/docs/developer/providers/payouts.mdx
index ad40a57da6..4f492d4e74 100644
--- a/docs/developer/providers/payouts.mdx
+++ b/docs/developer/providers/payouts.mdx
@@ -15,7 +15,7 @@ Core calls a provider at exactly three moments. Each verb takes the ledger row i
|---|---|---|
| `transfer!(seller_transfer)` | An order is fulfilled and the seller is payable | Credit the seller's earning — or, if your rails only move money at settlement, mark the row `completed` and do nothing else |
| `pay!(seller_payout)` | A scheduled sweep or an operator settles a seller | Send the batch. Store the provider's own id in `reference`, and leave the status alone — a payout is completed when the money is confirmed to have landed, not when it was sent |
-| `reverse!(seller_transfer)` | A refund takes back part of an earning | Pull the money back if your rails can. Core writes the reversal row either way, so a provider that cannot claw back implements this as a no-op |
+| `reverse!(seller_transfer)` | A refund takes back part of an earning | Pull the money back if your rails can. Core writes the reversal row either way, so a provider that cannot claw back implements this as a no-op. Raise `GatewayError` to have it retried later, for example while its earning has not been sent |
Alongside the verbs, a provider tells core what it needs from sellers before it can pay them:
@@ -334,7 +334,7 @@ The Stripe provider's spec in the monorepo (`spree/providers/stripe/spec/models/
- `onboarded?` asks the API rather than reading the cached stamp
<Note>
-Refund clawbacks netted across settlements, reconciliation against provider statements, KYC operations and seller tax reporting (DAC7) are Spree Enterprise. Open source ships the ledger, the contract, and the two providers above.
+Reconciliation against provider statements, KYC operations and seller tax reporting (DAC7) are Spree Enterprise. Open source ships the ledger, the contract, and the two providers above.
</Note>
## Related
diff --git a/docs/integrations/payments/stripe-connect.mdx b/docs/integrations/payments/stripe-connect.mdx
index e4d9b809c0..d40875c3a2 100644
--- a/docs/integrations/payments/stripe-connect.mdx
+++ b/docs/integrations/payments/stripe-connect.mdx
@@ -81,7 +81,7 @@ export STRIPE_CONNECT_SIGNING_SECRET=whsec_...
**On the schedule**, a sweep batches the seller's confirmed earnings into a payout and asks Stripe — acting as the connected account — to pay the seller's bank. The payout stays **pending** in Spree with Stripe's `po_…` id as its reference until `payout.paid` arrives, which completes it and debits the seller's balance. `payout.failed` marks it failed and releases the earnings for the next sweep.
-**On a refund**, Spree writes a reversal row against the seller so the books are right. The Stripe transfer itself is not reversed in open source, and a negative balance is not netted against future earnings — that money operation is Spree Enterprise.
+**On a refund**, Spree writes a reversal row against the seller and reverses their share of the Stripe transfer that paid them, so the money returns to your account. A seller who has already been paid out is left with a negative Stripe balance, which their next earnings make up before anything more is paid out to them. If the earning has not reached Stripe yet, the reversal waits and is retried once it has.
Every Stripe call carries an idempotency key derived from the ledger row, so a retried request finds the movement it already made. When Stripe's answer is lost — a timeout, a 5xx — Spree parks the row as **unresolved** instead of retrying, because the key only protects a retry for as long as Stripe remembers it. Resolve those against the Stripe Dashboard: mark the payout complete with its reference if the money went, or fail it if it did not.
diff --git a/docs/plans/6.0-multi-vendor-marketplace.md b/docs/plans/6.0-multi-vendor-marketplace.md
index eebe64b019..be3a638da0 100644
--- a/docs/plans/6.0-multi-vendor-marketplace.md
+++ b/docs/plans/6.0-multi-vendor-marketplace.md
@@ -10,7 +10,7 @@
Open-source the core of Spree's multi-vendor marketplace into Spree 6.0, per [spree/spree#13323](https://github.com/spree/spree/issues/13323). Today multi-vendor lives in the paid Enterprise module as a **decorator-heavy monkey-patch** of core (dozens of prepended core classes, a parent order mutated into a line-item-less "splitted" state). 6.0 brings the **Seller identity, per-seller order splitting, the commission engine, and the payout ledger** into core as first-class models — built natively on the 6.0 Cart/Order split rather than retrofitted onto the legacy `Order`-only model.
-What stays paid (Enterprise — boundary amended 2026-07-15, see `decisions.md`): refund **clawbacks** (automatic Stripe transfer reversals + negative-balance netting), ledger⇄provider **reconciliation**, KYC/account-health operations, payout reports (incl. DAC7), marketplace-facilitator taxes, Shopify/WooCommerce sales-channel apps, the category mapper. **Basic Stripe Connect execution — Express onboarding + on-fulfillment transfers — ships open-source in the monorepo**, alongside the Stripe core gateway being pulled in from the standalone `spree_stripe` repo (the payment-sessions-API classes only; the legacy v2-API/storefront code stays behind — likely home: `spree/core`). **Core runs the happy path end-to-end (onboard, sell, get paid); Enterprise operates the unhappy paths and compliance at scale.**
+What stays paid (Enterprise — boundary amended 2026-07-15 and 2026-10-27, see `decisions.md`): ledger⇄provider **reconciliation**, KYC/account-health operations, payout reports (incl. DAC7), marketplace-facilitator taxes, Shopify/WooCommerce sales-channel apps, the category mapper. **Basic Stripe Connect execution — Express onboarding + on-fulfillment transfers — ships open-source in the monorepo**, alongside the Stripe core gateway being pulled in from the standalone `spree_stripe` repo (the payment-sessions-API classes only; the legacy v2-API/storefront code stays behind — likely home: `spree/core`). **Core runs the happy path end-to-end (onboard, sell, get paid); Enterprise operates the unhappy paths and compliance at scale.**
This plan covers the four subsystems: **(A) seller identity & teams**, **(B) order splitting**, **(C) the commission engine**, and **(D) the payout/fund-transfer ledger**. It is informed by a source-level port review of the current Enterprise multi-vendor module (private source — internals deliberately not cited here), the Enterprise behavior documented in the public user docs, and a survey of modern open-source marketplace implementations — see References (competitor names and the detailed comparison are likewise kept out of this public file).
@@ -21,7 +21,7 @@ This plan covers the four subsystems: **(A) seller identity & teams**, **(B) ord
| OSS core (this plan) | Enterprise (stays paid) |
|---|---|
| `Spree::Seller` identity + invitation **and self-serve application** onboarding state machine + seller teams (reusing `Role`/`RoleUser`/`Invitation`) | KYC/account-health **operations** (requirements monitoring, restricted-account workflows) |
-| Seller admin dashboard (composed from `@spree/dashboard-*`) + operator marketplace screens | Refund **clawbacks** — automatic Stripe transfer reversals + negative-balance netting |
+| Seller admin dashboard (composed from `@spree/dashboard-*`) + operator marketplace screens | ~~Refund clawbacks~~ — moved to OSS 2026-10-27: the Stripe provider reverses the transfer on refund |
| **Basic Stripe Connect payouts** (Express onboarding link + on-fulfillment transfers — ships with the monorepo Stripe gateway) | Ledger⇄Stripe **reconciliation** |
| Commission engine (seller- + product- + category-level rules, **commission taxation**) | Payout reports (incl. EU **DAC7** seller-income reporting) |
| Order splitting + payment split | Shopify white-label Sales Channel app |
@@ -30,7 +30,7 @@ This plan covers the four subsystems: **(A) seller identity & teams**, **(B) ord
| Sellers API endpoints (Admin + Store) + lifecycle webhooks/events + onboarding task registry (core tasks) | Enterprise onboarding **tasks** registered into the core checklist (Stripe KYC, Shopify/Woo store connection) |
| Merchandising + permissions (via code) | "Automatic taxes" (marketplace-facilitator remittance) |
-The boundary is **operational depth**: you can run a marketplace for free end-to-end — sellers onboard to Stripe Express through a hosted link and get paid automatically on fulfillment — and core records what each seller is owed (the payout ledger). The moment you need the money *operations* — automatic refund clawbacks, negative-balance netting, ledger⇄Stripe reconciliation, KYC workflows, regulatory reporting, tax remittance — that's Enterprise (Decision 9).
+The boundary is **operational depth**: you can run a marketplace for free end-to-end — sellers onboard to Stripe Express through a hosted link and get paid automatically on fulfillment — and core records what each seller is owed (the payout ledger). The moment you need the money *operations* — ledger⇄Stripe reconciliation, KYC workflows, regulatory reporting, tax remittance — that's Enterprise (Decision 9).
**The OSS payout story is execution-capable, not just record-keeping (amended 2026-07-15):** the monorepo's Stripe gateway ships a basic `PayoutProvider::StripeConnect` — Express onboarding + on-fulfillment transfers — so the free tier demos money movement end-to-end, at parity with the surveyed OSS competition. `PayoutProvider` stays a public interface, so community providers (PayPal Payouts, Wise, SEPA batch files) are first-class. Enterprise differentiates on the operations *around* the money, not on whether money moves.
@@ -161,9 +161,9 @@ Both levels are **generic in core + provider-executed**, mirroring `6.0-tax-prov
- **Core ships both ledger models** + a **`Spree::PayoutProvider::Base`** strategy with a **`system`** default: it records transfers (on-fulfillment) and payouts (on-interval) but moves no money — the OSS operator sees the per-seller balance and the itemized payout records, and settles offline (marking the payout complete). This is what #13323 means by core knowing "what's owed."
- **The monorepo ships the basic `Spree::PayoutProvider::StripeConnect`** (boundary amendment 2026-07-15), alongside the Stripe core gateway being pulled in from the standalone `spree_stripe` repo — only the payment-sessions-API gateway classes come over (likely into `spree/core`); the legacy v2-API/storefront code stays behind. The provider: Express-account creation + hosted onboarding link surfaced in the seller dashboard + `account.updated` webhook → payout-account status on the seller. `transfer!` executes an on-fulfillment `Stripe::Transfer` tied to the charge via `source_transaction` (gated on the account being payouts-enabled); `pay!` maps `payouts_schedule_interval` onto Stripe's native connected-account payout schedule and records `SellerPayout` rows from payout webhooks.
-- **Enterprise extends that provider with the money operations**: `reverse!` executing prorated Stripe transfer reversals on refund (ports the legacy reversal logic), negative-balance netting against future transfers, KYC/account-health workflows beyond the hosted flow, and ledger⇄Stripe reconciliation + payout reports. The paid tier operates the unhappy paths.
+- **Enterprise extends that provider with the money operations**: KYC/account-health workflows beyond the hosted flow, and ledger⇄Stripe reconciliation + payout reports. The paid tier operates the unhappy paths.
-**OSS funds flow — two modes.** (a) **`system`** (no gateway objects): the customer's single charge settles in full to the operator's own gateway account as a plain payment; the split is pure bookkeeping (`PaymentSplit` + this ledger); disbursement happens outside the gateway — on the payout schedule the operator pays each seller by bank (SEPA/ACH/wire), guided by the itemized `SellerPayout`, and marks it complete, or automates it (`seller_payout.due` webhook → banking API → `POST /seller_payouts/:id/complete`). The platform is merchant of record for the full transaction and carries seller payables on its own books. (b) **`stripe_connect` basic** (the monorepo Stripe gateway): sellers onboard as Express accounts through Stripe's hosted link; on fulfillment the provider executes a real transfer — money moves automatically. What OSS mode (b) does **not** do is pull money back: a refund always writes the ledger reversal (the books stay correct in every tier), but the Stripe transfer reversal, netting against future transfers, and reconciliation are Enterprise — the first production refund is where the upgrade conversation starts. Note the hard coupling that shapes this seam: a `Stripe::Transfer` requires a connected account, so basic Connect onboarding necessarily ships together with OSS transfer execution; what Enterprise keeps is not onboarding itself but the KYC *operations* around it.
+**OSS funds flow — two modes.** (a) **`system`** (no gateway objects): the customer's single charge settles in full to the operator's own gateway account as a plain payment; the split is pure bookkeeping (`PaymentSplit` + this ledger); disbursement happens outside the gateway — on the payout schedule the operator pays each seller by bank (SEPA/ACH/wire), guided by the itemized `SellerPayout`, and marks it complete, or automates it (`seller_payout.due` webhook → banking API → `POST /seller_payouts/:id/complete`). The platform is merchant of record for the full transaction and carries seller payables on its own books. (b) **`stripe_connect` basic** (the monorepo Stripe gateway): sellers onboard as Express accounts through Stripe's hosted link; on fulfillment the provider executes a real transfer — money moves automatically. A refund writes the ledger reversal in every tier, and since 2026-10-27 OSS mode (b) also reverses the seller's share of the Stripe transfer; a seller already paid out carries a negative Stripe balance that their next earnings make up. Reconciliation stays Enterprise. Note the hard coupling that shapes this seam: a `Stripe::Transfer` requires a connected account, so basic Connect onboarding necessarily ships together with OSS transfer execution; what Enterprise keeps is not onboarding itself but the KYC *operations* around it.
**Transfer amount basis** (ports the legacy allowed-transfer-amount rule, generalized per the resolved store-credit decision): the seller's sale value minus commission, **payment-source-agnostic** (store credit / gift card is the platform's funding concern, not the seller's):
@@ -177,7 +177,7 @@ transfer.amount = seller_order.total − seller_order.commission_lines.sum(:tota
**Scheduling (RESOLVED 2026-09-09).** `SellerPayouts::SweepDueJob` is what turns the intervals below into payouts, and it is **scheduled by the host app** — core ships no cron. Until 6.0 nothing scheduled it and no payout was ever created, for any seller on any interval; `docs/developer/deployment/background_jobs.mdx` now carries the daily entry a marketplace must add. A seller on `manual` is skipped there by design and settled from the operator's Sellers screen, which sweeps them by hand (`POST /admin/sellers/:id/payouts`).
-**Triggers (RESOLVED):** `seller_transfer.due` fires **on-fulfillment** (all the seller order's fulfillments fulfilled); `seller_payout.due` fires **on the seller's `payouts_schedule_interval`** (daily/weekly/biweekly/monthly/manual, `nil` ⇒ store default — the "Use marketplace default interval" semantics in today's Enterprise settings, carried over). **Core implements all of them** — `SweepSellerJob` resolves each seller's interval and decides who is due, and `manual` means the operator settles by hand from the Sellers screen. **Corrected 2026-09-09**: this line previously gave the scheduled intervals to Enterprise, which was never true of the shipped code; what Enterprise adds is the money operations around a payout (clawbacks, netting, reconciliation), not deciding when one is due.
+**Triggers (RESOLVED):** `seller_transfer.due` fires **on-fulfillment** (all the seller order's fulfillments fulfilled); `seller_payout.due` fires **on the seller's `payouts_schedule_interval`** (daily/weekly/biweekly/monthly/manual, `nil` ⇒ store default — the "Use marketplace default interval" semantics in today's Enterprise settings, carried over). **Core implements all of them** — `SweepSellerJob` resolves each seller's interval and decides who is due, and `manual` means the operator settles by hand from the Sellers screen. **Corrected 2026-09-09**: this line previously gave the scheduled intervals to Enterprise, which was never true of the shipped code; what Enterprise adds is the money operations around a payout (reconciliation), not deciding when one is due.
**Naming & scope (RESOLVED 2026-06-25):** the models keep the `Seller` prefix and `belongs_to :seller` — they are deliberately *not* generalized to bare `Transfer`/`Payout`. Rationale: (1) "transfer" and "payout" are heavily overloaded payment terms (gateway ACH/wire transfers, Stripe payout objects) — the `Seller` prefix is what keeps these ledger records unambiguous and avoids re-introducing the very namespace confusion that made the legacy gateway-namespaced transfer model unclear; (2) the reusability that a dealership / B2B revenue-share scenario would want comes from an **abstract payee** (`belongs_to :payee, polymorphic`), *not* from a generic model name — and we have no second consumer yet, so per YAGNI we bind to `Seller` now. If a concrete non-seller payee requirement lands later, the migration path is to make `payee` polymorphic (Seller + e.g. CompanyLocation) — a localized schema change — rather than a rename. This mirrors `OrderGroup`'s seller-agnostic structure, but the inverse conclusion is correct here: the container is generic because the seller lives on its children, whereas these ledger rows are *intrinsically* a payment to one specific payee.
@@ -755,7 +755,7 @@ This is **new OSS code**, not a rename of existing core — there is no in-place
- Migrate the legacy per-item commission rows → `spree_commission_lines`. **Sign convention flips**: the legacy module stores order-level fee totals negative (load-bearing in its payout math); `CommissionLine` amounts are positive, reversals are their own negative/`reversed` rows.
- Decrypt the legacy encrypted seller contact columns (ActiveRecord encryption — a multi-tenant SaaS choice) into core's plain columns.
- Migrate the legacy Stripe transfer ledger → `spree_seller_transfers` (the per-order, on-fulfillment level) with `provider: 'stripe_connect'` and the Stripe transfer id in `reference`. The legacy module has no payout *records* (it delegated scheduling to Stripe), so there is nothing to backfill into `spree_seller_payouts` — historical Stripe payouts can optionally be reconstructed from Stripe's API, or simply start fresh from the cutover.
- The Enterprise module then becomes a thin layer on top of core's new models, deleting its splitting + commission + transfer decorators. The basic `Spree::PayoutProvider::StripeConnect` ships in the monorepo with the pulled-in Stripe gateway (2026-07-15 amendment); Enterprise extends it (clawbacks, netting, KYC ops, reconciliation) and keeps Shopify/WooCommerce.
+ The Enterprise module then becomes a thin layer on top of core's new models, deleting its splitting + commission + transfer decorators. The basic `Spree::PayoutProvider::StripeConnect` ships in the monorepo with the pulled-in Stripe gateway (2026-07-15 amendment); Enterprise extends it (KYC ops, reconciliation) and keeps Shopify/WooCommerce.
2. **Build order** (each phase shippable):
- **Phase 0 — admin-branch hardening (ships first, no Seller model needed). IMPLEMENTED 2026-08-16.** Tighten `AdminAuthentication#current_user_member_of_store?` to `resource_type: 'Spree::Store'` + regression spec; `spree_refresh_tokens.audience` written at mint and enforced on refresh (admin + store surfaces stamp their own); `Role#audience` + the audience marker on `register_scope` (Decision 10 / RBAC plan). **Shipped as:** `audience` on refresh tokens (nullable; `for_audience` scope narrowing every refresh **and** logout lookup on both surfaces — ending a session belongs to the surface that started it; legacy NULL-audience rows match no surface and are rejected on refresh, costing their holders one login) and on roles (`null: false`, backfilled `staff`, immutable after create, `Spree::Role::AUDIENCES` the vocabulary); the catalog takes `audiences:` naming **every** audience a scope is grantable to — the store's own back office is `:store`, and the default when none is named, so a scope shared with sellers says `%i[store seller]` and one for sellers alone says `%i[seller]`, with `grantable_keys(audience)` (unknown audience ⇒ empty, never raises) — a generalization of the originally-planned `seller_grantable` boolean, so a third panel needs no schema change (decisions.md 2026-08-16); `orders`/`fulfillments`/`products`/`stock`/`dashboard` opened to `seller`. **Roles became store-owned** (`spree_roles.store_id`, `null: false`, via `SingleStoreResource`): they were global reference data, so two stores could never each define a "Manager" and the marketplace would have inherited that. Names are unique per `(store, name, audience)` — `Spree::UniqueName`'s global uniqueness is deliberately not used on Role — so one store holds a staff "Manager" beside a seller "Manager", and another store holds its own. `admin` is now one immutable role **per store** (`default_admin_role(store)`; `Seeds::Roles` moved after `Seeds::Stores`, since a role cannot exist before its store). The upgrade fans every existing role out per store and re-points assignments and invitations at the copy for the store they already named, so no grant changes hands. The audience bound is enforced **twice**: `Spree::Role` validates it on write, and `Spree::Ability` re-filters through `grantable_keys(role.audience)` at activation, since a catalog that changes after the role was saved would otherwise leave stale keys live. The staff surface is closed to foreign-audience roles at both ends — `Admin::RolesController#scope` lists only `Spree::Role.staff`, and `RoleGrantGuard` rejects assigning a non-staff role to store staff (invitations + admin_users). `Spree::Ability` takes `resource:` (defaults to the store) and reads `role_users` on it — the `admin` super-role and the implicit-admin fallback apply **only** on a store resource, and the staff baseline narrows `read Spree::Store` to the one store a non-store panel operates under. **The ability answers capability, never tenancy:** a seller holding `write_orders` gets `can :manage, Spree::Order` on the model class exactly as an admin does; which records it may touch is `current_seller` scope-fetching in the controller, so a seller-branch controller that authorizes without scope-fetching reads store-wide.
- **Phase 1 — Seller identity.** `Spree::Seller` model (see Seller identity & teams: lifecycle, branding, ToS acceptance, holiday mode), onboarding task registry + core tasks, seller teams via `RoleUser`/`Invitation` (`resource: seller`) + `UserRoles#sellers`, self-serve application endpoint, core `Spree::SellerMailer` lifecycle emails (see Seller notifications), product ownership (`products.seller_id` + approval preference), Admin API Marketplace/sellers endpoints + Store API seller profiles, seller CSV import/export on the `Spree::Import` pipeline. **Phase 1b — the shared catalog (Decision 11). IMPLEMENTED 2026-08-16:** `variants.seller_id` + `variants.delivery_profile_id`, condition as an OptionType, the ownership filter on `Product#variants=`, first-party `default_variant` priority, the same-variant fix to option filtering, and the buy-box selection service the product rollups then answer through — see the Resolved Decisions entry for what shipped. Sequenced here rather than later because the split's partition key (Phase 3) and the commission line's identity (Phase 2) both read the seller off a line item, and on a shared product only the variant can answer. **The Seller API branch anchor** (`Seller::BaseController`/`ResourceController`, `seller_api` audience, `Spree.seller_authentication_strategies`, `/seller/auth/*`, `/seller/me`, `/seller/profile`, onboarding, team, seller-scope guard, `Spree::Ability` `resource:` option) + the seeded default seller role. Products/orders/fulfillments on the seller branch follow as each domain lands (products in Phase 1, orders/fulfillments/ledger reads in Phase 3). No splitting yet.
@@ -824,7 +824,7 @@ Even before this lands, work touching adjacent areas should:
- **Payout minimum threshold → core; rolling reserve / holdback → Enterprise** (RESOLVED 2026-08-15). `spree_sellers.minimum_payout_amount` (decimal, nullable; nil ⇒ store preference `default_minimum_payout_amount`) — the sweep skips a seller whose `balance(currency)` is below the threshold and carries the balance to the next period. A percentage holdback with a release window is money-operations policy (chargeback buffer) and stays Enterprise, so core does not grow a third ledger row kind.
- **Marketplace-facilitator remittance → `spree_sellers.tax_remittance` (`seller` | `platform`, default `seller`), honored by core's transfer basis** (RESOLVED 2026-08-15). `platform` ⇒ `transfer.amount = total − tax_total − commission`; `seller` keeps `total − commission`. Core owns the ledger math so it is provider-independent; *deciding* when a seller is `platform`-remitted (US facilitator nexus, EU deemed-supplier scenarios) stays Enterprise "automatic taxes", which simply sets the column. Amends the Decision 9 note that this mode is "not core": the flag and the math are core, the policy is not.
- **Seller-scoped promotions → post-6.0** (RESOLVED 2026-08-15 as deferred; shape recorded under Open Questions).
-- **Basic Stripe Connect execution → OSS (boundary amendment)** (RESOLVED 2026-07-15). Express onboarding + on-fulfillment transfers ship in the monorepo alongside the pulled-in Stripe gateway, for demo/adoption parity with the surveyed competitor — "money moves automatically" is the demo that sells, and transfers are inseparable from basic onboarding (a `Stripe::Transfer` needs a connected account). Enterprise repositions on money **operations**: automatic refund clawbacks (prorated transfer reversals + negative-balance netting), KYC/account-health workflows, ledger⇄Stripe reconciliation, payout reports incl. DAC7, facilitator taxes. Ledger reversal rows stay OSS in every mode — only the pullback execution is paid. Supersedes #13323's "execution stays Enterprise" framing (amendment by the issue author; update the issue). See `decisions.md` 2026-07-15.
+- **Basic Stripe Connect execution → OSS (boundary amendment)** (RESOLVED 2026-07-15). Express onboarding + on-fulfillment transfers ship in the monorepo alongside the pulled-in Stripe gateway, for demo/adoption parity with the surveyed competitor — "money moves automatically" is the demo that sells, and transfers are inseparable from basic onboarding (a `Stripe::Transfer` needs a connected account). Enterprise repositions on money **operations**: ~~automatic refund clawbacks (prorated transfer reversals + negative-balance netting)~~, KYC/account-health workflows, ledger⇄Stripe reconciliation, payout reports incl. DAC7, facilitator taxes. Ledger reversal rows stay OSS in every mode. **Amended 2026-10-27**: the Stripe transfer reversal moved to OSS too (`decisions.md`). Supersedes #13323's "execution stays Enterprise" framing (amendment by the issue author; update the issue). See `decisions.md` 2026-07-15.
- **`Spree::Seller` name ownership → marketplace seller; inventory-operations' procurement model renamed `Spree::Supplier`** (RESOLVED 2026-07-14). See the Key Decisions entry and `decisions.md` 2026-07-14.
- **Commission is not a `Spree::Fee`** (RESOLVED 2026-07-14). `Fee` is buyer-facing and rolls into order totals; `CommissionLine` is an off-order platform↔seller ledger. See Decision 2.
- **Rule reference storage → arrays for sellers and categories, a table for products** (RESOLVED 2026-08-17). Follows the cardinality rule from `6.0-delivery-method-rules.md`, with one deliberate exception: `Promotion::Rules::Category` keeps its categories in a join table, and commission keeps them in a `category_ids` preference. The reason is what the array actually holds — matching walks *upward from the product* through `self_and_ancestors`, so a rule names only the categories an operator picked, never their descendants. A rate on "Electronics" is one id however deep the tree goes, and in practice nobody enumerates hundreds of categories or sellers into a single rule. Products stay in `spree_commission_rule_products` because a marketplace genuinely does name thousands.
diff --git a/docs/plans/decisions.md b/docs/plans/decisions.md
index 2fa86c1d65..fed0466685 100644
--- a/docs/plans/decisions.md
+++ b/docs/plans/decisions.md
@@ -1,3 +1,13 @@
+## 2026-10-27: Stripe transfer reversals on refund move to open source
+
+**Context:** A refund on a seller's order wrote the reversal row, and the next payout to the seller's bank subtracted it, but the open-source Stripe provider never reversed the transfer. The seller's share stayed on their connected account while the marketplace had refunded the customer from its own balance, and nothing in the books said where that money now was. The 2026-07-15 decision kept the pullback in Enterprise.
+
+**Decision:** `SpreeStripe::PayoutProvider#reverse!` reverses the seller's share of the earning's Stripe transfer (`Stripe::Transfer.create_reversal`, keyed on the reversal row). A reversal whose earning has not reached Stripe yet stays pending; one whose earning nobody can account for waits for a person. `SellerTransfers::ExecutePendingJob` now retries owed reversals after the seller's earnings, through the provider that made the earning, and `ExecutePendingDueJob` picks up any seller holding one, including suspended sellers and those who can no longer be paid. A seller already paid out is left with a negative Stripe balance, which their next earnings make up before the sweep can pay them again.
+
+**Consequences:** Supersedes the clawback part of 2026-07-15. Enterprise keeps reconciliation against provider statements, KYC operations, payout reports including DAC7, and marketplace-facilitator taxes.
+
+**Plans amended:** `6.0-multi-vendor-marketplace.md` (summary, scope table, payout provider section, funds flow).
+
## 2026-10-26: A warehouse that cannot deliver gives up the units another can supply, and holds follow the allocation
**Context:** A profile with per-region origin groups still allocated a cart to a warehouse with no method for the address whenever the warehouse that could deliver held the item only as backorderable (V-3596). Putting the capable warehouse first had no effect, because the Adjuster takes stock on hand anywhere over a backorder; the cart then reported the item as undeliverable. Reproducing it showed four more gaps on the same path. Orders allocated through `OrderRouting::Strategy::Rules`, which skipped the delivery profile and channel coverage that carts apply. A cart whose rebuild dropped an undeliverable proposal could still complete, placing an order with part of a line in no fulfillment. The checkout hold locked the first warehouse with stock, which could be one that cannot ship the order, and refused a cart another warehouse could have backordered. And allocation packed one line per variant, so a second line of the same variant (possible with a custom line finder) was allocated nowhere.
diff --git a/docs/user/sellers/payouts.mdx b/docs/user/sellers/payouts.mdx
index db63854835..049bae0bf6 100644
--- a/docs/user/sellers/payouts.mdx
+++ b/docs/user/sellers/payouts.mdx
@@ -52,6 +52,8 @@ A seller can have their own schedule and minimum, set on their page under **Payo
<Tab title="Stripe Connect">
Each seller connects a Stripe account — the **payout account** onboarding requirement asks them to, and the seller panel walks them through it. You charge the customer on your own Stripe account; as each seller's goods ship, their share is transferred to their connected account, tied to the charge that funds it so it moves as soon as that charge settles rather than out of your balance.
+ When a refund is issued after the seller was paid, the seller's share is taken back from their Stripe account automatically.
+
From there, Stripe pays the seller's bank on the schedule set for their account. Spree records what Stripe is going to do, and a webhook confirms when it did — which is when the payout turns **Completed**.
Requires an active Stripe payment method under Settings → Payments. Setup is on the [Stripe Connect](/integrations/payments/stripe-connect) page.
@@ -59,7 +61,7 @@ A seller can have their own schedule and minimum, set on their page under **Payo
</Tabs>
<Note>
-Refund clawbacks and netting across payouts, reconciliation, and seller tax reports are part of Spree Enterprise.
+Reconciliation against Stripe statements and seller tax reports are part of Spree Enterprise.
</Note>
## Related
diff --git a/spree/core/app/jobs/spree/seller_transfers/execute_pending_due_job.rb b/spree/core/app/jobs/spree/seller_transfers/execute_pending_due_job.rb
index cf6ba0449d..07922c83d3 100644
--- a/spree/core/app/jobs/spree/seller_transfers/execute_pending_due_job.rb
+++ b/spree/core/app/jobs/spree/seller_transfers/execute_pending_due_job.rb
@@ -1,6 +1,7 @@
module Spree
module SellerTransfers
- # Hands every seller holding an unconfirmed earning to a job of their own.
+ # Hands every seller holding an unconfirmed earning or reversal to a job of
+ # their own.
#
# The transfer level's counterpart to {Spree::SellerPayouts::SweepDueJob},
# and deliberately a separate schedule rather than something the settlement
@@ -39,17 +40,18 @@ module Spree
# @param store [Spree::Store]
# @return [ActiveRecord::Relation<Spree::Seller>]
def sellers_awaiting_provider(store)
- scope = store.sellers.approved.
- where(id: Spree::SellerTransfer.for_store(store).awaiting_provider.select(:seller_id))
+ transfers = Spree::SellerTransfer.for_store(store)
+ sending = store.sellers.approved.where(id: transfers.awaiting_provider.select(:seller_id))
# A seller the provider will not accept yet keeps their earnings
# unconfirmed, and the job would return at once. Skipped rather than
# enqueued, because a marketplace's half-onboarded sellers are a
# standing population and this runs often — and nothing is lost by it:
# finishing onboarding runs the job for them directly.
- return scope unless store.payout_provider_class.requires_payout_account?
+ sending = sending.where.not(payouts_enabled_at: nil) if store.payout_provider_class.requires_payout_account?
- scope.where.not(payouts_enabled_at: nil)
+ # Money owed back is pursued whatever the seller's standing.
+ sending.or(store.sellers.where(id: transfers.reversals_awaiting_provider.select(:seller_id)))
end
end
end
diff --git a/spree/core/app/jobs/spree/seller_transfers/execute_pending_job.rb b/spree/core/app/jobs/spree/seller_transfers/execute_pending_job.rb
index e0592fa403..70da4c2b7a 100644
--- a/spree/core/app/jobs/spree/seller_transfers/execute_pending_job.rb
+++ b/spree/core/app/jobs/spree/seller_transfers/execute_pending_job.rb
@@ -14,6 +14,9 @@ module Spree
# seller who was payable all along would never see a refused earning tried
# again, since nothing about them ever changes to prompt it.
#
+ # Reversals are retried the same way: a provider that pulls money back can
+ # refuse too, and one cannot be pulled back before its earning was sent.
+ #
# It takes the retryable rows — never sent, or refused outright. A transfer
# whose outcome the provider could not report is left alone: asking again
# is precisely how the same money moves twice, and only a person can say
@@ -24,30 +27,47 @@ module Spree
# @param seller_id [Integer]
def perform(seller_id)
seller = Spree::Seller.find_by(id: seller_id)
- return if seller.nil? || !seller.payouts_enabled?
+ return if seller.nil?
Spree::Current.store = seller.store
+ send_earnings(seller) if seller.payouts_enabled?
+
+ # Never through `transfer!`: a reversal's amount is negative, and the
+ # amount sent is its absolute value, so it would pay the seller the
+ # money it exists to take back. Through the provider that made the
+ # earning, which is not necessarily the store's current one. And for
+ # every seller, payable or not — a seller suspended after a wave of
+ # refunds is exactly the one whose money must come back.
+ seller.seller_transfers.reversals_awaiting_provider.includes(:reversed_from, :order).find_each do |reversal|
+ execute(reversal) { reversal.payout_provider_instance.reverse!(reversal) }
+ end
+ end
+
+ private
+
+ # Before the reversals, so a reversal waiting on its earning finds it sent.
+ def send_earnings(seller)
provider = seller.store.payout_provider_instance
- # Earnings only — see the scope. A reversal is retryable the same way
- # when its own provider call is refused, but sending one through
- # `transfer!` would pay the seller the amount it exists to take back:
- # the row is negative and the amount sent is its absolute value.
seller.seller_transfers.awaiting_provider.find_each do |transfer|
- provider.transfer!(transfer)
- rescue Spree::Core::AmbiguousGatewayError => e
- # The money may already have moved, so this row must not be offered
- # again: left retryable, the next run would send it a second time,
- # and an idempotency key stops that only while the provider still
- # holds its record.
- transfer.update!(status: 'unresolved')
- Rails.error.report(e, handled: true, context: { seller_transfer_id: transfer.id }, source: 'spree.core')
- rescue StandardError => e
- # A refusal — the money did not move. One seller's stuck earning must
- # not stop the rest, and the row stays retryable for the next run.
- Rails.error.report(e, handled: true, context: { seller_transfer_id: transfer.id }, source: 'spree.core')
+ execute(transfer) { provider.transfer!(transfer) }
end
end
+
+ def execute(transfer)
+ yield
+ rescue Spree::Core::AmbiguousGatewayError => e
+ # The money may already have moved, so this row must not be offered
+ # again: left retryable, the next run would move it a second time,
+ # and an idempotency key stops that only while the provider still
+ # holds its record.
+ transfer.update!(status: 'unresolved')
+ Rails.error.report(e, handled: true, context: { seller_transfer_id: transfer.id }, source: 'spree.core')
+ rescue StandardError => e
+ # A refusal — the money did not move. One stuck row must not stop the
+ # rest, and it stays retryable for the next run.
+ Rails.error.report(e, handled: true, context: { seller_transfer_id: transfer.id }, source: 'spree.core')
+ end
end
end
end
diff --git a/spree/core/app/models/spree/seller_transfer.rb b/spree/core/app/models/spree/seller_transfer.rb
index e510c5ba6f..dcfe50b7e8 100644
--- a/spree/core/app/models/spree/seller_transfer.rb
+++ b/spree/core/app/models/spree/seller_transfer.rb
@@ -89,6 +89,16 @@ module Spree
# amount is negative, and sending one as a transfer pays the seller the
# money it exists to take back.
scope :awaiting_provider, -> { earnings.retryable.where(payout_id: nil) }
+ # Reversals still owing the provider a call: refused, or waiting for their
+ # earning to reach the provider first. Kept apart from `awaiting_provider`
+ # so a caller has to choose `reverse!` for these by name.
+ #
+ # A reversal of an earning nobody can account for waits with it: there is
+ # nothing to take back from until a person settles what happened.
+ scope :reversals_awaiting_provider, lambda {
+ reversals_only.retryable.where(payout_id: nil).
+ where.not(reversed_from_id: Spree::SellerTransfer.with_status('unresolved').select(:id))
+ }
# Earned and confirmed, but not yet swept into a settlement — what the next
# payout will pick up.
scope :unsettled, -> { completed.where(payout_id: nil) }
@@ -138,6 +148,47 @@ module Spree
[amount - reversals.sum(:amount).abs, 0].max
end
+ # The provider that moved this row's money, not whichever one the store
+ # uses now. A marketplace that changes provider still has money sitting
+ # with the old one, and asking the new one to reverse a transfer it never
+ # made leaves the original standing.
+ #
+ # No silent fallback when that provider is no longer installed: handing
+ # the row to a different one would mark it done while the money stayed
+ # where it was. An operator has to know.
+ #
+ # @return [Spree::PayoutProvider::Base]
+ # @raise [Spree::Core::GatewayError] when the provider is not registered
+ def payout_provider_instance
+ configured = Spree::ApiTyped.registered_class(Spree.payout_providers, provider)
+ raise Spree::Core::GatewayError, "Payout provider #{provider} is not registered" if configured.nil?
+
+ configured.new
+ end
+
+ # The settlement a reversal of part of this earning records.
+ #
+ # A clawback has to settle where its earning settled. Payouts are swept by
+ # settlement currency, so a reversal left in the sale's currency would
+ # never join the batch that pays the earning it cancels — the seller would
+ # be paid in full for goods that came back.
+ #
+ # Prorated from this earning's settled figure rather than converted at
+ # today's rate, so the money comes back at the rate it went out at.
+ #
+ # @param part [BigDecimal] how much of this earning is reversed, positive
+ # @return [Hash] negative `settled_amount` and `settled_currency`
+ def reversal_settlement(part)
+ return {} if settled_amount.blank? || amount.zero?
+
+ share = settled_amount * (part / amount)
+
+ {
+ settled_amount: -Spree::Money::Rounding.quantize(share, Spree::Money::Rounding.precision(settlement_currency)),
+ settled_currency: settled_currency
+ }
+ end
+
# @return [Boolean]
def earning?
kind == 'earning'
diff --git a/spree/core/app/workflows/spree/seller_transfers/reverse.rb b/spree/core/app/workflows/spree/seller_transfers/reverse.rb
index d651321507..1202465b1f 100644
--- a/spree/core/app/workflows/spree/seller_transfers/reverse.rb
+++ b/spree/core/app/workflows/spree/seller_transfers/reverse.rb
@@ -202,34 +202,15 @@ module Spree
kind: 'refund_reversal',
provider: @earning.provider,
status: 'pending'
- }.merge(settlement_of(bounded))
+ }.merge(@earning.reversal_settlement(bounded))
)
end
end
- # A clawback has to settle where its earning settled. Payouts are swept by
- # settlement currency, so a reversal left in the sale's currency would
- # never join the batch that pays the earning it cancels — the seller would
- # be paid in full for goods that came back, and the row would sit in a
- # currency their account cannot pay.
- #
- # Prorated from the earning's own settled figure rather than converted at
- # today's rate, so the money comes back at the rate it went out at.
- def settlement_of(bounded)
- return {} if @earning.settled_amount.blank? || @earning.amount.zero?
-
- share = @earning.settled_amount * (bounded / @earning.amount)
-
- {
- settled_amount: -Spree::Money::Rounding.quantize(
- share, Spree::Money::Rounding.precision(@earning.settlement_currency)
- ),
- settled_currency: @earning.settled_currency
- }
- end
-
+ # Asked of the provider that made the earning — see
+ # {Spree::SellerTransfer#payout_provider_instance}.
def execute_reversal
- provider.reverse!(reversal)
+ @earning.payout_provider_instance.reverse!(reversal)
rescue Spree::Core::AmbiguousGatewayError => e
# Whether the clawback happened is the provider's to say. Recorded as
# such rather than as a refusal, so an operator reconciling knows which
@@ -238,31 +219,11 @@ module Spree
Rails.error.report(e, handled: true, context: { seller_transfer_id: reversal.id }, source: 'spree.core')
failure(reversal, e.message)
rescue StandardError => e
+ # Left retryable: `ExecutePendingJob` asks the provider again.
reversal.update!(status: 'processing')
Rails.error.report(e, handled: true, context: { seller_transfer_id: reversal.id }, source: 'spree.core')
failure(reversal, e.message)
end
-
- # The provider that made the earning, not whichever one the store uses
- # now. A marketplace that changes provider still has money sitting with
- # the old one, and asking the new one to reverse a transfer it never
- # made leaves the original standing — the seller keeps a refunded sale.
- def provider
- @provider ||= begin
- configured = Spree.payout_providers.find { |candidate| candidate.to_s == @earning.provider }
-
- # No silent fallback to whatever the store uses now. A provider that
- # is no longer installed still holds the transfer this reverses, and
- # handing the job to a different one would mark the row reversed
- # while the money stayed where it was. An operator has to know.
- if configured.nil?
- raise Spree::Core::GatewayError,
- "Payout provider #{@earning.provider} is not registered, so its transfer cannot be reversed"
- end
-
- configured.new
- end
- end
end
end
end
diff --git a/spree/core/spec/jobs/spree/seller_transfers/execute_pending_due_job_spec.rb b/spree/core/spec/jobs/spree/seller_transfers/execute_pending_due_job_spec.rb
index 0e55afff00..5efeebca79 100644
--- a/spree/core/spec/jobs/spree/seller_transfers/execute_pending_due_job_spec.rb
+++ b/spree/core/spec/jobs/spree/seller_transfers/execute_pending_due_job_spec.rb
@@ -57,6 +57,38 @@ RSpec.describe Spree::SellerTransfers::ExecutePendingDueJob do
expect(enqueued_seller_ids).to be_empty
end
+ it 'hands over a seller whose reversal the provider refused' do
+ original = earning(status: 'completed')
+ create(:seller_transfer, :reversal, seller: seller, order: original.order, reversed_from: original,
+ status: 'processing')
+
+ described_class.perform_now
+
+ expect(enqueued_seller_ids).to contain_exactly(seller.id)
+ end
+
+ it 'hands over a seller who is no longer approved when a reversal is owed' do
+ original = earning(status: 'completed')
+ create(:seller_transfer, :reversal, seller: seller, order: original.order, reversed_from: original,
+ status: 'processing')
+ seller.update!(status: 'suspended')
+
+ described_class.perform_now
+
+ expect(enqueued_seller_ids).to contain_exactly(seller.id)
+ end
+
+ # Nothing can be taken back until a person settles what the earning did.
+ it 'leaves a reversal of an earning nobody can account for alone' do
+ original = earning(status: 'unresolved')
+ create(:seller_transfer, :reversal, seller: seller, order: original.order, reversed_from: original,
+ status: 'processing')
+
+ described_class.perform_now
+
+ expect(enqueued_seller_ids).to be_empty
+ end
+
it 'says nothing when every earning is confirmed' do
earning(status: 'completed')
diff --git a/spree/core/spec/jobs/spree/seller_transfers/execute_pending_job_spec.rb b/spree/core/spec/jobs/spree/seller_transfers/execute_pending_job_spec.rb
index 02339adb6a..e045eccb2a 100644
--- a/spree/core/spec/jobs/spree/seller_transfers/execute_pending_job_spec.rb
+++ b/spree/core/spec/jobs/spree/seller_transfers/execute_pending_job_spec.rb
@@ -75,7 +75,39 @@ RSpec.describe Spree::SellerTransfers::ExecutePendingJob do
described_class.perform_now(seller.id)
- expect(reversal.reload).to be_processing
+ expect(reversal.reload).to be_completed
+ end
+
+ # A reversal can only be taken from an earning that was sent, so the earning
+ # goes first and the reversal finds it done.
+ it 'reverses a refused reversal after sending its earning' do
+ earning = pending_earning
+ reversal = create(:seller_transfer, :reversal, seller: seller, order: earning.order, reversed_from: earning,
+ status: 'processing')
+ allow_any_instance_of(Spree::PayoutProvider::System).to receive(:reverse!).and_wrap_original do |original, row|
+ raise Spree::Core::GatewayError, 'earning not sent' unless row.reversed_from.reload.completed?
+
+ original.call(row)
+ end
+
+ described_class.perform_now(seller.id)
+
+ expect(reversal.reload).to be_completed
+ end
+
+ # A seller suspended after a wave of refunds is the one whose money most
+ # needs to come back.
+ it 'reverses for a seller who can no longer be paid' do
+ earning = create(:seller_transfer, :completed, seller: seller, amount: 40,
+ order: create(:order, store: store, seller: seller))
+ reversal = create(:seller_transfer, :reversal, seller: seller, order: earning.order, reversed_from: earning,
+ status: 'processing')
+ allow(Spree::PayoutProvider::System).to receive(:requires_payout_account?).and_return(true)
+ seller.update!(payouts_enabled_at: nil)
+
+ described_class.perform_now(seller.id)
+
+ expect(reversal.reload).to be_completed
end
it 'does nothing for a seller the provider still will not accept' do
diff --git a/spree/providers/stripe/app/models/spree_stripe/payout_provider.rb b/spree/providers/stripe/app/models/spree_stripe/payout_provider.rb
index 4e54b06aaf..719d513612 100644
--- a/spree/providers/stripe/app/models/spree_stripe/payout_provider.rb
+++ b/spree/providers/stripe/app/models/spree_stripe/payout_provider.rb
@@ -266,15 +266,58 @@ module SpreeStripe
raise Spree::Core::AmbiguousGatewayError, e.message
end
- # Pulls a seller's money back after a refund.
+ # Pulls a seller's share of a refund back from their connected account.
#
- # Ledger-only in open source: the row is written either way, so the books
- # stay correct, but reversing the Stripe transfer — and netting a negative
- # balance against future earnings — is where a marketplace needs the money
- # operations that Enterprise provides.
+ # Reverses the transfer that paid the earning, by the reversal's amount,
+ # so the money returns to the platform that refunded the customer. A
+ # seller who has already been paid out is left with a negative Stripe
+ # balance, which their next earnings make up before anything more is paid
+ # out to them.
+ #
+ # The reversal waits until its earning has reached Stripe: until then
+ # there is no transfer to take from. It is left pending, and the
+ # pending-transfers job asks again once the earning is sent.
+ #
+ # A retry first looks for a reversal an earlier attempt already made, so
+ # the seller is never charged twice for one refund.
def reverse!(seller_transfer)
- seller_transfer.update!(status: 'completed')
+ return complete_without_sending(seller_transfer) if minor_units(seller_transfer).zero?
+
+ earning = seller_transfer.reversed_from
+ raise Spree::Core::GatewayError, 'Reversal has no earning to take back from' if earning.nil?
+ # Never sent, so nothing reached the seller's account.
+ return complete_without_sending(seller_transfer) if earning.failed?
+ return seller_transfer unless earning.completed?
+
+ # Confirmed without a transfer to point at — settled by hand, say. Only
+ # a person can say where that money is.
+ if earning.reference.blank?
+ raise Spree::Core::AmbiguousGatewayError, 'The earning has no Stripe transfer to reverse'
+ end
+
+ api_options = gateway_for(seller_transfer.seller.store).api_options
+ reversal = made_reversal(earning, seller_transfer, api_options) || Stripe::Transfer.create_reversal(
+ earning.reference,
+ {
+ amount: minor_units(seller_transfer),
+ metadata: {
+ spree_seller_transfer_id: seller_transfer.id,
+ spree_order_number: seller_transfer.order.number
+ }
+ },
+ api_options.merge(idempotency_key: idempotency_key(seller_transfer))
+ )
+
+ # The earning may have been sent after this row was written, and only
+ # then learned the currency it settled in.
+ seller_transfer.update!(
+ { status: 'completed', reference: reversal.id }.merge(earning.reversal_settlement(seller_transfer.amount.abs))
+ )
seller_transfer
+ rescue *AMBIGUOUS_ERRORS => e
+ # The reversal may have been made before the answer was lost, so core
+ # parks it rather than taking the money back twice.
+ raise Spree::Core::AmbiguousGatewayError, e.message
end
private
@@ -300,6 +343,21 @@ module SpreeStripe
seller_transfer
end
+ # The reversal an earlier attempt made but never recorded — the row failed
+ # to save, or the process stopped first. Found by the row it names, since
+ # the idempotency key that would also stop a second one lasts only a day.
+ #
+ # A failed lookup moved no money, so it is a refusal the retry job can
+ # repeat rather than an outcome nobody knows.
+ def made_reversal(earning, seller_transfer, api_options)
+ reversals = Stripe::Transfer.list_reversals(earning.reference, { limit: 100 }, api_options)
+ reversals.auto_paging_each.find do |reversal|
+ reversal.metadata['spree_seller_transfer_id'] == seller_transfer.id.to_s
+ end
+ rescue Stripe::StripeError => e
+ raise Spree::Core::GatewayError, e.message
+ end
+
# Nil rather than raising: a checklist row asking why it is incomplete
# must not take the page down because Stripe is unreachable.
def retrieve_account(seller)
diff --git a/spree/providers/stripe/spec/models/spree_stripe/payout_provider/transfer_reversal_spec.rb b/spree/providers/stripe/spec/models/spree_stripe/payout_provider/transfer_reversal_spec.rb
new file mode 100644
index 0000000000..01173380f7
--- /dev/null
+++ b/spree/providers/stripe/spec/models/spree_stripe/payout_provider/transfer_reversal_spec.rb
@@ -0,0 +1,83 @@
+require 'spec_helper'
+
+# Reversals against Stripe rather than against a stub, so the recording shows
+# what Stripe does when a refund pulls a seller's share back — including from
+# a seller whose balance has already gone to their bank.
+#
+# Recorded on a test-mode platform with Connect turned on, against a connected
+# account that is fully onboarded and can receive transfers:
+# STRIPE_SECRET_KEY=sk_test_... RECORD_VCR=1 pnpm test:rspec stripe <this file>
+RSpec.describe SpreeStripe::PayoutProvider do
+ let(:store) { @default_store }
+ let!(:gateway) { create(:stripe_gateway, store: store) }
+ let(:connected_account) { 'acct_1UE8TgCPyuszaKOY' }
+ let(:seller) do
+ create(:seller, :approved, store: store).tap do |record|
+ record.set_payout_account_reference(described_class, connected_account)
+ end
+ end
+ let(:order) { create(:order, store: store, seller: seller, total: 100, currency: 'USD') }
+ let(:provider) { described_class.new }
+
+ describe '#reverse!' do
+ # A card whose funds are available at once, so the transfer can draw on
+ # the charge straight away instead of waiting for it to settle.
+ let(:charge_id) do
+ Stripe::PaymentIntent.create(
+ { amount: 10_000, currency: 'usd', payment_method: 'pm_card_bypassPending',
+ payment_method_types: ['card'], confirm: true },
+ gateway.api_options
+ ).latest_charge
+ end
+ # Stripe keeps an idempotency key for a day and the test database repeats
+ # ids, so rows that reach Stripe take ids no earlier recording used.
+ let(:recording_id) { SecureRandom.random_number(1_000_000_000) }
+ let(:earning) do
+ create(:payment, order: order, payment_method: gateway, amount: order.total,
+ status: 'completed', metadata: { 'stripe_charge_id' => charge_id })
+ provider.transfer!(
+ create(:seller_transfer, id: recording_id, seller: seller, order: order, amount: 42.5, currency: 'USD',
+ provider: described_class.provider_key)
+ )
+ end
+ let(:reversal) do
+ create(:seller_transfer, :reversal, id: recording_id + 1, seller: seller, order: order, reversed_from: earning,
+ amount: -10.25, currency: 'USD', provider: described_class.provider_key)
+ end
+
+ before do
+ earning
+ Stripe::Refund.create({ charge: charge_id, amount: 2050 }, gateway.api_options)
+ end
+
+ context 'when the seller still holds the earning', vcr: { cassette_name: 'payout_provider_reverse_transfer' } do
+ it "takes the seller's share back from the transfer that paid them" do
+ provider.reverse!(reversal)
+
+ expect(reversal.reload).to be_completed
+ expect(reversal.reference).to start_with('trr_')
+ expect(Stripe::Transfer.retrieve(earning.reference, gateway.api_options).amount_reversed).to eq(1025)
+ end
+ end
+
+ # Nothing on the seller's account covers the reversal. The marketplace
+ # carries their losses, so Stripe is expected to take the balance negative
+ # rather than refuse.
+ context 'when the seller has already been paid out',
+ vcr: { cassette_name: 'payout_provider_reverse_transfer_after_payout' } do
+ before do
+ held = SpreeStripe::Units.to_stripe(provider.available_payout(seller, 'USD'), 'USD', payout: true)
+ Stripe::Payout.create(
+ { amount: held, currency: 'usd' }, gateway.api_options.merge(stripe_account: connected_account)
+ )
+ end
+
+ it 'takes their balance below zero' do
+ provider.reverse!(reversal)
+
+ expect(reversal.reload).to be_completed
+ expect(provider.available_payout(seller, 'USD')).to eq(-10.25)
+ end
+ end
+ end
+end
diff --git a/spree/providers/stripe/spec/models/spree_stripe/payout_provider_spec.rb b/spree/providers/stripe/spec/models/spree_stripe/payout_provider_spec.rb
index d1dbb07f92..aa69eb15f3 100644
--- a/spree/providers/stripe/spec/models/spree_stripe/payout_provider_spec.rb
+++ b/spree/providers/stripe/spec/models/spree_stripe/payout_provider_spec.rb
@@ -184,6 +184,115 @@ RSpec.describe SpreeStripe::PayoutProvider do
end
end
+ describe '#reverse!' do
+ let(:earning) do
+ create(:seller_transfer, :completed, seller: seller, order: order, amount: 42.5, currency: 'USD',
+ reference: 'tr_1')
+ end
+ let(:reversal) do
+ create(:seller_transfer, :reversal, seller: seller, order: order, reversed_from: earning,
+ amount: -10.25, currency: 'USD')
+ end
+
+ let(:reversals_made) { [] }
+
+ before do
+ allow(Stripe::Transfer).to receive(:create_reversal).and_return(Stripe::StripeObject.construct_from(id: 'trr_1'))
+ allow(Stripe::Transfer).to receive(:list_reversals) do
+ Stripe::ListObject.construct_from(object: 'list', data: reversals_made, has_more: false)
+ end
+ end
+
+ it "takes the seller's share back from the transfer that paid the earning" do
+ expect(Stripe::Transfer).to receive(:create_reversal).
+ with('tr_1', hash_including(amount: 1025), hash_including(idempotency_key: "spree-#{reversal.prefixed_id}")).
+ and_return(Stripe::StripeObject.construct_from(id: 'trr_1'))
+
+ described_class.new.reverse!(reversal)
+
+ expect(reversal.reload).to be_completed
+ expect(reversal.reference).to eq('trr_1')
+ end
+
+ # Until the earning is sent there is no transfer to take from, so the
+ # reversal stays owed and the pending-transfers job asks again.
+ it 'waits while the earning has not reached Stripe' do
+ earning.update!(status: 'processing', reference: nil)
+
+ expect(Stripe::Transfer).not_to receive(:create_reversal)
+
+ described_class.new.reverse!(reversal)
+
+ expect(reversal.reload).to be_pending
+ end
+
+ it 'takes nothing back from an earning that was never sent' do
+ earning.update!(status: 'failed', reference: nil)
+
+ expect(Stripe::Transfer).not_to receive(:create_reversal)
+
+ described_class.new.reverse!(reversal)
+
+ expect(reversal.reload).to be_completed
+ end
+
+ # Confirmed by hand, perhaps — the money may well be on the seller's
+ # account, so calling the reversal done would be a guess.
+ it 'leaves a confirmed earning with no transfer to a person' do
+ earning.update!(reference: nil)
+
+ expect { described_class.new.reverse!(reversal) }.to raise_error(Spree::Core::AmbiguousGatewayError)
+ end
+
+ # Written while the earning still read the sale's currency, then sent and
+ # converted on the way in.
+ it 'settles where its earning settled' do
+ earning.update!(settled_amount: 39.10, settled_currency: 'EUR')
+
+ described_class.new.reverse!(reversal)
+
+ expect(reversal.reload.settled_currency).to eq('EUR')
+ expect(reversal.settled_amount).to eq(-9.43)
+ end
+
+ it 'reports a lost answer as an outcome nobody knows' do
+ allow(Stripe::Transfer).to receive(:create_reversal).and_raise(Stripe::APIConnectionError, 'timed out')
+
+ expect { described_class.new.reverse!(reversal) }.to raise_error(Spree::Core::AmbiguousGatewayError)
+ end
+
+ # An earlier attempt reversed the transfer but never recorded it, and its
+ # idempotency key may have expired since — asking again would take the
+ # money twice.
+ context 'when an earlier attempt already made the reversal' do
+ let(:reversals_made) do
+ [
+ { id: 'trr_other', object: 'transfer_reversal', metadata: { spree_seller_transfer_id: '0' } },
+ { id: 'trr_made', object: 'transfer_reversal', metadata: { spree_seller_transfer_id: reversal.id.to_s } }
+ ]
+ end
+
+ it 'records that reversal instead of making another' do
+ expect(Stripe::Transfer).not_to receive(:create_reversal)
+
+ described_class.new.reverse!(reversal)
+
+ expect(reversal.reload).to be_completed
+ expect(reversal.reference).to eq('trr_made')
+ end
+ end
+
+ # Nothing moved, so the retry job may simply ask again.
+ it 'leaves a failed lookup to be retried' do
+ allow(Stripe::Transfer).to receive(:list_reversals).and_raise(Stripe::APIConnectionError, 'timed out')
+
+ expect { described_class.new.reverse!(reversal) }.to raise_error(Spree::Core::GatewayError) do |error|
+ expect(error).not_to be_a(Spree::Core::AmbiguousGatewayError)
+ end
+ expect(Stripe::Transfer).not_to have_received(:create_reversal)
+ end
+ end
+
describe '#pay!' do
let(:payout) { create(:seller_payout, seller: seller, amount: 42.5, currency: 'USD') }
diff --git a/spree/providers/stripe/spec/vcr/payout_provider_reverse_transfer.yml b/spree/providers/stripe/spec/vcr/payout_provider_reverse_transfer.yml
new file mode 100644
index 0000000000..e4dffac06b
--- /dev/null
+++ b/spree/providers/stripe/spec/vcr/payout_provider_reverse_transfer.yml
@@ -0,0 +1,787 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/payment_intents
+ body:
+ encoding: UTF-8
+ string: amount=10000&currency=usd&payment_method=pm_card_bypassPending&payment_method_types[0]=card&confirm=true
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ Idempotency-Key:
+ - 3aacfd96-8c76-41c9-9cc2-77e26cd5ad22
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:20 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '1590'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=5Cu60vCZ0ca2-Mh-NzxqrG_d8tJx6O5Ii2QCEpyHXOuczKItC5_kqBN8DbemJiXqER6JwL0XJXNzhOD7;
+ report-to csp
+ Idempotency-Key:
+ - 3aacfd96-8c76-41c9-9cc2-77e26cd5ad22
+ Original-Request:
+ - req_DHX8Ii6oHYWpGn
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=5Cu60vCZ0ca2-Mh-NzxqrG_d8tJx6O5Ii2QCEpyHXOuczKItC5_kqBN8DbemJiXqER6JwL0XJXNzhOD7&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=5Cu60vCZ0ca2-Mh-NzxqrG_d8tJx6O5Ii2QCEpyHXOuczKItC5_kqBN8DbemJiXqER6JwL0XJXNzhOD7&t=1"
+ Request-Id:
+ - req_DHX8Ii6oHYWpGn
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "pi_3UVW4aFmGsiQWfE60s4jVfpP",
+ "object": "payment_intent",
+ "allowed_payment_method_types": null,
+ "amount": 10000,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 10000,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "client_secret": "pi_3UVW4aFmGsiQWfE60s4jVfpP_secret_QNhLqGls1Hw02e3xZzvvrlwLT",
+ "confirmation_method": "automatic",
+ "created": 1793190920,
+ "currency": "usd",
+ "customer": null,
+ "customer_account": null,
+ "description": null,
+ "excluded_payment_method_types": null,
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_3UVW4aFmGsiQWfE609Q0eAZB",
+ "livemode": false,
+ "managed_payments": {
+ "enabled": false
+ },
+ "metadata": {},
+ "next_action": null,
+ "on_behalf_of": null,
+ "payment_method": "pm_1UVW4ZFmGsiQWfE6qtr0wP88",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_record": null,
+ "processing": null,
+ "receipt_email": null,
+ "review": null,
+ "setup_future_usage": null,
+ "shared_payment_granted_token": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": null,
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:20 GMT
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/transfers
+ body:
+ encoding: UTF-8
+ string: amount=4250&currency=usd&destination=acct_1UE8TgCPyuszaKOY&source_transaction=ch_3UVW4aFmGsiQWfE609Q0eAZB&metadata[spree_seller_transfer_id]=450903764&metadata[spree_order_number]=R1001&expand[0]=destination_payment.balance_transaction
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_DHX8Ii6oHYWpGn","request_duration_ms":1283}}'
+ Idempotency-Key:
+ - spree-vtr_Y010FYETxC
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:21 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '3263'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - spree-vtr_Y010FYETxC
+ Original-Request:
+ - req_8s3gHgXBzC9xSm
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_8s3gHgXBzC9xSm
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "tr_3UVW4aFmGsiQWfE60GzM4283",
+ "object": "transfer",
+ "amount": 4250,
+ "amount_reversed": 0,
+ "balance_transaction": "txn_3UVW4aFmGsiQWfE609YWz8tM",
+ "created": 1793190921,
+ "currency": "usd",
+ "description": null,
+ "destination": "acct_1UE8TgCPyuszaKOY",
+ "destination_payment": {
+ "id": "py_1UVW4bCPyuszaKOYVzCypbUW",
+ "object": "charge",
+ "amount": 4250,
+ "amount_captured": 4250,
+ "amount_refunded": 0,
+ "application": "ca_SHLkYn88AhyjJ4Fkk5eqq8xeGERfDeV7",
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": {
+ "id": "txn_1UVW4bCPyuszaKOY20fmFnb0",
+ "object": "balance_transaction",
+ "amount": 4250,
+ "available_on": 1793190921,
+ "balance_type": "payments",
+ "created": 1793190921,
+ "currency": "usd",
+ "description": null,
+ "exchange_rate": null,
+ "fee": 0,
+ "fee_details": [],
+ "net": 4250,
+ "reporting_category": "charge",
+ "source": "py_1UVW4bCPyuszaKOYVzCypbUW",
+ "status": "available",
+ "type": "payment"
+ },
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null,
+ "tax_id": null
+ },
+ "calculated_statement_descriptor": null,
+ "captured": true,
+ "created": 1793190921,
+ "currency": "usd",
+ "customer": null,
+ "description": null,
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": null,
+ "paid": true,
+ "payment_intent": null,
+ "payment_method": null,
+ "payment_method_details": {
+ "stripe_account": {},
+ "type": "stripe_account"
+ },
+ "receipt_email": null,
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xVUU4VGdDUHl1c3phS09ZKInYh9cGMgYko6eZva46LBb13EKs5Kjr0ddbD7C9OccoBd5k7xubnLTF_EQBqrwTxLKfHCkS15miZ0FV",
+ "refunded": false,
+ "review": null,
+ "shipping": null,
+ "source": {
+ "id": "acct_1RMn2pFmGsiQWfE6",
+ "object": "account",
+ "application_icon": "https://files.stripe.com/links/MDB8YWNjdF8xUk1uMnBGbUdzaVFXZkU2fGZsX2xpdmVfSnBnMWtpZVk3ZlpZcUlpM09yR2lBMzVp00swlntEYI",
+ "application_name": "Vendo (test)"
+ },
+ "source_transfer": "tr_3UVW4aFmGsiQWfE60GzM4283",
+ "statement_descriptor": null,
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ },
+ "livemode": false,
+ "metadata": {
+ "spree_order_number": "R1001",
+ "spree_seller_transfer_id": "450903764"
+ },
+ "reversals": {
+ "object": "list",
+ "data": [],
+ "has_more": false,
+ "total_count": 0,
+ "url": "/v1/transfers/tr_3UVW4aFmGsiQWfE60GzM4283/reversals"
+ },
+ "reversed": false,
+ "source_transaction": "ch_3UVW4aFmGsiQWfE609Q0eAZB",
+ "source_type": "card",
+ "transfer_group": "group_pi_3UVW4aFmGsiQWfE60s4jVfpP"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:21 GMT
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/refunds
+ body:
+ encoding: UTF-8
+ string: charge=ch_3UVW4aFmGsiQWfE609Q0eAZB&amount=2050
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_8s3gHgXBzC9xSm","request_duration_ms":983}}'
+ Idempotency-Key:
+ - cd2df86a-04ef-4054-ad6a-4e15e5e4a282
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:22 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '714'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - cd2df86a-04ef-4054-ad6a-4e15e5e4a282
+ Original-Request:
+ - req_eyb1kcUGclQ8Ed
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_eyb1kcUGclQ8Ed
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "re_3UVW4aFmGsiQWfE60UITZmgx",
+ "object": "refund",
+ "amount": 2050,
+ "balance_transaction": "txn_3UVW4aFmGsiQWfE60KtjBoCx",
+ "charge": "ch_3UVW4aFmGsiQWfE609Q0eAZB",
+ "created": 1793190922,
+ "currency": "usd",
+ "customer": null,
+ "customer_account": null,
+ "destination_details": {
+ "card": {
+ "reference_status": "pending",
+ "reference_type": "acquirer_reference_number",
+ "type": "refund"
+ },
+ "type": "card"
+ },
+ "metadata": {},
+ "payment_intent": "pi_3UVW4aFmGsiQWfE60s4jVfpP",
+ "payment_method": "pm_1UVW4ZFmGsiQWfE6qtr0wP88",
+ "reason": null,
+ "receipt_number": null,
+ "source_transfer_reversal": null,
+ "status": "succeeded",
+ "transfer_reversal": null
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:22 GMT
+- request:
+ method: get
+ uri: https://api.stripe.com/v1/transfers/tr_3UVW4aFmGsiQWfE60GzM4283/reversals?limit=100
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_eyb1kcUGclQ8Ed","request_duration_ms":999}}'
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:23 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '121'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_Lua2DtfKgYvHRa
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "object": "list",
+ "data": [],
+ "has_more": false,
+ "url": "/v1/transfers/tr_3UVW4aFmGsiQWfE60GzM4283/reversals"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:23 GMT
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/transfers/tr_3UVW4aFmGsiQWfE60GzM4283/reversals
+ body:
+ encoding: UTF-8
+ string: amount=1025&metadata[spree_seller_transfer_id]=450903765&metadata[spree_order_number]=R1001
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_Lua2DtfKgYvHRa","request_duration_ms":161}}'
+ Idempotency-Key:
+ - spree-vtr_5vxvHAQZnC
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:24 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '430'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - spree-vtr_5vxvHAQZnC
+ Original-Request:
+ - req_nI165JxLQtsQm5
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_nI165JxLQtsQm5
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "trr_1UVW4dFmGsiQWfE6ysRdAlPd",
+ "object": "transfer_reversal",
+ "amount": 1025,
+ "balance_transaction": "txn_1UVW4dFmGsiQWfE6ErKBcx9z",
+ "created": 1793190923,
+ "currency": "usd",
+ "destination_payment_refund": "pyr_1UVW4dCPyuszaKOYxWh0ocjq",
+ "metadata": {
+ "spree_order_number": "R1001",
+ "spree_seller_transfer_id": "450903765"
+ },
+ "source_refund": null,
+ "transfer": "tr_3UVW4aFmGsiQWfE60GzM4283"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:24 GMT
+- request:
+ method: get
+ uri: https://api.stripe.com/v1/transfers/tr_3UVW4aFmGsiQWfE60GzM4283
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_nI165JxLQtsQm5","request_duration_ms":980}}'
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:24 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '1309'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_moIlJkfxqCSIQh
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "tr_3UVW4aFmGsiQWfE60GzM4283",
+ "object": "transfer",
+ "amount": 4250,
+ "amount_reversed": 1025,
+ "balance_transaction": "txn_3UVW4aFmGsiQWfE609YWz8tM",
+ "created": 1793190921,
+ "currency": "usd",
+ "description": null,
+ "destination": "acct_1UE8TgCPyuszaKOY",
+ "destination_payment": "py_1UVW4bCPyuszaKOYVzCypbUW",
+ "livemode": false,
+ "metadata": {
+ "spree_order_number": "R1001",
+ "spree_seller_transfer_id": "450903764"
+ },
+ "reversals": {
+ "object": "list",
+ "data": [
+ {
+ "id": "trr_1UVW4dFmGsiQWfE6ysRdAlPd",
+ "object": "transfer_reversal",
+ "amount": 1025,
+ "balance_transaction": "txn_1UVW4dFmGsiQWfE6ErKBcx9z",
+ "created": 1793190923,
+ "currency": "usd",
+ "destination_payment_refund": "pyr_1UVW4dCPyuszaKOYxWh0ocjq",
+ "metadata": {
+ "spree_order_number": "R1001",
+ "spree_seller_transfer_id": "450903765"
+ },
+ "source_refund": null,
+ "transfer": "tr_3UVW4aFmGsiQWfE60GzM4283"
+ }
+ ],
+ "has_more": false,
+ "total_count": 1,
+ "url": "/v1/transfers/tr_3UVW4aFmGsiQWfE60GzM4283/reversals"
+ },
+ "reversed": false,
+ "source_transaction": "ch_3UVW4aFmGsiQWfE609Q0eAZB",
+ "source_type": "card",
+ "transfer_group": "group_pi_3UVW4aFmGsiQWfE60s4jVfpP"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:24 GMT
+recorded_with: VCR 6.4.0
diff --git a/spree/providers/stripe/spec/vcr/payout_provider_reverse_transfer_after_payout.yml b/spree/providers/stripe/spec/vcr/payout_provider_reverse_transfer_after_payout.yml
new file mode 100644
index 0000000000..4d53937707
--- /dev/null
+++ b/spree/providers/stripe/spec/vcr/payout_provider_reverse_transfer_after_payout.yml
@@ -0,0 +1,1049 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/payment_intents
+ body:
+ encoding: UTF-8
+ string: amount=10000&currency=usd&payment_method=pm_card_bypassPending&payment_method_types[0]=card&confirm=true
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_moIlJkfxqCSIQh","request_duration_ms":165}}'
+ Idempotency-Key:
+ - '06850c68-6ca2-4dad-b5dc-ba822b8bd409'
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:25 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '1590'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - '06850c68-6ca2-4dad-b5dc-ba822b8bd409'
+ Original-Request:
+ - req_TmbuBLjDXrn7ZD
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_TmbuBLjDXrn7ZD
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "pi_3UVW4eFmGsiQWfE6197b1vzK",
+ "object": "payment_intent",
+ "allowed_payment_method_types": null,
+ "amount": 10000,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 10000,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "client_secret": "pi_3UVW4eFmGsiQWfE6197b1vzK_secret_z7BVaj45G4xl5hZJILCQBe3kZ",
+ "confirmation_method": "automatic",
+ "created": 1793190924,
+ "currency": "usd",
+ "customer": null,
+ "customer_account": null,
+ "description": null,
+ "excluded_payment_method_types": null,
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_3UVW4eFmGsiQWfE61pPYW0dt",
+ "livemode": false,
+ "managed_payments": {
+ "enabled": false
+ },
+ "metadata": {},
+ "next_action": null,
+ "on_behalf_of": null,
+ "payment_method": "pm_1UVW4eFmGsiQWfE6ru9tuDMd",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_record": null,
+ "processing": null,
+ "receipt_email": null,
+ "review": null,
+ "setup_future_usage": null,
+ "shared_payment_granted_token": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": null,
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:25 GMT
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/transfers
+ body:
+ encoding: UTF-8
+ string: amount=4250&currency=usd&destination=acct_1UE8TgCPyuszaKOY&source_transaction=ch_3UVW4eFmGsiQWfE61pPYW0dt&metadata[spree_seller_transfer_id]=346586703&metadata[spree_order_number]=R1001&expand[0]=destination_payment.balance_transaction
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_TmbuBLjDXrn7ZD","request_duration_ms":1100}}'
+ Idempotency-Key:
+ - spree-vtr_AyRKrWs1ig
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:26 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '3263'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - spree-vtr_AyRKrWs1ig
+ Original-Request:
+ - req_0BtJWX3kdbOiKb
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_0BtJWX3kdbOiKb
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "tr_3UVW4eFmGsiQWfE61ucPczob",
+ "object": "transfer",
+ "amount": 4250,
+ "amount_reversed": 0,
+ "balance_transaction": "txn_3UVW4eFmGsiQWfE61Ne588SR",
+ "created": 1793190925,
+ "currency": "usd",
+ "description": null,
+ "destination": "acct_1UE8TgCPyuszaKOY",
+ "destination_payment": {
+ "id": "py_1UVW4fCPyuszaKOYvWkk5Rbr",
+ "object": "charge",
+ "amount": 4250,
+ "amount_captured": 4250,
+ "amount_refunded": 0,
+ "application": "ca_SHLkYn88AhyjJ4Fkk5eqq8xeGERfDeV7",
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": {
+ "id": "txn_1UVW4gCPyuszaKOYhEnSksKI",
+ "object": "balance_transaction",
+ "amount": 4250,
+ "available_on": 1793190925,
+ "balance_type": "payments",
+ "created": 1793190925,
+ "currency": "usd",
+ "description": null,
+ "exchange_rate": null,
+ "fee": 0,
+ "fee_details": [],
+ "net": 4250,
+ "reporting_category": "charge",
+ "source": "py_1UVW4fCPyuszaKOYvWkk5Rbr",
+ "status": "available",
+ "type": "payment"
+ },
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null,
+ "tax_id": null
+ },
+ "calculated_statement_descriptor": null,
+ "captured": true,
+ "created": 1793190925,
+ "currency": "usd",
+ "customer": null,
+ "description": null,
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": null,
+ "paid": true,
+ "payment_intent": null,
+ "payment_method": null,
+ "payment_method_details": {
+ "stripe_account": {},
+ "type": "stripe_account"
+ },
+ "receipt_email": null,
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xVUU4VGdDUHl1c3phS09ZKI7Yh9cGMgbnu_w6HKU6LBaff3LV4F9-7ef6IFbpF_MX2aKbmM0tXZpSFtirDtQTJk3Tl2TC1gpQKKdC",
+ "refunded": false,
+ "review": null,
+ "shipping": null,
+ "source": {
+ "id": "acct_1RMn2pFmGsiQWfE6",
+ "object": "account",
+ "application_icon": "https://files.stripe.com/links/MDB8YWNjdF8xUk1uMnBGbUdzaVFXZkU2fGZsX2xpdmVfSnBnMWtpZVk3ZlpZcUlpM09yR2lBMzVp00swlntEYI",
+ "application_name": "Vendo (test)"
+ },
+ "source_transfer": "tr_3UVW4eFmGsiQWfE61ucPczob",
+ "statement_descriptor": null,
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ },
+ "livemode": false,
+ "metadata": {
+ "spree_order_number": "R1001",
+ "spree_seller_transfer_id": "346586703"
+ },
+ "reversals": {
+ "object": "list",
+ "data": [],
+ "has_more": false,
+ "total_count": 0,
+ "url": "/v1/transfers/tr_3UVW4eFmGsiQWfE61ucPczob/reversals"
+ },
+ "reversed": false,
+ "source_transaction": "ch_3UVW4eFmGsiQWfE61pPYW0dt",
+ "source_type": "card",
+ "transfer_group": "group_pi_3UVW4eFmGsiQWfE6197b1vzK"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:26 GMT
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/refunds
+ body:
+ encoding: UTF-8
+ string: charge=ch_3UVW4eFmGsiQWfE61pPYW0dt&amount=2050
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_0BtJWX3kdbOiKb","request_duration_ms":901}}'
+ Idempotency-Key:
+ - 101763f7-ea35-4fbd-86e8-417706d09d34
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:27 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '714'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - 101763f7-ea35-4fbd-86e8-417706d09d34
+ Original-Request:
+ - req_i0c9ojUkIU5aWN
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_i0c9ojUkIU5aWN
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "re_3UVW4eFmGsiQWfE61LmNuMiY",
+ "object": "refund",
+ "amount": 2050,
+ "balance_transaction": "txn_3UVW4eFmGsiQWfE61HDNXqic",
+ "charge": "ch_3UVW4eFmGsiQWfE61pPYW0dt",
+ "created": 1793190926,
+ "currency": "usd",
+ "customer": null,
+ "customer_account": null,
+ "destination_details": {
+ "card": {
+ "reference_status": "pending",
+ "reference_type": "acquirer_reference_number",
+ "type": "refund"
+ },
+ "type": "card"
+ },
+ "metadata": {},
+ "payment_intent": "pi_3UVW4eFmGsiQWfE6197b1vzK",
+ "payment_method": "pm_1UVW4eFmGsiQWfE6ru9tuDMd",
+ "reason": null,
+ "receipt_number": null,
+ "source_transfer_reversal": null,
+ "status": "succeeded",
+ "transfer_reversal": null
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:27 GMT
+- request:
+ method: get
+ uri: https://api.stripe.com/v1/balance
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_i0c9ojUkIU5aWN","request_duration_ms":865}}'
+ Stripe-Version:
+ - '2023-10-16'
+ Stripe-Account:
+ - acct_1UE8TgCPyuszaKOY
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:27 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '665'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_waUkeHE9A49DG3
+ Stripe-Account:
+ - acct_1UE8TgCPyuszaKOY
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "object": "balance",
+ "available": [
+ {
+ "amount": 6450,
+ "currency": "usd",
+ "source_types": {
+ "card": 6450
+ }
+ }
+ ],
+ "instant_available": [
+ {
+ "amount": 6450,
+ "currency": "usd",
+ "source_types": {
+ "card": 6450
+ }
+ }
+ ],
+ "livemode": false,
+ "pending": [
+ {
+ "amount": 0,
+ "currency": "usd",
+ "source_types": {
+ "card": 0
+ }
+ }
+ ],
+ "refund_and_dispute_prefunding": {
+ "available": [
+ {
+ "amount": 0,
+ "currency": "usd"
+ }
+ ],
+ "pending": [
+ {
+ "amount": 0,
+ "currency": "usd"
+ }
+ ]
+ }
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:27 GMT
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/payouts
+ body:
+ encoding: UTF-8
+ string: amount=6450&currency=usd
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_waUkeHE9A49DG3","request_duration_ms":300}}'
+ Idempotency-Key:
+ - 4fe1baad-38be-4cab-bc24-1d44658dc9cf
+ Stripe-Version:
+ - '2023-10-16'
+ Stripe-Account:
+ - acct_1UE8TgCPyuszaKOY
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:28 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '811'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - 4fe1baad-38be-4cab-bc24-1d44658dc9cf
+ Original-Request:
+ - req_42VJ1gKu9rKlVF
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_42VJ1gKu9rKlVF
+ Stripe-Account:
+ - acct_1UE8TgCPyuszaKOY
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "po_1UVW4hCPyuszaKOYClgxS0gM",
+ "object": "payout",
+ "amount": 6450,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "arrival_date": 1793145600,
+ "automatic": false,
+ "balance_transaction": "txn_1UVW4iCPyuszaKOYUFaWkkvo",
+ "created": 1793190927,
+ "currency": "usd",
+ "description": null,
+ "destination": "ba_1UFalMCPyuszaKOYaQKIndqq",
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "livemode": false,
+ "metadata": {},
+ "method": "standard",
+ "original_payout": null,
+ "payout_method": null,
+ "reconciliation_status": "not_applicable",
+ "reversed_by": null,
+ "source_type": "card",
+ "statement_descriptor": null,
+ "status": "pending",
+ "trace_id": {
+ "status": "pending",
+ "value": null
+ },
+ "type": "bank_account"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:28 GMT
+- request:
+ method: get
+ uri: https://api.stripe.com/v1/transfers/tr_3UVW4eFmGsiQWfE61ucPczob/reversals?limit=100
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_42VJ1gKu9rKlVF","request_duration_ms":1007}}'
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:28 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '121'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_TLS22D6jo8qGwa
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "object": "list",
+ "data": [],
+ "has_more": false,
+ "url": "/v1/transfers/tr_3UVW4eFmGsiQWfE61ucPczob/reversals"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:28 GMT
+- request:
+ method: post
+ uri: https://api.stripe.com/v1/transfers/tr_3UVW4eFmGsiQWfE61ucPczob/reversals
+ body:
+ encoding: UTF-8
+ string: amount=1025&metadata[spree_seller_transfer_id]=346586704&metadata[spree_order_number]=R1001
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_TLS22D6jo8qGwa","request_duration_ms":161}}'
+ Idempotency-Key:
+ - spree-vtr_p45GOMklVe
+ Stripe-Version:
+ - '2023-10-16'
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:29 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '430'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Idempotency-Key:
+ - spree-vtr_p45GOMklVe
+ Original-Request:
+ - req_QcIRMTEH4YQo3o
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_QcIRMTEH4YQo3o
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Should-Retry:
+ - 'false'
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "id": "trr_1UVW4iFmGsiQWfE67D5QK2IN",
+ "object": "transfer_reversal",
+ "amount": 1025,
+ "balance_transaction": "txn_1UVW4jFmGsiQWfE6h9x9hE9C",
+ "created": 1793190928,
+ "currency": "usd",
+ "destination_payment_refund": "pyr_1UVW4iCPyuszaKOYT9WXqtRQ",
+ "metadata": {
+ "spree_order_number": "R1001",
+ "spree_seller_transfer_id": "346586704"
+ },
+ "source_refund": null,
+ "transfer": "tr_3UVW4eFmGsiQWfE61ucPczob"
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:29 GMT
+- request:
+ method: get
+ uri: https://api.stripe.com/v1/balance
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Stripe/v1 RubyBindings/18.4.2 Spree Stripe/6.0.0 (https://spreecommerce.org)
+ AIAgent/claude_code
+ Authorization:
+ - Bearer <STRIPE_SECRET_KEY>
+ X-Stripe-Client-Telemetry:
+ - '{"last_request_metrics":{"request_id":"req_QcIRMTEH4YQo3o","request_duration_ms":777}}'
+ Stripe-Version:
+ - '2023-10-16'
+ Stripe-Account:
+ - acct_1UE8TgCPyuszaKOY
+ X-Stripe-Client-User-Agent:
+ - "<FILTERED>"
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx
+ Date:
+ - Wed, 28 Oct 2026 12:35:29 GMT
+ Content-Type:
+ - application/json
+ Content-Length:
+ - '661'
+ Connection:
+ - keep-alive
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Methods:
+ - GET, HEAD, PUT, PATCH, POST, DELETE
+ Access-Control-Allow-Origin:
+ - "*"
+ Access-Control-Expose-Headers:
+ - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
+ X-Stripe-Privileged-Session-Required
+ Access-Control-Max-Age:
+ - '300'
+ Cache-Control:
+ - no-cache, no-store
+ Content-Security-Policy:
+ - base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none';
+ img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src
+ 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm;
+ report-to csp
+ Report-To:
+ - '{"group":"csp","max_age":8640,"endpoints":[{"url":"https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"}],"include_subdomains":true}'
+ Reporting-Endpoints:
+ - csp="https://q.stripe.com/csp-report-v2?q=YumHfcVVvUfHDEArssyfvPFb1gBR_blj_iiHIyI3TAAKUIoXy1vwmeCSJFIoG7CbvJYbAbS8coXQpfSm&t=1"
+ Request-Id:
+ - req_MTfajPw1N461NI
+ Stripe-Account:
+ - acct_1UE8TgCPyuszaKOY
+ Stripe-Notice:
+ - You are using an outdated API version (2023-10-16). We recommend upgrading
+ to the latest API version, 2026-09-30.endive. See https://docs.stripe.com/upgrades
+ Stripe-Version:
+ - '2023-10-16'
+ Vary:
+ - Origin
+ X-Stripe-Priority-Routing-Enabled:
+ - 'true'
+ X-Stripe-Routing-Context-Priority-Tier:
+ - api-testmode
+ X-Wc:
+ - 3c3
+ Strict-Transport-Security:
+ - max-age=63072000; includeSubDomains; preload
+ body:
+ encoding: UTF-8
+ string: |-
+ {
+ "object": "balance",
+ "available": [
+ {
+ "amount": -1025,
+ "currency": "usd",
+ "source_types": {
+ "card": -1025
+ }
+ }
+ ],
+ "instant_available": [
+ {
+ "amount": 0,
+ "currency": "usd",
+ "source_types": {
+ "card": 0
+ }
+ }
+ ],
+ "livemode": false,
+ "pending": [
+ {
+ "amount": 0,
+ "currency": "usd",
+ "source_types": {
+ "card": 0
+ }
+ }
+ ],
+ "refund_and_dispute_prefunding": {
+ "available": [
+ {
+ "amount": 0,
+ "currency": "usd"
+ }
+ ],
+ "pending": [
+ {
+ "amount": 0,
+ "currency": "usd"
+ }
+ ]
+ }
+ }
+ recorded_at: Wed, 28 Oct 2026 12:35:29 GMT
+recorded_with: VCR 6.4.0