npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

medusa-tpay

v1.0.0

Published

Medusa tpay Payment Provider

Readme

Compatibility

This plugin is compatible with Medusa v2.4.0+.

Overview

This plugin provides Tpay payment integration for Medusa commerce platform.

Installation

npm install medusa-tpay
# or
yarn add medusa-tpay

Configuration

Add the payment provider configuration to your medusa-config.ts:

modules: [
  // ... other modules ...
  {
    resolve: "@medusajs/medusa/payment",
    options: {
      providers: [
        {
          resolve: 'medusa-tpay/providers/tpay',
          options: {
            clientId: process.env.TPAY_CLIENT_ID,
            clientSecret: process.env.TPAY_CLIENT_SECRET,
            merchantId: process.env.TPAY_MERCHANT_ID,
            sandbox: process.env.TPAY_SANDBOX === 'true',
            returnUrl: process.env.TPAY_RETURN_URL,
            
            // By default, this should be your backend's base URL + /hooks/payment/tpay (e.g. https://example.com/hooks/payment/tpay)
            callbackUrl: process.env.TPAY_CALLBACK_URL || `${process.env.APP_BASE_URL}/hooks/payment/tpay`,
            
            title: "Payment for order", // Optional
            refundDescription: "Refund", // Optional
          },
        },
      ],
    }
  }
]

Usage

Overview

Once configured, Tpay will be available as a payment provider in your Medusa store. The plugin integrates seamlessly with Medusa's payment workflow to handle the complete payment lifecycle.

Required Data

The following data is required from your checkout flow and needs to be provided in the initiatePaymentSession call in order to create a tpay transaction:

const tpayData = {
  customer_name: string;
  email: string;
}

Payment Flow

When a customer selects Tpay as their payment method during checkout, the plugin creates a new transaction with Tpay and returns a payment URL.

  1. Redirect: Redirect the customer to the provided Tpay payment URL to let them complete the payment on tpay's pay-by-link page.

  2. Payment Processing: After completing or canceling the payment, the customer is redirected back to your store via the configured values.

  3. Webhook Notification: Tpay sends a webhook notification to your configured callbackUrl endpoint to confirm the payment status. The plugin automatically validates and processes these webhooks.

  4. Order Completion: Based on the webhook data, Medusa updates the payment and order status accordingly.

Webhook Configuration

The webhook endpoint is automatically registered at /hooks/payment/tpay. Ensure that:

  • Your callbackUrl points to this endpoint (e.g., https://yourdomain.com/hooks/payment/tpay)
  • The endpoint is publicly accessible
  • Your firewall allows incoming requests from tpay's servers

Refunds

Refunds can be processed through Medusa's admin panel or API. The plugin will:

  • Create a refund request with Tpay Process partial or full refunds
  • Update the order status in Medusa accordingly

You can customize the refund description using the refundDescription option in the plugin configuration.