Sign In

@ar-agents/agentic-commerce-bridge

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ar-agents/agentic-commerce-bridge

Open-source merchant facilitator for the Agentic Commerce Protocol (ACP) bridging ChatGPT, Claude, Gemini, and other agentic-commerce clients to MercadoLibre and MercadoPago. ACP-compliant checkout sessions, signed webhooks, /.well-known/acp.json discover

latest
Source
npmnpm
Version
10.0.0
Version published
Weekly downloads
25
31.58%
Maintainers
1
Weekly downloads
 
Created
Source

@ar-agents/agentic-commerce-bridge

The first open-source merchant facilitator for the Agentic Commerce Protocol (ACP) in LATAM. Bridges ChatGPT Instant Checkout, Claude, Gemini, and other agentic-commerce clients to MercadoPago + MercadoLibre, with AR-fiscal compliance (auto-issued AFIP/ARCA Factura A/B/C/E) baked in.

CI npm license tests

pnpm add @ar-agents/agentic-commerce-bridge zod

What it is

ACP, maintained by OpenAI + Stripe, defines how AI agents talk to merchants on behalf of users: discover products, build a cart, finalize a checkout, settle payment, and confirm fulfillment — all over a small REST surface (5 endpoints + /.well-known/acp.json discovery) with HMAC-signed webhooks.

Today, when ChatGPT or Claude wants to buy something from a LATAM seller, there is no on-ramp: MercadoLibre and MercadoPago don't ship ACP endpoints; the official MELI/MP MCP servers expose only documentation search. This package fills that gap. It's a drop-in facilitator that:

  • Implements all 5 ACP 2026-04-17 endpoints + discovery
  • Signs and verifies webhooks per spec (HMAC-SHA256, Merchant-Signature)
  • Enforces idempotency (Idempotency-Key, replay detection, conflict)
  • Negotiates ACP versions (rejects unsupported, surfaces supported_versions)
  • Plugs into MercadoPago checkout (preference creation + payment lookup
    • webhook bridge)
  • Plugs into MercadoLibre catalog (item lookup + UCP-style feed)
  • Auto-issues AR-fiscal Factura A/B/C/E via AFIP WSFE on order confirmation, embedding the CAE in the order metadata
  • Runs on Edge Runtime (WebCrypto-only, no Node-only imports)
  • Pluggable state adapter — InMemoryStateAdapter for dev, VercelKVStateAdapter for production, BYO for anything else

Why now

StandardStatus (2026-05)LATAM coverage
ACP (OpenAI + Stripe)Production at ChatGPT Instant CheckoutNone
UCP (Google + Shopify + Amazon + Microsoft + Stripe)NRF 2026 launchNone
AP2 (Google → FIDO Alliance)v0.2 + FIDO donation Apr 2026None
Visa Trusted Agent ProtocolPilots in AR/BR/CL/MX/UYMercadoPago absent
Mastercard Agent Pay LATAMLive transactions Mar 2026MercadoPago absent
x402 (Coinbase + Stripe + Cloudflare)169M txnsNone

When ChatGPT Shopping expands into LATAM (Q3-Q4 2026 per OpenAI partner trajectory), MELI sellers without an ACP bridge will be invisible to agent-driven commerce. Stripe is positioning to ship LATAM ACP in 12-18 months; this package gives you a head start, on open-source terms.

Quickstart

import {
  createFacilitator,
  InMemoryStateAdapter,
  createMercadoPagoPaymentProvider,
  mercadoPagoPaymentHandler,
  createMeliCatalogProvider,
  createFacturacionHook,
} from "@ar-agents/agentic-commerce-bridge";
// You bring your own MELI + MP + AFIP clients (or use ar-agents siblings):
import { mlClient } from "./meli-client";
import { mpClient } from "./mp-client";
import { wsfeClient, arcaPadron } from "./afip-client";

const mp = createMercadoPagoPaymentProvider({
  createPreference: (p) => mpClient.preferences.create({ body: p }),
  lookupPayment:    (id) => mpClient.payments.get({ id }),
});

const facilitator = createFacilitator({
  state: new InMemoryStateAdapter(),
  catalog: createMeliCatalogProvider({
    getItem: (id) => mlClient.items.get(id),
  }),
  paymentProviders: { [mp.handlerId]: mp },
  paymentHandlers: [mercadoPagoPaymentHandler({})],
  webhookSecret: process.env.ACP_WEBHOOK_SECRET,
  hooks: createFacturacionHook({
    seller: {
      cuit: "20123456786",
      punto_venta: 1,
      regime: "monotributo",
      legal_name: "Naza Clemente",
    },
    wsfe: wsfeClient,
    arcaPadronLookup: arcaPadron.lookup,
  }),
});

// Next.js App Router catch-all route:
//   app/api/acp/[...slug]/route.ts
export async function POST(req: Request, ctx: { params: { slug: string[] } }) {
  const acpResponse = await facilitator.dispatch({
    method: "POST",
    path: "/" + ctx.params.slug.join("/"),
    headers: Object.fromEntries(req.headers.entries()),
    rawBody: await req.text(),
  });
  return new Response(JSON.stringify(acpResponse.body), {
    status: acpResponse.status,
    headers: acpResponse.headers,
  });
}

That's it. Your store is now ACP-discoverable from any agent that follows the spec. ChatGPT, Claude, Gemini, Walmart Sparky, Microsoft Copilot, and any Vercel AI SDK agent can transact against you.

What ships

ModulePurpose
schemas/*Zod schemas for every ACP 2026-04-17 shape — CheckoutSession, LineItem, Buyer, Address, FulfillmentOption (4 variants), PaymentData, Order, Cart, Capabilities, Discount, Webhook, Error
webhooksignWebhook / verifyWebhook — HMAC-SHA256, Merchant-Signature: t=<unix>,v1=<64hex>, 300s tolerance per spec
idempotencyIdempotency-Key validation + body-hash + state interface
stateInMemoryStateAdapter (dev) + StateAdapter interface
vercel-kv (subpath)VercelKVStateAdapter — Redis-shape adapter (Vercel KV / Upstash / ioredis duck-typed)
versionAPI version negotiation (API-Version header)
handlers/*The 5 ACP endpoint handlers + discovery + dispatcher + facilitator factory
integrations/mpcreateMercadoPagoPaymentProvider + sessionToPreferencePayload + payment-handler declaration
integrations/mp-webhookparseMpPaymentIdFromWebhook, mpStatusToAcpOrderStatus, buildAcpEventFromMpWebhook — translate MP notifications → ACP webhooks
integrations/melicreateMeliCatalogProvider + buildMeliFeed (UCP-compatible) + meliItemToFeedProduct
integrations/facturacioncreateFacturacionHook — auto-emit Factura A/B/C/E via AFIP WSFE on order confirmation
totalsbuildLineItemTotals, buildOrderTotals, helpers for fulfillment + tax + discount rollups
idsgenerateSessionId, generateOrderId, generateCartId (UUID-backed)

ACP endpoints implemented

MethodPathStatus
POST/checkout_sessions
POST/checkout_sessions/{id}✅ (update)
GET/checkout_sessions/{id}
POST/checkout_sessions/{id}/complete
POST/checkout_sessions/{id}/cancel
GET/.well-known/acp.json✅ (discovery, RFC 8615)

Per-spec features:

  • Idempotency-Key mandatory on POSTs, replay detection (Idempotent-Replayed: "true"), in-flight (409 + Retry-After), and body-hash conflict (422 idempotency_conflict).
  • API-Version header negotiation; rejects unsupported with supported_versions echo.
  • Cached responses for replay across restarts (when using VercelKVStateAdapter).
  • Catalog / payment / fulfillment hooks — fully framework-agnostic.

AR-fiscal compliance — the moat

createFacturacionHook is the unique-to-LATAM piece. When an ACP order completes:

  • The buyer's IVA condition is resolved either explicitly (host-supplied resolveBuyer) or automatically via ARCA padrón lookup (@ar-agents/identity's ws_sr_constancia_inscripcion).

  • The factura type is selected from a normative matrix:

    Seller regimeBuyer conditionFactura
    monotributoanyC
    responsable_inscriptoresponsable_inscripto / monotributistaA
    responsable_inscriptoconsumidor_final / otherB
    anyextranjero (cross-border)E
  • WSFE solicitarCAE is invoked with the correct totals + IVA breakdown (21% default for RI, 0% for monotributo Factura C).

  • The CAE, vencimiento, número, and IVA breakdown are embedded in Order.metadata:

    {
      "factura_type": "C",
      "factura_cae": "70123456789012",
      "factura_cae_vencimiento": "20260520",
      "factura_numero": 42,
      "factura_punto_venta": 1,
      "factura_cuit_emisor": "20123456786",
      "factura_importe_total": 1210,
      "factura_importe_iva": 0,
      "factura_importe_neto": 1210
    }
    
  • If WSFE rejects or padron lookup fails, the order still persists (payment was already authorized) — the error is captured in metadata.factura_error so the seller can re-emit out-of-band.

No competitor in the LATAM ACP/UCP/AP2 space ships this. Stripe Tax doesn't cover Argentine fiscal nuance and won't.

How it compares

This packageStripe ACPShopify Storefront ACPMELI/MP MCP (official)
ACP 2026-04-17 schemaspartialn/a (docs-only)
Hosted-agent on Edge Runtimen/a
Webhook HMAC + replay protectionn/a
MercadoPago bridgepartial
MercadoLibre catalogpartial
AR-fiscal Factura A/B/C/E
Argentine padrón lookup✅ (via @ar-agents/identity)
MIT, open source✅ (since Apr 2026)partial✅ (docs only)

Hosting

Works in:

  • Vercel (Edge or Node runtime) — pair with VercelKVStateAdapter for state
  • Cloudflare Workers — pair with KV / Upstash Redis
  • Deno Deploy / Bun
  • Node 20+ (HTTP server, Express, Hono, Fastify, Next.js)

WebCrypto-only (no node:crypto imports). The bundle is < 30KB gzip.

Phase 2 (planned)

  • AP2 mandate verifier/signer — ES256 SD-JWT VC, mandate chains (~~-separated), constraint evaluation (payment.amount_range, checkout.allowed_merchants, payment.budget), receipts (Checkout + Payment) signed per FIDO Alliance Agentic Auth WG profile.
  • MELI Q&A + claims tools as ACP extension types — agent-driven pre-sale answer-fetch + post-sale evidence upload.
  • PIX / Transferencias 3.0 / SPEI bridges — AP2 mandates settling to LATAM bank rails when card networks aren't the right fit.

Tests

pnpm test          # 160 tests across schemas, webhook, idempotency, state,
                   # version, handlers, MP, MELI, facturacion, vercel-kv
pnpm test:coverage # full coverage report
pnpm typecheck     # strict TS, no `any`, exactOptionalPropertyTypes

Specs we follow

License

MIT. Built by Naza Clemente / Hello Astro for the LATAM agent ecosystem.

Keywords

agentic-commerce

FAQs

Package last updated on 03 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts