Skip to main content
Glama
DynamicEndpoints

Advanced PocketBase MCP Server

create_stripe_payment_intent

Process payments by creating Stripe payment intents for secure transaction handling within PocketBase applications.

Instructions

Create a Stripe payment intent for processing payments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool registration including schema, handler function that validates input, lazy-loads StripeService, calls createPaymentIntent, and returns formatted MCP content response.
    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 of createPaymentIntent using Stripe SDK: creates payment intent object and returns client secret and ID for frontend confirmation.
    // Create Payment Intent directly (for custom payment flows)
    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}`);
      }
    }
  • Tool schema definition used in Cloudflare Worker tools/list response for MCP protocol discovery.
    {
      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']
      }
    },

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