get_payment_intent
Retrieve payment intent details and status using a payment intent ID. View comprehensive payment history including all transaction attempts for monitoring and verification.
Instructions
Get payment intent details and status by payment intent ID. Returns comprehensive payment history including all attempts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| payment_intent_id | Yes | Payment intent ID from create_payment_intent response (e.g., pi_pGwAaq, trx_z88ymJ). This is the "id" field. |
Implementation Reference
- src/index.ts:242-258 (handler)The MCP tool handler for 'get_payment_intent' that validates the input using paymentIntentIdSchema, calls bayarcash.getPaymentIntent, and returns the result as JSON text content.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) } ] }; }
- src/index.ts:102-115 (registration)Registration of the 'get_payment_intent' tool in the MCP ListTools handler, defining 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'] } },
- src/validation.ts:72-78 (schema)Zod schema definition for validating the payment_intent_id input parameter used in the get_payment_intent 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/smithery.ts:60-72 (handler)Alternative Smithery-based handler and registration for 'get_payment_intent' tool with inline Zod schema, delegating to bayarcash.getPaymentIntent.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) }] }; } );
- src/bayarcash-client.ts:278-285 (helper)Core helper method in BayarcashClient that performs the actual HTTP GET request to retrieve payment intent details from the Bayarcash API.async getPaymentIntent(paymentIntentId: string): Promise<PaymentIntentDetailResponse> { try { const response = await this.axiosInstance.get(`/payment-intents/${paymentIntentId}`); return response.data; } catch (error) { this.handleError(error); } }