Integration Module 2.0 for Medusa is outRead the announcement
S

Stripe

Read-only Stripe insights for Medusa v2, next to the official Stripe payment provider: turnover, fees, payouts with their orders, disputes, payment details on every order and configuration checks with fixes. A GET-only client with an allow-list of paths;

npm install @bitshaft/medusa-plugin-stripe
Category
Built by
Version
0.1.0
Last updated
3 days ago
Monthly downloads
Loading downloads

Stripe insights for Medusa v2

· Polska wersja

Stripe data in the Medusa admin, next to the official Stripe payment provider: turnover, fees and net per currency, payment success by method, payments with their orders (and paid payments that never became an order), payouts broken down into the orders they pay out, open disputes with deadlines, and configuration checks that say how to fix what is wrong.

Read-only, enforced in code. The plugin's Stripe client has one method (GET) and an allow-list of paths; anything else throws before a request is sent. No code path can capture, refund or pay out. Payments and refunds stay with .

Install with an AI assistant

Paste this into Claude Code, Cursor or another coding assistant, in your Medusa backend project:

Installation

  1. Install:

  2. Add it to (keep the official provider as it is):

  3. Create a restricted key (below), put it in , restart Medusa and open Stripe → Settings in the admin: the checks are at the top.

No migrations: the plugin stores nothing.

Options

OptionDefault
—Stripe key, preferably restricted (). Required unless . Use an environment variable
Sample data on every tab and no request to Stripe at all
The of the official provider in medusa-config (registered as )
—Public backend URL for the webhook check; defaults to or
Domains checked for Apple Pay and Google Pay
How long Stripe answers are reused
—Expected key mode, or . Without it: live when , else test (staging: set it to test)
A paid payment without an order is flagged only after this many minutes (raise it for delayed methods or slow webhooks)

Without a key (and without ) the plugin stays disabled and logs one line (); Medusa starts normally and the admin page shows Settings (with the checks) and the Guide. A wrong key is a failed check, not an error.

Key permissions

Use a restricted key, not the full secret key. The checks on the Settings tab warn when an key is used. Set Read on:

Stripe resourceUsed for
Balancebalance, key check
Balance transactionsturnover, fees, net, payout contents
Payoutspayouts, next payout
Disputesdisputes
PaymentIntentspayments, order widget, capture mode check
Charges (and Refunds)method, decline reason, Radar, 3D Secure
Eventsfailed webhook deliveries of the last day
Webhook Endpointswebhook check
Payment Method DomainsApple Pay and Google Pay domains check
Payment Method Configurationspayment methods check
Accountaccount check (charges and payouts enabled)

Everything else: None. A missing permission shows as a warning on the check that needs it ("no permission"), not as an error.

The key is used only in the header, is masked in logs and error messages, and is never returned by the admin API: the admin sees only its kind (/), mode (live/test) and last four characters.

Allowed Stripe paths

The client refuses any method other than GET and any path not listed here ( is letters, digits and only):

How it works

  • On demand only. Stripe is read when someone opens a tab or presses Refresh. Nothing runs in the background.
  • Cache and request sharing. Answers are reused for . While a request is running, other admins asking for the same data wait for it: several admins at once cause one request to Stripe. Refresh clears the cache.
  • Time budget. One page has 25 seconds. Parts that did not finish are left out and the page says the data is incomplete.
  • List limit. At most 1000 items per list. When a list is cut, every total built from it says so ("sum of the first 1000 items, incomplete"), and CSV exports start with a warning row.
  • Money. Amounts stay integers in the smallest unit (grosze), as Stripe sends them. Totals are kept per currency and never added across currencies. They are formatted only in the admin ().
  • Orders. The official provider stores the Medusa payment session id in the PaymentIntent's metadata (); the plugin follows session → payment collection → order. As a fallback it matches Medusa payments whose data holds the PaymentIntent id. A paid or authorised payment with no order, older than , is shown in red.
  • No tables. The plugin has a module (for options and the cache) but no data models and no migrations.

Admin

Stripe in the main menu:

  • Overview (7 or 30 days): turnover, Stripe fees, net, refunds, payment success (successful / all attempts), open disputes, balance (available and pending), next payout, and a table by method (cards, BLIK, Przelewy24, Apple Pay, Google Pay, other).
  • Payments: method, status, decline reason, Radar risk, amount, fee, net, links to the Medusa order and to Stripe; paid payments without an order in red. Filters: period, method, status, currency. CSV export.
  • Payouts: date and amount; a payout opens the payments, refunds and fees in it, with their orders, and items without an order flagged. CSV export for accounting.
  • Disputes: open disputes with amount, reason, evidence deadline, days left, urgency (under 3 days), links to the order and to the dispute in Stripe (where you respond).
  • Settings: the checks, OK / warning / error, each with how to fix it: provider registered as ; key present, valid and restricted; account active with payments and payouts; payment methods on (cards, BLIK, Przelewy24, Apple Pay, Google Pay); the provider's webhook points at the backend with no failed deliveries in a day; storefront domains registered for Apple Pay and Google Pay; capture mode matches the provider's setting; test/live matches the expected mode.
  • Guide: setup from the restricted key to the first test payment.

An order widget shows the PaymentIntent behind the order: status, method (e.g. , ), amount, fee, net, exchange rate (when converted), 3D Secure, Radar risk, refunds, disputes, the payout that contains the money and a link to Stripe. After a capture or refund in Medusa the cached answer for that PaymentIntent is dropped and the widget reads Stripe again.

The admin is in Polish and English and follows the light and dark theme.

Admin API

All under , for signed-in admin users. Amounts are integers in minor units; totals are objects keyed by currency. Lists carry , and when data is incomplete.

Route
Enabled, demo, key kind/mode/last4, options
Totals, success rate, balance, payouts, by method
Payments with orders; flag
Payouts
Payout contents with orders; flag
Open disputes, nearest deadline first
Configuration checks
Stripe data of an order's payments
Clears the cache (does not call Stripe)

Every also takes to skip the cache.

Limitations

  • One Stripe account and one key. Stripe Connect (connected accounts) is not supported.
  • At most 1000 items per list and 25 seconds per page; longer periods show incomplete data, clearly marked.
  • Payout contents are listed by Stripe only for automatic payouts.
  • The payout of an order is found among the first three automatic payouts after the money became available.
  • "Payment success" counts charges (attempts); a PaymentIntent with no charge attempt is not counted.
  • The capture mode check compares the last 20 PaymentIntents with the provider's option; another app on the same Stripe account can make it warn.
  • Failed webhook deliveries come from Stripe events that were not delivered to some endpoint; they are not split per endpoint.
  • The cache is per server process.

Testing

npm run check

Stripe is mocked in the tests: the GET-only client and its allow-list, key masking, integer totals per currency, mapping payments to orders and spotting payments without an order, every check (OK, warning, error), the cache and request sharing, the time budget, startup without a key, and demo mode making no requests.

License

MIT © Bitshaft. Stripe is a trademark of Stripe, Inc.