Skip to main content
Glama
PaddleHQ

Paddle MCP Server

Official
by PaddleHQ

preview_transaction_create

Preview transaction totals and details without creating an actual transaction. Calculate tax, apply discounts, and see itemized breakdowns before finalizing payments.

Instructions

This tool will preview a transaction without creating a transaction entity.

Consider using the preview_prices tool for simpler pricing calculations where payment is often taken through checkout.

Providing location information when previewing a transaction allows Paddle to calculate tax or automatically localize prices. Provide one of the following:

  • customer_ip_address: Paddle fetches location using the IP address to calculate totals.

  • address: Paddle uses the country and ZIP code (where supplied) to calculate totals.

  • customerId, addressId, businessId: Paddle uses existing customer data to calculate totals. Typically used for logged-in customers.

Exclude items from the total calculation using the includeInTotals boolean.

By default, recurring items with trials are considered to have a zero charge when previewing. Set ignoreTrials to true to ignore trial periods against prices for transaction preview calculations.

Transaction previews don't create transactions, so no id is returned.

If successful, the response includes the data sent with a details object that includes totals for the supplied prices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdNoPaddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
currencyCodeNoSupported three-letter ISO 4217 currency code.
discountIdNoPaddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
ignoreTrialsNoWhether trials should be ignored for transaction preview calculations. By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
itemsYesList of items to preview charging for. Preview charging for items that have been added to the catalog by passing the Paddle ID of an existing price entity, or preview charging for non-catalog items by passing a price object. Non-catalog items can be for existing products, or pass a product object as part of the price to preview charging for a non-catalog product.
addressYesRepresents an address entity when previewing addresses.
customerIpAddressYesIP address for this transaction preview.
addressIdYesPaddle ID of the address that this transaction preview is for, prefixed with `add_`.
businessIdNoPaddle ID of the business that this transaction preview is for, prefixed with `biz_`.

Implementation Reference

  • The primary handler function that executes the tool logic by calling the Paddle SDK's transactions.preview method with the provided parameters.
    export const previewTransactionCreate = async (
      paddle: Paddle,
      params: z.infer<typeof Parameters.previewTransactionCreateParameters>,
    ) => {
      try {
        const transaction = await paddle.transactions.preview(params);
        return transaction;
      } catch (error) {
        return error;
      }
    };
  • src/tools.ts:432-443 (registration)
    Registers the tool in the main tools array, specifying the method name, human-readable name, description prompt, input schema reference, and required permissions/actions.
    {
      method: "preview_transaction_create",
      name: "Preview a transaction",
      description: prompts.previewTransactionCreatePrompt,
      parameters: params.previewTransactionCreateParameters,
      actions: {
        transactions: {
          write: true,
          preview: true,
        },
      },
    },
  • src/api.ts:21-21 (registration)
    Maps the tool method constant to the corresponding handler function in the PaddleAPI toolMap for execution routing.
    [TOOL_METHODS.PREVIEW_TRANSACTION_CREATE]: funcs.previewTransactionCreate,
  • src/constants.ts:13-13 (registration)
    Defines the string constant for the tool method name used across registrations and mappings.
    PREVIEW_TRANSACTION_CREATE: "preview_transaction_create",
  • Provides the descriptive prompt text for the tool, used in the registration to guide LLM usage.
    export const previewTransactionCreatePrompt = `
    This tool will preview a transaction without creating a transaction entity.
    
    Consider using the preview_prices tool for simpler pricing calculations where payment is often taken through checkout.
    
    Providing location information when previewing a transaction allows Paddle to calculate tax or automatically localize prices. Provide one of the following:
    
    - customer_ip_address: Paddle fetches location using the IP address to calculate totals.
    - address: Paddle uses the country and ZIP code (where supplied) to calculate totals.
    - customerId, addressId, businessId: Paddle uses existing customer data to calculate totals. Typically used for logged-in customers.
    
    Exclude items from the total calculation using the includeInTotals boolean.
    
    By default, recurring items with trials are considered to have a zero charge when previewing. Set ignoreTrials to true to ignore trial periods against prices for transaction preview calculations.
    
    Transaction previews don't create transactions, so no id is returned.
    
    If successful, the response includes the data sent with a details object that includes totals for the supplied prices.
    `;
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate readOnlyHint=false and destructiveHint=false, but the description adds valuable behavioral context beyond this. It explains that 'Transaction previews don't create transactions, so no id is returned' and describes the response structure ('details object that includes totals'), which clarifies the non-persistent nature and output format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose. Each paragraph addresses a specific aspect (purpose, alternatives, location info, parameter behaviors, output). While comprehensive, it avoids redundancy and maintains focus, though it could be slightly more condensed in the location explanation section.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (9 parameters, nested objects) and lack of output schema, the description does a good job covering key aspects: purpose, usage guidelines, parameter semantics, and behavioral traits. It explains the response format and non-persistent nature, though it could briefly mention error handling or rate limits for full completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds meaningful context for parameters: it explains the purpose of location information (tax/price calculation), lists options (customer_ip_address, address, customerId/addressId/businessId), and clarifies behaviors for includeInTotals and ignoreTrials. This enhances understanding beyond the schema's technical definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'preview a transaction without creating a transaction entity.' It specifies the verb ('preview'), resource ('transaction'), and distinguishes it from actual creation, making it distinct from sibling tools like 'create_transaction'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool versus alternatives. It states: 'Consider using the preview_prices tool for simpler pricing calculations where payment is often taken through checkout,' naming a specific sibling tool and clarifying the use case difference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/PaddleHQ/paddle-mcp-server'

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