Skip to main content
Glama

get_payment_intent

Retrieve detailed payment intent information and transaction history using a payment intent ID to monitor payment status and track all payment attempts.

Instructions

Get payment intent details and status by payment intent ID. Returns comprehensive payment history including all attempts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payment_intent_idYesPayment intent ID from create_payment_intent response (e.g., pi_pGwAaq, trx_z88ymJ). This is the "id" field.

Implementation Reference

  • Handler for the 'get_payment_intent' tool in the main MCP server (index.ts). Validates the input payment_intent_id and calls the Bayarcash client to fetch details.
    case 'get_payment_intent': { // Validate input const validation = validateInput(paymentIntentIdSchema, args); if (!validation.success) { throw new McpError(ErrorCode.InvalidParams, `Validation error: ${validation.error}`); } const result = await bayarcash.getPaymentIntent(validation.data.payment_intent_id); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
  • Zod schema for validating the input to get_payment_intent tool (payment_intent_id field). Used in the index.ts handler.
    // Payment intent ID schema export const paymentIntentIdSchema = z.object({ payment_intent_id: z .string() .min(1, 'Payment intent ID is required') .regex(/^(pi_|trx_)/, 'Payment intent ID must start with pi_ or trx_')
  • src/index.ts:102-115 (registration)
    Tool registration in ListToolsRequestHandler, including name, description, and input schema.
    { name: 'get_payment_intent', description: 'Get payment intent details and status by payment intent ID. Returns comprehensive payment history including all attempts.', inputSchema: { type: 'object', properties: { payment_intent_id: { type: 'string', description: 'Payment intent ID from create_payment_intent response (e.g., pi_pGwAaq, trx_z88ymJ). This is the "id" field.' } }, required: ['payment_intent_id'] } },
  • Core implementation in BayarcashClient: Makes HTTP GET request to Bayarcash API /payment-intents/{id} to retrieve payment intent details.
    async getPaymentIntent(paymentIntentId: string): Promise<PaymentIntentDetailResponse> { try { const response = await this.axiosInstance.get(`/payment-intents/${paymentIntentId}`); return response.data; } catch (error) { this.handleError(error); } }
  • Alternative handler and registration using Smithery framework in smithery.ts.
    server.tool( 'get_payment_intent', 'Get payment intent details and status by payment intent ID. Use this to check the current status of a payment after it has been created. Returns comprehensive payment history including all attempts (successful and unsuccessful).', { payment_intent_id: z.string().describe('Payment intent ID from create_payment_intent response (e.g., pi_pGwAaq, trx_z88ymJ). This is the "id" field returned when payment was created.') }, async ({ payment_intent_id }) => { const result = await bayarcash.getPaymentIntent(payment_intent_id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } );

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

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