// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { isJqError, maybeFilter } from '@whop/mcp/filtering'; import { Metadata, asErrorResult, asTextContentResult } from '@whop/mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; import Whop from '@whop/sdk'; export const metadata: Metadata = { resource: 'checkout_configurations', operation: 'read', tags: [], httpMethod: 'get', httpPath: '/checkout_configurations/{id}', operationId: 'retrieveCheckoutConfiguration', }; export const tool: Tool = { name: 'retrieve_checkout_configurations', description: "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieves a checkout configuration by ID\n\nRequired permissions:\n - `checkout_configuration:basic:read`\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/checkout_configuration',\n $defs: {\n checkout_configuration: {\n type: 'object',\n description: '\\n A checkout configuration object.\\n Can be used to create a reusable custom configuration for a checkout, including attaching plans, affiliates and custom metadata to the checkout.\\n This configuration can be re-used by multiple users.\\n All successful payments and memberships resulting from a checkout will contain the passed metadata.\\n ',\n properties: {\n id: {\n type: 'string',\n description: 'The ID of the checkout configuration'\n },\n affiliate_code: {\n type: 'string',\n description: 'The affiliate code to use for the checkout configuration'\n },\n company_id: {\n type: 'string',\n description: 'The ID of the company to use for the checkout configuration'\n },\n currency: {\n $ref: '#/$defs/currency'\n },\n metadata: {\n type: 'object',\n description: 'The metadata to use for the checkout configuration',\n additionalProperties: true\n },\n mode: {\n $ref: '#/$defs/checkout_modes'\n },\n payment_method_configuration: {\n type: 'object',\n description: 'The explicit payment method configuration for the session, if any. This currently only works in \\'setup\\' mode. Use the plan\\'s payment_method_configuration for payment method.',\n properties: {\n disabled: {\n type: 'array',\n description: 'An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.',\n items: {\n $ref: '#/$defs/payment_method_types'\n }\n },\n enabled: {\n type: 'array',\n description: 'An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.',\n items: {\n $ref: '#/$defs/payment_method_types'\n }\n },\n include_platform_defaults: {\n type: 'boolean',\n description: 'Whether Whop\\'s platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments.'\n }\n },\n required: [ 'disabled',\n 'enabled',\n 'include_platform_defaults'\n ]\n },\n plan: {\n type: 'object',\n description: 'The plan to use for the checkout configuration',\n properties: {\n id: {\n type: 'string',\n description: 'The internal ID of the plan.'\n },\n billing_period: {\n type: 'integer',\n description: 'The interval at which the plan charges (renewal plans).'\n },\n currency: {\n $ref: '#/$defs/currency'\n },\n expiration_days: {\n type: 'integer',\n description: 'The interval at which the plan charges (expiration plans).'\n },\n initial_price: {\n type: 'number',\n description: 'The price a person has to pay for a plan on the initial purchase.'\n },\n plan_type: {\n $ref: '#/$defs/plan_type'\n },\n release_method: {\n $ref: '#/$defs/release_method'\n },\n renewal_price: {\n type: 'number',\n description: 'The price a person has to pay for a plan on the renewal purchase.'\n },\n trial_period_days: {\n type: 'integer',\n description: 'The number of free trial days added before a renewal plan.'\n },\n visibility: {\n $ref: '#/$defs/visibility'\n }\n },\n required: [ 'id',\n 'billing_period',\n 'currency',\n 'expiration_days',\n 'initial_price',\n 'plan_type',\n 'release_method',\n 'renewal_price',\n 'trial_period_days',\n 'visibility'\n ]\n },\n purchase_url: {\n type: 'string',\n description: 'A URL you can send to customers to complete a checkout. It looks like `/checkout/plan_xxxx?session={id}`'\n },\n redirect_url: {\n type: 'string',\n description: 'The URL to redirect the user to after the checkout configuration is created'\n }\n },\n required: [ 'id',\n 'affiliate_code',\n 'company_id',\n 'currency',\n 'metadata',\n 'mode',\n 'payment_method_configuration',\n 'plan',\n 'purchase_url',\n 'redirect_url'\n ]\n },\n currency: {\n type: 'string',\n description: 'The available currencies on the platform',\n enum: [ 'usd',\n 'sgd',\n 'inr',\n 'aud',\n 'brl',\n 'cad',\n 'dkk',\n 'eur',\n 'nok',\n 'gbp',\n 'sek',\n 'chf',\n 'hkd',\n 'huf',\n 'jpy',\n 'mxn',\n 'myr',\n 'pln',\n 'czk',\n 'nzd',\n 'aed',\n 'eth',\n 'ape',\n 'cop',\n 'ron',\n 'thb',\n 'bgn',\n 'idr',\n 'dop',\n 'php',\n 'try',\n 'krw',\n 'twd',\n 'vnd',\n 'pkr',\n 'clp',\n 'uyu',\n 'ars',\n 'zar',\n 'dzd',\n 'tnd',\n 'mad',\n 'kes',\n 'kwd',\n 'jod',\n 'all',\n 'xcd',\n 'amd',\n 'bsd',\n 'bhd',\n 'bob',\n 'bam',\n 'khr',\n 'crc',\n 'xof',\n 'egp',\n 'etb',\n 'gmd',\n 'ghs',\n 'gtq',\n 'gyd',\n 'ils',\n 'jmd',\n 'mop',\n 'mga',\n 'mur',\n 'mdl',\n 'mnt',\n 'nad',\n 'ngn',\n 'mkd',\n 'omr',\n 'pyg',\n 'pen',\n 'qar',\n 'rwf',\n 'sar',\n 'rsd',\n 'lkr',\n 'tzs',\n 'ttd',\n 'uzs',\n 'rub',\n 'btc',\n 'cny'\n ]\n },\n checkout_modes: {\n type: 'string',\n description: 'The different modes a checkout can be set to.',\n enum: [ 'payment',\n 'setup'\n ]\n },\n payment_method_types: {\n type: 'string',\n description: 'The different types of payment methods that can be used.',\n enum: [ 'acss_debit',\n 'affirm',\n 'afterpay_clearpay',\n 'alipay',\n 'alma',\n 'amazon_pay',\n 'apple_pay',\n 'au_becs_debit',\n 'bacs_debit',\n 'bancontact',\n 'billie',\n 'blik',\n 'boleto',\n 'card',\n 'cashapp',\n 'crypto',\n 'eps',\n 'fpx',\n 'giropay',\n 'google_pay',\n 'grabpay',\n 'ideal',\n 'kakao_pay',\n 'klarna',\n 'konbini',\n 'kr_card',\n 'link',\n 'mobilepay',\n 'multibanco',\n 'naver_pay',\n 'nz_bank_account',\n 'oxxo',\n 'p24',\n 'pay_by_bank',\n 'payco',\n 'paynow',\n 'pix',\n 'promptpay',\n 'revolut_pay',\n 'samsung_pay',\n 'satispay',\n 'sepa_debit',\n 'sofort',\n 'swish',\n 'twint',\n 'us_bank_account',\n 'wechat_pay',\n 'zip',\n 'bizum',\n 'capchase_pay',\n 'kriya',\n 'mondu',\n 'ng_wallet',\n 'paypay',\n 'sequra',\n 'scalapay',\n 'vipps',\n 'custom',\n 'customer_balance',\n 'gopay',\n 'mb_way',\n 'ng_bank',\n 'ng_bank_transfer',\n 'ng_card',\n 'ng_market',\n 'ng_ussd',\n 'paypal',\n 'payto',\n 'qris',\n 'rechnung',\n 'south_korea_market',\n 'kr_market',\n 'shopeepay',\n 'upi',\n 'sunbit',\n 'netbanking',\n 'id_bank_transfer',\n 'demo_pay',\n 'shop_pay',\n 'sezzle',\n 'coinbase',\n 'splitit',\n 'platform_balance',\n 'apple',\n 'venmo',\n 'unknown'\n ]\n },\n plan_type: {\n type: 'string',\n description: 'The type of plan that can be attached to a product',\n enum: [ 'renewal',\n 'one_time'\n ]\n },\n release_method: {\n type: 'string',\n description: 'The methods of how a plan can be released.',\n enum: [ 'buy_now',\n 'waitlist'\n ]\n },\n visibility: {\n type: 'string',\n description: 'Visibility of a resource',\n enum: [ 'visible',\n 'hidden',\n 'archived',\n 'quick_link'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { id: { type: 'string', }, jq_filter: { type: 'string', title: 'jq Filter', description: 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', }, }, required: ['id'], }, annotations: { readOnlyHint: true, }, }; export const handler = async (client: Whop, args: Record | undefined) => { const { id, jq_filter, ...body } = args as any; try { return asTextContentResult( await maybeFilter(jq_filter, await client.checkoutConfigurations.retrieve(id)), ); } catch (error) { if (error instanceof Whop.APIError || isJqError(error)) { return asErrorResult(error.message); } throw error; } }; export default { metadata, tool, handler };