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

Меч Moscow · Fashion

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

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

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

Comgate v2

Comgate payment provider for Medusa v2

npm install medusa-payment-comgate-v2
Категория
Платежи
Создано
Radosek
Версия
0.1.2
Последнее обновление
2 дня назад
Ежемесячные загрузки
Загрузка данных
Звезды на Github
0
npmNPMGitHubGithub

medusa-payment-comgate-v2

Comgate payment provider for Medusa v2. Comgate is a Czech payment gateway (cards, Apple Pay / Google Pay, Czech & Slovak bank buttons, Twisto, etc).

Disclaimer: This is an unofficial, community-built integration. It is not affiliated with, endorsed by, or maintained by Comgate Payments, a.s. "Comgate" and the Comgate logo are trademarks of their respective owner, used here only to identify the payment gateway this plugin integrates with.

Comgate API docs | Medusa Payment Module

Features

  • Redirect (background / ) checkout flow.
  • Optional pre-authorization mode (reserve now, capture later).
  • Capture, cancel, refund from the admin dashboard.
  • Background notification (webhook) handling via Medusa's endpoint.

Install

bun add medusa-payment-comgate-v2

Configure

Add the provider to the Payment Module in :

1module.exports = defineConfig({
2 // ...
3 modules: [
4 {
5 resolve: "@medusajs/medusa/payment",
6 options: {
7 providers: [
8 {
9 resolve: "medusa-payment-comgate-v2/providers/comgate",
10 id: "comgate",
11 options: {
12 merchant: process.env.COMGATE_MERCHANT,
13 secret: process.env.COMGATE_SECRET,
14 test: process.env.COMGATE_TEST === "true",
15 // optional:
16 // preauth: false,
17 // lang: "cs",
18 // country: "CZ",
19 // label: "My Store",
20 // method: "ALL",
21 },
22 },
23 ],
24 },
25 },
26 ],
27})

Options

OptionRequiredDefaultDescription
yes—Comgate e-shop identifier.
yes—Password for background communication.
noTest mode.
noCreate pre-authorizations; capture later.
noGateway / e-mail language (ISO 639-1).
noPayer country (ISO 3166-1).
noStatement label, 1–16 chars.
noPayment method, or to let the payer choose.
/ / no—Return URLs. See note below — bake your own order id into them.
noAPI base url (the version prefix is part of each path).

Pre-authorization

To run both a direct-capture and a pre-auth provider, register the module twice with different s and :

1providers: [
2 { resolve: "medusa-payment-comgate-v2/providers/comgate", id: "comgate", options: { /* preauth: false */ } },
3 { resolve: "medusa-payment-comgate-v2/providers/comgate", id: "comgate-preauth", options: { preauth: true } },
4]

The provider id used in the storefront / API is (and ).

How it works

Uses the Comgate REST v2.0 JSON API (, HTTP Basic auth).

  1. → . Returns — send the payer there. The Medusa payment session id is passed as Comgate .
  2. The payer pays on the Comgate gateway.
  3. Webhook → Comgate POSTs a JSON background notification to . constant-time-verifies the echoed , resolves the session by , and maps , , .
  4. → no-op for direct capture (already ); in pre-auth mode.
  5. → . → (storno, PENDING only) or in pre-auth mode.

Per Comgate's spec, order fulfillment must be driven by the background notification, not the payer's browser redirect, since redirect params are user-controlled. Comgate retries the PUSH up to 1000× until it gets a 2xx — Medusa's webhook handling is idempotent.

Comgate authenticates the PUSH by echoing the merchant in the body (no HMAC header). Restrict the webhook to Comgate's IP ranges () as a first layer; the secret check is the second.

Comgate Client Portal setup

In the Client Portal → Integrace → Nastavení obchodů → Přidat propojení obchodu:

Field (CS)Field (EN)Value
HesloPassword→ your
Povolený způsob založení platbyPayment creation methodHTTP POST protokol - backend (recommended)
Url pro předání výsledku platbyBackground result URL (PUSH)
Url zaplacenýPaid redirectstorefront order-confirmation page
Url zrušenýCancelled redirectstorefront cart / retry page
Url nevyřízenýPending redirectstorefront "payment processing" page
Povolené IP adresy / Povolit všechny IPAllowed IPsyour backend's egress IP, or allow-all

The PUSH URL is mandatory — without it payments never confirm in Medusa. The three redirect URLs are browser-facing only and non-authoritative (the payer can forge their params); never mark an order paid from them. Order state is driven solely by the PUSH webhook.

Storefront redirect URLs (Medusa Next.js starter)

The return page must know which order it is. Comgate supports (Comgate transId) and (your reference) placeholders, case-sensitive — but only in the Comgate client-portal return-URL fields, where Comgate substitutes them at redirect time. The API / / request fields are used verbatim (no substitution, no params appended), so if you set the URLs via the API you must bake the identifier in yourself.

Portal (recommended — Comgate substitutes the placeholders):

API options (verbatim — bake in your own id):

is the Medusa payment session id. The return page reads it and looks the order up. The redirect is non-authoritative regardless — the storefront must re-query order/payment status server-side before showing "paid".

Web/Mobile Checkout SDK checkboxes: leave off. This provider uses Comgate's hosted redirect flow, not the embedded checkout SDKs.

Configure the webhook

In the Comgate portal set the background-notification URL ("Url pro předání výsledku platby") to:

Development

1bun install
2bun run build # tsc -> dist
3bun run test # jest unit tests (mocked fetch)

Live smoke test against the Comgate v2.0 test API (no Medusa backend needed):

COMGATE_MERCHANT=xxxx COMGATE_SECRET=xxxx bun run smoke

It creates a test payment and prints the URL — open it and pay with a Comgate test card to see the status flip to . Your IP must be allowed on the shop link (portal → Povolené IP adresy / Povolit všechny IP).

Publishing to npm / Medusa integrations page

This is packaged as a Medusa v2 plugin. To list it for free on the Medusa integrations page, the already includes the required keywords (, , ).

1bun run plugin:build # medusa plugin:build -> .medusa/server
2npm publish # public package

Once published with those keywords, the plugin is picked up automatically by the Medusa integrations listing.

License

MIT

This project is an independent, unofficial integration and is not affiliated with or endorsed by Comgate Payments, a.s. All Comgate trademarks and logos are the property of their respective owner.

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

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

Braintree

От Lambda Curry

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

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

Pay.

От Webbers

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

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

Mollie

От Variable Vic

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

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