Skip to main content
Glama
PaddleHQ
by PaddleHQ

preview_subscription_charge

Preview one-time charges for a subscription to calculate expected transactions before applying changes, without billing the customer.

Instructions

This tool will preview creating a one-time charge for a subscription without billing that charge, typically used for previewing calculations before making changes to a subscription.

One-time charges are non-recurring items. These are price entities where the billingCycle is null.

If successful, the response includes immediateTransaction, nextTransaction, and recurringTransactionDetails to see expected transactions for the changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subscriptionIdYesPaddle ID of the subscription.
effectiveFromYesWhen one-time charges should be billed.
itemsYesList of one-time charges to bill for. Only prices where the `billingCycle` is `null` may be added. Charge for items that have been added to the catalog by passing the Paddle ID of an existing price entity, or charge 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 charge for a non-catalog product.
onPaymentFailureNoHow Paddle should handle changes made to a subscription or its items if the payment fails during update. If omitted, defaults to `prevent_change`.

Implementation Reference

  • The primary handler function implementing the tool logic. It previews a one-time charge on a subscription by calling the Paddle SDK's previewOneTimeCharge method.
    export const previewSubscriptionCharge = async ( paddle: Paddle, params: z.infer<typeof Parameters.previewSubscriptionChargeParameters>, ) => { try { const { subscriptionId, ...updateData } = params; const subscription = await paddle.subscriptions.previewOneTimeCharge(subscriptionId, updateData); return subscription; } catch (error) { return error; } };
  • src/tools.ts:625-636 (registration)
    Tool registration in the tools array, defining method name, human-readable name, description prompt, input parameters schema, and required permissions/actions.
    { method: "preview_subscription_charge", name: "Preview a one-time charge for a subscription", description: prompts.previewSubscriptionChargePrompt, parameters: params.previewSubscriptionChargeParameters, actions: { subscriptions: { write: true, preview: true, }, }, },
  • src/api.ts:83-85 (registration)
    Mapping of the tool method constant to its handler function in the PaddleAPI toolMap.
    [TOOL_METHODS.CREATE_SUBSCRIPTION_CHARGE]: funcs.createSubscriptionCharge, [TOOL_METHODS.PREVIEW_SUBSCRIPTION_CHARGE]: funcs.previewSubscriptionCharge, [TOOL_METHODS.LIST_REPORTS]: funcs.listReports,
  • src/constants.ts:74-77 (registration)
    Constant definition for the tool method string used across registrations and mappings.
    PREVIEW_SUBSCRIPTION_UPDATE: "preview_subscription_update", CREATE_SUBSCRIPTION_CHARGE: "create_subscription_charge", PREVIEW_SUBSCRIPTION_CHARGE: "preview_subscription_charge", LIST_REPORTS: "list_reports",

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