get_payment
Check the status of a PayBot payment by providing a payment ID to monitor transaction progress and confirm completion.
Instructions
Get the status of a PayBot payment
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paymentId | Yes | The payment ID to look up |
Implementation Reference
- src/index.ts:61-72 (registration)The tool registration for 'get_payment' which defines the input schema (paymentId) and the handler function that executes the tool logic
// Tool: get_payment server.tool( 'get_payment', 'Get the status of a PayBot payment', { paymentId: z.string().describe('The payment ID to look up'), }, async ({ paymentId }) => { const result = await paybotRequest('GET', `/v1/payments/${paymentId}`); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] }; }, ); - src/index.ts:68-71 (handler)The actual handler function that executes the get_payment tool logic - makes a GET request to /v1/payments/{paymentId} and returns the result
async ({ paymentId }) => { const result = await paybotRequest('GET', `/v1/payments/${paymentId}`); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] }; }, - src/index.ts:65-66 (schema)Input schema definition for the get_payment tool - accepts a paymentId string parameter
{ paymentId: z.string().describe('The payment ID to look up'), - src/index.ts:17-33 (helper)The paybotRequest helper function used by get_payment handler to make authenticated API requests to the PayBot backend
async function paybotRequest<T>(method: string, path: string, body?: unknown): Promise<T> { const response = await fetch(`${PAYBOT_BASE_URL}${path}`, { method, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${PAYBOT_API_KEY}`, }, body: body ? JSON.stringify(body) : undefined, }); if (!response.ok) { const errorBody = await response.text().catch(() => 'Unknown error'); throw new Error(`PayBot API error (${response.status}): ${errorBody}`); } return (await response.json()) as T; }