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-plugin-looktwice

v0.1.0

Published

Official Medusa v2 plugin for LookTwice: EU VAT validation, checkout email screening, IBAN checks, and CPSC recall candidate screening.

Readme

Medusa Plugin: LookTwice (medusa-plugin-looktwice)

Official LookTwice integration plugin for Medusa v2.

Add production-grade EU VAT validation (VIES), checkout email screening, IBAN validation, and CPSC product safety recall screening to your Medusa store.


Features

  • EU VAT Validation with Outage Resilience: Live VIES validation that distinguishes invalid VAT numbers from temporary registry outages (503 / MS_UNAVAILABLE), preventing checkout abandonment.
  • Audit-Grade Consultation IDs: Stores official VIES request identifiers (request_identifier) for tax audits.
  • Disposable Email Screening: Detects temporary and burner email domains at customer registration.
  • CPSC Recall Catalog Screening: Automated matching of product titles, brands, models, and UPCs against 9,500+ official CPSC recalls and safety warnings.
  • Zero-Cost Error Semantics: Upstream network failures release reserved credits and cost 0.

Installation

pnpm add medusa-plugin-looktwice looktwice-api
# or
npm install medusa-plugin-looktwice looktwice-api

Configuration

In your medusa-config.js or medusa-config.ts:

import { defineConfig } from "@medusajs/framework/utils";

export default defineConfig({
  projectConfig: {
    // ...
  },
  modules: [
    {
      resolve: "medusa-plugin-looktwice",
      options: {
        apiKey: process.env.LOOKTWICE_API_KEY,
        // Optional settings:
        allowUncheckedVatOnViesOutage: true, // Default: true (doesn't block checkout on VIES downtime)
        blockDisposableEmails: false,        // Default: false
      },
    },
  ],
});

Usage Examples

1. Validating EU VAT Numbers at Checkout

import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
import { LookTwiceService } from "medusa-plugin-looktwice";

export async function POST(req: MedusaRequest, res: MedusaResponse) {
  const looktwice: LookTwiceService = req.scope.resolve("looktwiceService");
  const { country_code, vat_number } = req.body as { country_code: string; vat_number: string };

  const result = await looktwice.validateVat({
    country_code,
    vat_number,
  });

  if (result.valid) {
    // Apply B2B tax exemption and record request_identifier for audit
    return res.json({
      exempt: true,
      company_name: result.name,
      company_address: result.address,
      request_identifier: result.request_identifier,
    });
  }

  if (result.isOutageFallback) {
    // VIES is currently down; allow order but flag for background re-validation
    return res.json({
      exempt: false,
      flagged_for_review: true,
      reason: "VIES service temporarily unavailable",
    });
  }

  return res.status(400).json({
    message: "Invalid VAT number provided",
  });
}

2. Screening Products Against CPSC Recalls

import { LookTwiceService } from "medusa-plugin-looktwice";

export async function screenProduct(looktwice: LookTwiceService, product: { product_name: string; brand?: string; upc?: string }) {
  const match = await looktwice.screenProductRecall({
    product_name: product.product_name,
    brand: product.brand,
    upc: product.upc,
  });

  if (match.match_level === "exact" || match.match_level === "likely") {
    console.warn(`[RECALL ALERT] Product matches recall ${match.candidates[0].recall_number}: ${match.candidates[0].title}`);
    // Take safety action: unpublish product or flag inventory
  }
}

License

MIT © LookTwice