set-cart-card
Assign a payment card to your shopping cart for streamlined checkout on Terminal.shop. Input the card ID to manage transactions efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardID | Yes |
Implementation Reference
- server.js:659-686 (handler)The handler function executes the tool logic: sends PUT /cart/card with cardID to terminalApi, returns success or error response.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)Zod schema defining input: cardID as string.{ cardID: z.string(), },
- server.js:654-686 (registration)Registration of the 'set-cart-card' tool using server.tool, including name, schema, and 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, }; } }, );