Paytrail payment provider plugin for Medusa
Paytrail payment provider plugin for Medusa.
This package is published to NPM as .
Add the package to your Medusa backend:
yarn add @solteq-excom/medusa-payment-paytrailRegister the plugin and payment provider in your :
1plugins: [2 {3 resolve: "@solteq-excom/medusa-payment-paytrail",4 options: {},5 },6],7modules: [8 {9 resolve: "@medusajs/medusa/payment",10 options: {11 providers: [12 {13 resolve: "@solteq-excom/medusa-payment-paytrail/providers/paytrail",14 id: "paytrail",15 options: {16 merchantId: Number(process.env.PAYTRAIL_MERCHANT_ID),17 secretKey: process.env.PAYTRAIL_SECRET_KEY,18 platformName: process.env.PAYTRAIL_PLATFORM_NAME ?? "MedusaJS",19 callbackBaseUrl: process.env.PAYTRAIL_CALLBACK_BASE_URL,20 callbackDelay: process.env.PAYTRAIL_CALLBACK_DELAY21 ? Number(process.env.PAYTRAIL_CALLBACK_DELAY)22 : undefined,23 redirectUrlHostWhitelist: (process.env.PAYTRAIL_REDIRECT_URL_HOST_WHITELIST ?? "")24 .split(",")25 .map((value) => value.trim())26 .filter(Boolean),27 language: process.env.PAYTRAIL_LANGUAGE ?? "EN",28 },29 },30 ],31 },32 },33]Required and supported environment variables:
Example:
1PAYTRAIL_MERCHANT_ID=3759172PAYTRAIL_SECRET_KEY=SAIPPUAKAUPPIAS3PAYTRAIL_PLATFORM_NAME=MedusaJS4PAYTRAIL_CALLBACK_BASE_URL=https://your-backend.example.com5PAYTRAIL_CALLBACK_DELAY=06PAYTRAIL_REDIRECT_URL_HOST_WHITELIST=localhost:8888,store.example.com7PAYTRAIL_LANGUAGE=ENIf is set, the provider sends Paytrail automatically as:
maps to Paytrail (seconds). According to Paytrail, when callback URLs are provided, callback delay can be to seconds and defaults to .
Paytrail requires HTTPS callback URLs for both success and cancel callbacks. Example uses Paytrail test credentials
When creating payment sessions, and must use or , include only host/path (no query/hash/auth), and the host must match .
The plugin exposes for Paytrail redirect and callback handling.
The route forwards callback payloads into Medusa's payment webhook pipeline by emitting after validating the signature.
Bug reports and feature requests are welcome.
When submitting an issue, include:
When submitting a pull request:
This package is provided as-is, without warranty of any kind. You are responsible for validating the integration, security, and compliance requirements before using it in production.