Skip to main content

Overview

The @aixyz/stripe package provides an experimental Stripe payment adapter for aixyz agents. It creates Stripe PaymentIntents for agent interactions, offering an alternative payment method alongside the default x402 protocol.
This package is experimental and its API may change significantly in future releases. Use in production at your own risk.

Installation

bun add @aixyz/stripe

Environment Variables

VariableDescription
STRIPE_SECRET_KEYYour Stripe secret key
STRIPE_PRICE_CENTSPrice in cents (default: 100)

Usage

Use experimental_useStripePaymentIntent in a custom server to add Stripe payment endpoints:
import { AixyzServer } from "aixyz/server";
import { experimental_useStripePaymentIntent } from "@aixyz/stripe";

const server = new AixyzServer();
await server.initialize();

experimental_useStripePaymentIntent(server);

export default server;
This registers a POST /stripe/create-payment-intent endpoint and middleware for validating Stripe payments.

Example: Travel Agent with Stripe

The agent-travel example demonstrates Stripe integration alongside x402:
import { AixyzMCP } from "aixyz/server/adapters/mcp";
import { AixyzServer } from "aixyz/server";
import { useA2A } from "aixyz/server/adapters/a2a";
import { experimental_useStripePaymentIntent } from "@aixyz/stripe";

import * as agent from "./agent";
import * as searchFlights from "./tools/searchFlights";

const server = new AixyzServer();
await server.initialize();
server.unstable_withIndexPage();

experimental_useStripePaymentIntent(server);
useA2A(server, agent);

const mcp = new AixyzMCP(server);
await mcp.register("searchFlights", searchFlights);
await mcp.connect();

export default server;

Relationship to x402

The x402 protocol is the primary payment mechanism in aixyz, built into the server at the framework level. The Stripe adapter is a supplementary option for teams that prefer traditional payment processing over crypto-native x402 payments.