Skip to main content
Glama
DynamicEndpoints

Advanced PocketBase MCP Server

create_stripe_payment_intent

Generate a Stripe payment intent to securely process transactions, enabling structured payment handling within the Advanced PocketBase MCP Server.

Instructions

Create a Stripe payment intent for processing payments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary registration and handler implementation for the 'create_stripe_payment_intent' MCP tool. Includes inline schema definition, lazy-loads StripeService, creates payment intent, and returns client secret or error.
    this.server.tool( 'create_stripe_payment_intent', 'Create a Stripe payment intent for processing payments', { type: 'object', properties: { amount: { type: 'number', description: 'Amount in cents (e.g., 2000 for $20.00)' }, currency: { type: 'string', description: 'Three-letter currency code (e.g., USD)' }, description: { type: 'string', description: 'Optional description for the payment' } }, required: ['amount', 'currency'] }, async ({ amount, currency, description }) => { // Lazy load Stripe service await this.ensureStripeService(); if (!this.stripeService) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'Stripe service not available. Please set STRIPE_SECRET_KEY environment variable.' }) }] }; } try { const paymentIntent = await this.stripeService.createPaymentIntent({ amount, currency, description }); return { content: [{ type: 'text', text: JSON.stringify({ success: true, paymentIntent: { paymentIntentId: paymentIntent.paymentIntentId, clientSecret: paymentIntent.clientSecret } }, null, 2) }] }; } catch (error: any) { return { content: [{ type: 'text', text: JSON.stringify({ error: `Failed to create payment intent: ${error.message}` }) }] }; } } );
  • Core implementation in StripeService that creates the actual Stripe PaymentIntent using the Stripe SDK and returns the clientSecret and paymentIntentId. Called by the tool handler.
    async createPaymentIntent(data: { amount: number; currency?: string; customerId?: string; description?: string; metadata?: Record<string, any>; }): Promise<{ clientSecret: string; paymentIntentId: string }> { try { const paymentIntent = await this.stripe.paymentIntents.create({ amount: data.amount, currency: data.currency || 'usd', customer: data.customerId, description: data.description, metadata: data.metadata || {}, }); return { clientSecret: paymentIntent.client_secret!, paymentIntentId: paymentIntent.id, }; } catch (error: any) { throw new Error(`Failed to create payment intent: ${error.message}`); } }
  • Schema definition for 'create_stripe_payment_intent' tool returned in tools/list endpoint for discovery in worker mode.
    name: 'create_stripe_payment_intent', description: 'Create a Stripe payment intent for processing payments', inputSchema: { type: 'object', properties: { amount: { type: 'number', description: 'Amount in cents (e.g., 2000 for $20.00)' }, currency: { type: 'string', description: 'Three-letter currency code (e.g., USD)' }, description: { type: 'string', description: 'Optional description for the payment' } }, required: ['amount', 'currency'] } },

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DynamicEndpoints/advanced-pocketbase-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server