• Модуль интеграций
  • Сообщество
  • Блог
Документация
Плагины и интеграцииВсе расширения для Medusa от сообществаСтартерыЗапускайте проекты быстрее с готовыми решениями
ЭкспертыПодберите специалиста для разработки и развития вашего проекта на MedusaКейсыПосмотрите примеры Medusa в продакшене и успешные внедрения
Меч Moscow
Комплексная e-commerce платформа на Medusa для московского fashion-бренда

Меч Moscow · Fashion

Gorgo снижает затраты на адаптацию Medusa к локальным рынкам.

Мы разрабатываем плагины интеграции, осуществляем поддержку и развиваем сообщество разработчиков на Medusa в Telegram.

  • Ресурсы Medusa
  • Плагины и интеграции
  • Стартеры
  • Эксперты
  • Кейсы
  • Medusa Чат в Telegram
  • Medusa Новости в Telegram
  • Документация Gorgo
  • Связаться с нами
  • TelegramGitHub
Плагины
P

Plugin

zahls.ch payment provider for Medusa v2 (TWINT, cards, PostFinance).

npm install @zahls/medusa-plugin
Категория
Платежи
Создано
Zahls
Версия
0.0.1
Последнее обновление
4 дня назад
Ежемесячные загрузки
Загрузка данных
Звезды на Github
1
npmNPMGitHubGithub

@zahls/medusa-plugin

zahls.ch payment provider for Medusa v2.

This plugin lets a Medusa application create and manage zahls.ch Gateway checkouts from the backend. It supports:

  • Hosted checkout, where the customer is redirected to the zahls.ch payment page ()
  • Swiss payment methods such as TWINT, cards, and PostFinance
  • Captures for authorized / reserved transactions
  • Refunds through zahls.ch transactions
  • Medusa's built-in payment webhook route for asynchronous status updates, with optional HMAC signature verification

The plugin never handles raw card data directly. zahls.ch credentials remain on the Medusa backend.

Compatibility

  • Medusa v2.18.x
  • zahls.ch Gateway API

Install

npm install @zahls/medusa-plugin

Configure Medusa

Register the plugin and payment provider in :

1import { defineConfig } from "@medusajs/framework/utils"
2
3export default defineConfig({
4 plugins: [
5 {
6 resolve: "@zahls/medusa-plugin",
7 options: {},
8 },
9 ],
10 modules: [
11 {
12 resolve: "@medusajs/medusa/payment",
13 options: {
14 providers: [
15 {
16 resolve: "@zahls/medusa-plugin/providers/zahls",
17 id: "zahls",
18 options: {
19 apiKey: process.env.ZAHLS_API_KEY,
20 instance: process.env.ZAHLS_INSTANCE,
21 webhookSecret: process.env.ZAHLS_WEBHOOK_SECRET,
22 successRedirectUrl: process.env.ZAHLS_SUCCESS_URL,
23 failedRedirectUrl: process.env.ZAHLS_FAILED_URL,
24 cancelRedirectUrl: process.env.ZAHLS_CANCEL_URL,
25 },
26 },
27 ],
28 },
29 },
30 ],
31})

After the application starts, enable zahls.ch for the relevant region in Medusa Admin → Settings → Regions. Per Medusa's payment-provider model, the resulting provider identifier is when the service identifier is and the configured provider is .

Configuration Options

OptionRequiredDescription
YesInstance API secret from zahls.ch → API & Integrations. Keep it server-side.
YesInstance name ( for ).
YesSigning key for verification. Webhooks are rejected without it.
NoStorefront URL after a successful payment.
NoStorefront URL after a failed payment.
NoStorefront URL after the customer cancels.
NoSkip the zahls.ch result page (default ).

Auth uses the header (recommended by the zahls.ch / Payrexx REST API).

Hosted Checkout

The plugin creates a zahls.ch Gateway and stores the returned checkout in the payment-session data. The storefront should redirect the customer to that URL:

1const link = paymentSession.data?.link
2if (typeof link === "string") {
3 window.location.href = link
4}

Use backend / webhook state as the source of truth. The storefront should not treat the redirect alone as proof of payment success.

When available, customer name, email, company, and billing address from the Medusa payment context are prefilled on the Gateway.

Webhooks

Medusa provides a built-in webhook listener route for payment providers at:

/hooks/payment/[identifier]_[provider]

For this plugin, with service identifier and provider , add this URL in the zahls.ch merchant backend (Webhooks), with JSON content type:

https://your-medusa-backend.com/hooks/payment/zahls_zahls

The plugin verifies when is set, loads the Gateway from zahls.ch, maps the status to a Medusa payment action, and returns the payment session reference () back to Medusa.

zahls.ch statusMedusa webhook action
/
/

on the Gateway is set to the Medusa payment session id so webhooks can resolve the session.

What the Plugin Stores

The payment-session data returned by the provider includes:

  • — zahls.ch Gateway id
  • — hosted checkout URL
  • — Medusa payment session id
  • and
  • when available
  • after a refund

Current Behavior and Limitations

  • Checkout is hosted-redirect only. There is no embedded card widget mode.
  • checks the remote zahls.ch Gateway status rather than performing a separate authorization step.
  • succeeds immediately when the Gateway is already . For / / , it calls zahls.ch capture (and falls back to charge if needed).
  • recreates the Gateway when amount or currency changes before payment.
  • Refunds require a successful zahls.ch transaction id on the session.
  • is required; unsigned webhooks are rejected.

Sandbox Checklist

  • Create a Gateway and complete one successful hosted checkout (e.g. TWINT or card).
  • Confirm the storefront redirect to works.
  • Verify at least one webhook-driven status update to Medusa.
  • Verify rejection when the secret is wrong.
  • Capture an authorized / reserved payment if your zahls.ch flow supports it.
  • Verify one full refund and one partial refund.
  • Verify canceled and failed checkouts map cleanly back into Medusa session state.

Local Development

1npm run build
2npm run dev
1npm run test:unit
2npm run test:integration:modules

Module integration tests need PostgreSQL (, , , ). Defaults: , user .

Publish locally with , then in a Medusa app:

npx medusa plugin:add @zahls/medusa-plugin

License

MIT

Еще в этой категории

Посмотреть все
Платежи
Braintree logo

Braintree

От Lambda Curry

Поддержка платежей и 3D Secure через Braintree

Загрузка данных
GitHubnpm
Платежи
Pay. logo

Pay.

От Webbers

Принимайте кредитные карты, цифровые платежи и купи сейчас — плати потом

Загрузка данных
GitHubnpm
Платежи
Mollie logo

Mollie

От Variable Vic

Легко принимайте мультивалютные платежи через Mollie

Загрузка данных
GitHubnpm