Skip to main content
Glama

create_stripe_payment_intent

Generate a Stripe payment intent to process transactions within PocketBase databases using the MCP server. Facilitates secure and structured payment handling for advanced database operations.

Instructions

Create a Stripe payment intent for processing payments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool registration including schema, handler, and description for 'create_stripe_payment_intent' in the main PocketBaseMCPAgent class.
    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}` }) }] }; } } );
  • The execution handler for the create_stripe_payment_intent tool, which invokes StripeService.createPaymentIntent.
    // 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}` }) }] }; } }
  • JSON Schema defining the input parameters for the create_stripe_payment_intent tool.
    { 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'] },
  • StripeService.createPaymentIntent helper method that creates the actual Stripe PaymentIntent object and returns clientSecret and ID.
    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}`); } }

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/pocketbase-mcp-server'

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