Add a payment handler to an existing Saleor Agentic Commerce setup. Supports Prism stablecoin payments (USDC via x402/EIP-3009). Use after setup-agentic-commerce.
You are helping a developer add a payment handler to their existing Saleor Agentic Commerce integration. This enables AI agents to pay for purchases using supported payment methods.
package.json for @financedistrict/saleor-agentic-commerce-core. If not found, tell the developer to run /setup-agentic-commerce first.createAgenticCommerce(). Likely at src/lib/agentic-commerce.ts or similar.$ARGUMENTS is empty or "prism", use Prism. Otherwise explain that Prism is currently the only supported handler.Prism enables AI agents to pay with USDC and other stablecoins using x402/EIP-3009 signed authorization transfers. The agent signs an EIP-3009 message, the SDK forwards it to the Prism Gateway, and Prism settles it on-chain.
transferWithAuthorizationDetect the package manager from the lockfile and use the correct command:
npm install @financedistrict/saleor-prism-payment
Read the existing agentic-commerce config file and add the Prism handler:
import { createAgenticCommerce } from "@financedistrict/saleor-agentic-commerce-nextjs"
import { PrismPaymentHandler } from "@financedistrict/saleor-prism-payment"
export const agenticCommerce = createAgenticCommerce({
// ... existing config ...
paymentHandlers: [
new PrismPaymentHandler({
apiUrl: process.env.PRISM_API_URL,
apiKey: process.env.PRISM_API_KEY,
}),
],
})
Important: Don't overwrite the existing config — only add the paymentHandlers array and the import. Keep all existing properties.
Append to .env.local and .env.example (if it exists):
# ─── Prism Payment (Stablecoin via x402) ────────────────
PRISM_API_URL=https://prism-gw.fd.xyz # Prism Gateway URL
PRISM_API_KEY= # Your Prism API key (get from developers.fd.xyz/prism)
Show the developer:
GET /api/ucp → sees xyz.fd.prism_payment in payment_handlersIf the developer asks about other payment handlers:
PaymentHandlerAdapter interface supports any payment provider. A Stripe adapter could be built by implementing prepareCheckoutPayment() and settlePayment().PaymentHandlerAdapter interface in @financedistrict/saleor-agentic-commerce-core. It requires: id, getUcpDiscoveryHandlers(), getAcpDiscoveryHandlers(), prepareCheckoutPayment(), settlePayment().