Overview
LookTwice
VAT, IBAN and checkout screening
Medusa Plugin: LookTwice (Copy to clipboardmedusa-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 (Copy to clipboard
503/ Copy to clipboardMS_UNAVAILABLE), preventing checkout abandonment. - Audit-Grade Consultation IDs: Stores official VIES request identifiers (Copy to clipboard
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
123pnpm add medusa-plugin-looktwice looktwice-api# ornpm install medusa-plugin-looktwice looktwice-api
Configuration
In your Copy to clipboardmedusa-config.js or Copy to clipboardmedusa-config.ts:
123456789101112131415161718import { 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
1234567891011121314151617181920import { 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 auditreturn res.json({exempt: true,company_name: result.name,company_address: result.address,request_identifier: result.request_identifier,});
2. Screening Products Against CPSC Recalls
1234567891011121314import { 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

