Платёжный провайдер SumUp для Medusa v2
A SumUp payment provider plugin for Medusa V2. Inspired by https://github.com/VariableVic/mollie-payments-medusa and mostly implemented by Claude.
[!WARNING] This plugin has not been tested on a live store. Please conduct thorough testing before using it in a production environment. I am not responsible for any missed or failed payments resulting from the use of this plugin. If you encounter any issues, please report them here.
[!NOTE] You can find your API key and merchant code in your SumUp Dashboard under Settings → Developer → API Keys.
Add the provider to the module in your file:
| Option | Description | Required | Default |
|---|---|---|---|
| Your SumUp API key (e.g. ) | ✅ | — | |
| Your SumUp merchant code (e.g. ) | ✅ | — | |
| The public URL of your Medusa backend | ✅ | — | |
| The default storefront URL to redirect the customer to after payment. Must be a valid / URL. | ✅ | — | |
| Extra hostnames permitted when a payment session supplies its own . The host of is always allowed. Any override on a non-allowed host is rejected (open-redirect protection). | ❌ | ||
| Enable verbose debug logging | ❌ |
A payment session may override the redirect target by passing (e.g. a locale-specific ). The override is accepted only when its host is the same as 's host or appears in , and its scheme is /; otherwise the checkout is rejected with . When omitted, is used.
[!IMPORTANT] The storefront's own origin must be an allowed redirect host. A typical storefront sends ${location.origin}/${countryCode}/checkout/complete`redirectUrlredirectUrlAllowedHosts`, session creation fails and customers cannot pay.
This bites most often when the backend env and the storefront domain drift apart between environments (e.g. a or preview deploy, or a separate admin vs. storefront domain). Whenever you add a storefront origin, add it to . Example:
Add the following to your file:
Once installed and configured, the SumUp payment method will be available in your Medusa Admin. To enable it:
The provider ID for the SumUp checkout is:
pp_sumup_sumupSumUp checkouts are created server-side by Medusa. After a payment session is initiated, the session data will contain a SumUp checkout that you pass to the SumUp Card Widget on your storefront to render the payment form.
Basic flow:
Example Card Widget integration:
For APMs (iDEAL, Bancontact, etc.), the option handles the post-payment redirect automatically.
MIT
1npm install medusa-payment-sumup2# or3yarn add medusa-payment-sumup1modules: [2 // ... other modules3 {4 resolve: "@medusajs/payment",5 options: {6 providers: [7 // ... other providers8 {9 resolve: "medusa-payment-sumup/providers/sumup",10 id: "sumup",11 options: {12 apiKey: process.env.SUMUP_API_KEY,13 merchantCode: process.env.SUMUP_MERCHANT_CODE,14 medusaUrl: process.env.MEDUSA_BACKEND_URL,15 redirectUrl: process.env.SUMUP_REDIRECT_URL,16 },17 },18 ],19 },20 },21]1options: {2 redirectUrl: "https://shop.example.com/checkout/complete",3 redirectUrlAllowedHosts: [4 "shop.example.com",5 "staging.shop.example.com",6 "my-preview.sslip.io",7 ],8}1SUMUP_API_KEY=sup_sk_your_api_key2SUMUP_MERCHANT_CODE=YOUR_MERCHANT_CODE3MEDUSA_BACKEND_URL=https://your-medusa-server.com4SUMUP_REDIRECT_URL=https://your-store.com/checkout/payment1<script src="https://gateway.sumup.com/gateway/ecom/card/v2/sdk.js"></script>2<div id="sumup-card"></div>3
4<script>5 SumUpCard.mount({6 checkoutId: "<checkout-id-from-session-data>",7 onResponse: function (type, body) {8 if (type === "success") {9 // Redirect or poll for order completion10 }11 },12 });13</script>