@enruta/psp
v0.1.0
Published
Merchant-side PSP adapters for agent orders: write Enruta labels (agent, mandate, policy, record) into the PSP's payment metadata, refund, list disputes, submit evidence, parse signed webhooks, read fees; plus dispute-packet delivery clients. Stripe, Adye
Maintainers
Readme
@enruta/psp
Merchant-side PSP adapters for agent orders. When an AI agent buys from you under an Enruta mandate, these adapters write the agent's labels (agent, mandate, policy version, sealed record) into your own PSP's payment, refund on your own account, list disputes, submit evidence and parse your PSP's signed webhooks. Enruta never holds the money and you keep your PSP and your merchant of record.
fetch and WebCrypto only, no dependencies: Cloudflare Workers, Vercel Edge, Deno and Node 22.
npm i @enruta/psp| PSP | Labels on an existing payment | Refund | Disputes | Evidence | Webhooks | Fees | |---|---|---|---|---|---|---| | Stripe | metadata | yes | yes | yes | yes | yes | | Adyen | at payment creation only | yes | daily dispute report | yes | yes | — | | Checkout.com | at payment creation only | yes | yes | yes | yes | yes | | Braintree | yes | refund or void | yes | yes | yes | — | | PayPal | before capture | yes | yes | yes | yes | yes | | Worldpay | at payment creation only | yes | Disputes API (token from Worldpay) | yes | yes | — |
import { adapterFor } from "@enruta/psp";
import { metadataMapping } from "@enruta/psp/mapping";
const stripe = adapterFor("stripe");
const conn = { id: "psc_1", psp: "stripe", mode: "test", account_ref: null, credentials: { secret_key: process.env.STRIPE_SECRET_KEY! } } as const;
// Write the agent's labels onto the PaymentIntent the agent order produced.
await stripe.writeMetadata(conn, "pi_123", {
agent_id: "agt_procurement_01",
mandate_ref: "mnd_01…",
policy_version: "2",
record_id: "rec_01…",
protocol: "ucp",
agent_platform: "claude",
});
// Where each PSP takes the same labels.
console.log(metadataMapping("adyen"));Dispute delivery clients (@enruta/psp/delivery) send an Enruta dispute packet to Stripe, Shopify, Adyen, Klarna, Chargeflow and Justt with the merchant's own credentials; Shopify's evidence interface needs an app Shopify has approved.
Docs: https://enruta.ai/docs/psp-connections · License: Apache-2.0
