set-cart-card
Assign a payment card to the shopping cart for checkout in Terminal.shop. Use this tool to link a card ID to your cart before completing purchases.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardID | Yes |
Implementation Reference
- server.js:659-685 (handler)Handler function for 'set-cart-card' tool that sets the payment card on the cart by calling terminalApi.put('/cart/card', {cardID}) and returns success or error message.async ({ cardID }) => { try { const response = await terminalApi.put("/cart/card", { cardID, }); return { content: [ { type: "text", text: "Successfully set payment method for your cart.", }, ], }; } catch (error) { console.error("Error setting cart payment method:", error); return { content: [ { type: "text", text: `Error setting cart payment method: ${error.message}`, }, ], isError: true, }; } },
- server.js:656-658 (schema)Input schema for 'set-cart-card' tool defining cardID as a string using Zod.{ cardID: z.string(), },
- server.js:654-686 (registration)Registration of the 'set-cart-card' tool using server.tool() with name, schema, and inline handler.server.tool( "set-cart-card", { cardID: z.string(), }, async ({ cardID }) => { try { const response = await terminalApi.put("/cart/card", { cardID, }); return { content: [ { type: "text", text: "Successfully set payment method for your cart.", }, ], }; } catch (error) { console.error("Error setting cart payment method:", error); return { content: [ { type: "text", text: `Error setting cart payment method: ${error.message}`, }, ], isError: true, }; } }, );