/** * Express example — stripe-mpp-proxy * * npm install express * npx tsx index.ts */ import express from 'express' import { createProxy } from '../../src/index.js' const proxy = createProxy({ stripe: { secretKey: process.env.STRIPE_SECRET_KEY!, networkId: process.env.STRIPE_NETWORK_ID ?? 'internal', }, base: { payTo: process.env.BASE_PAY_TO as `0x${string}`, network: 'base-sepolia', }, services: { inference: { origin: process.env.INFERENCE_ORIGIN_URL!, routes: [ { method: 'POST', path: '/v1/infer', description: 'Single inference request', pricing: { stripe: { amount: '0.05', currency: 'usd' }, base: { amount: '0.05' }, }, }, ], }, data: { origin: process.env.DATA_ORIGIN_URL!, routes: [ { method: 'GET', path: '/v1/records/*', pricing: { stripe: { amount: '0.01', currency: 'usd' }, base: { amount: '0.01' }, }, }, ], }, }, }) const app = express() app.get('/health', (_req, res) => res.json({ status: 'ok' })) app.use(proxy.express()) const port = Number(process.env.PORT ?? 3000) app.listen(port, () => { console.log(`[express] stripe-mpp-proxy listening on http://localhost:${port}`) })