The production-ready Medusa DTC Starter is outRead the announcement
Paytrail logo

Paytrail

Paytrail payment provider plugin for Medusa

VerifiedVersion 2.2.1 on Medusa 2.22.2, Oct 30, 2026
npm install @solteq-excom/medusa-payment-paytrail
Category
Built by
Regions
Service
Version
2.2.1
Last updated
1 month ago
Monthly downloads
Loading downloads

Paytrail Payment Provider Plugin

Paytrail payment provider plugin for Medusa v2.

This package is published to NPM as .

Install

Add the package to your Medusa backend:

Register the plugin and payment provider in your :

Configuration

Required and supported environment variables:

  • (optional)
  • (recommended, must use HTTPS)
  • (optional, seconds, 0-900, default )
  • (required, comma-separated values; wildcard supported)
  • (, , or )

Example:

If is set, the provider sends Paytrail automatically as:

  • success:
  • cancel:

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 .

supports wildcard host patterns with , for example:

Features

  • Payment session initiation via Paytrail API
  • Payment status check for authorization flow
  • Refund support
  • Callback action parsing and HMAC signature verification
  • Custom GET callback route for Paytrail redirect and callback query params

Callback Route

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.

Behavior

  • Currency support is limited to by Paytrail.
  • Payment sessions are created in status until Paytrail authorizes them.
  • Cart completion fails before third-party authorization.
  • Standard Paytrail flow is treated as auto-captured after authorization.

Payment Flow

  1. Store creates a payment session with provider .
  2. Paytrail returns a redirect URL and .
  3. Customer authorizes the payment in Paytrail checkout.
  4. Callback updates the payment status to authorized or captured.
  5. Cart completion succeeds after authorization.

Troubleshooting

No payment providers available in store

  • Ensure the Paytrail provider is linked to the region.

Cart completion returns 400 not authorized

  • This is expected before the Paytrail authorization callback is processed.
  • Complete the payment in Paytrail before completing the cart.

Callback is not triggered

  • Verify is configured with an HTTPS URL.
  • Paytrail requires HTTPS callback URLs for both success and cancel callbacks.

Contributing

Bug reports and feature requests are welcome.

When submitting an issue, include:

  • A clear description of the problem or requested change
  • Steps to reproduce, if applicable
  • Relevant configuration details, logs, or screenshots

When submitting a pull request:

  • Open an issue first for larger changes so the approach can be discussed
  • Keep the PR focused on a single fix or feature
  • Include tests or updates to existing tests when behavior changes
  • Update the README or other documentation if the public behavior changes

Disclaimer

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.

References