create_web_profile
Create a PayPal web experience profile to customize checkout branding, shipping options, and payment flow configuration for online stores.
Instructions
Create a web experience profile
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| presentation | No | ||
| input_fields | No | ||
| flow_config | No |
Implementation Reference
- src/index.ts:1244-1257 (handler)Handler for create_web_profile tool: validates input using validateWebProfile, makes POST request to PayPal API to create web experience profile, returns the JSON response.case 'create_web_profile': { const args = this.validateWebProfile(request.params.arguments); const response = await axios.post<PayPalWebProfile>( 'https://api-m.sandbox.paypal.com/v1/payment-experience/web-profiles', args, { headers } ); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] }; }
- src/index.ts:173-189 (schema)TypeScript interface defining the PayPalWebProfile structure used for input validation and API response typing.interface PayPalWebProfile { id?: string; name: string; presentation: { brand_name?: string; logo_image?: string; locale_code?: string; }; input_fields: { no_shipping?: number; address_override?: number; }; flow_config: { landing_page_type?: string; bank_txn_pending_url?: string; }; }
- src/index.ts:1022-1054 (registration)Tool registration in listTools handler, specifying name, description, and inputSchema for create_web_profile.{ name: 'create_web_profile', description: 'Create a web experience profile', inputSchema: { type: 'object', properties: { name: { type: 'string' }, presentation: { type: 'object', properties: { brand_name: { type: 'string' }, logo_image: { type: 'string' }, locale_code: { type: 'string' } } }, input_fields: { type: 'object', properties: { no_shipping: { type: 'number' }, address_override: { type: 'number' } } }, flow_config: { type: 'object', properties: { landing_page_type: { type: 'string' }, bank_txn_pending_url: { type: 'string' } } } }, required: ['name'] } },
- src/index.ts:610-648 (helper)Helper function to validate and normalize input arguments for create_web_profile tool according to PayPalWebProfile interface.private validateWebProfile(args: unknown): PayPalWebProfile { if (typeof args !== 'object' || !args) { throw new McpError(ErrorCode.InvalidParams, 'Invalid web profile data'); } const profile = args as Record<string, unknown>; if (typeof profile.name !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Missing required profile name'); } const webProfile: PayPalWebProfile = { name: profile.name, presentation: {}, input_fields: {}, flow_config: {} }; if (profile.presentation && typeof profile.presentation === 'object') { const pres = profile.presentation as Record<string, unknown>; if (typeof pres.brand_name === 'string') webProfile.presentation.brand_name = pres.brand_name; if (typeof pres.logo_image === 'string') webProfile.presentation.logo_image = pres.logo_image; if (typeof pres.locale_code === 'string') webProfile.presentation.locale_code = pres.locale_code; } if (profile.input_fields && typeof profile.input_fields === 'object') { const fields = profile.input_fields as Record<string, unknown>; if (typeof fields.no_shipping === 'number') webProfile.input_fields.no_shipping = fields.no_shipping; if (typeof fields.address_override === 'number') webProfile.input_fields.address_override = fields.address_override; } if (profile.flow_config && typeof profile.flow_config === 'object') { const flow = profile.flow_config as Record<string, unknown>; if (typeof flow.landing_page_type === 'string') webProfile.flow_config.landing_page_type = flow.landing_page_type; if (typeof flow.bank_txn_pending_url === 'string') webProfile.flow_config.bank_txn_pending_url = flow.bank_txn_pending_url; } return webProfile; }