{"product_id":"n8n-webhook-claude-text-image-gen-with-stripe-metered-billing","title":"n8n Webhook: Claude Text \u0026 Image Gen with Stripe Metered Billing","description":"\u003ch3\u003eControl Claude Text \u0026amp; Image Generation with Stripe Metered Billing\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow exposes a secure POST webhook that authenticates requests with Stripe customer metadata, enforces metered subscription limits, generates content with \u003cstrong\u003eAnthropic Claude\u003c\/strong\u003e (text) or a configurable image-generation HTTP endpoint (images), records usage in Stripe, and returns a synchronous JSON response.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives a POST webhook\u003c\/strong\u003e with an \u003cem\u003eapiKey\u003c\/em\u003e, \u003cem\u003econtentType\u003c\/em\u003e (text or image), a \u003cem\u003eprompt\u003c\/em\u003e, and optional generation parameters.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAuthenticates against Stripe\u003c\/strong\u003e by searching for a Stripe customer whose \u003ccode\u003emetadata.apiKey\u003c\/code\u003e matches the incoming key. If no customer is found, it returns a \u003cstrong\u003e401\u003c\/strong\u003e JSON error.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates subscription + metered usage\u003c\/strong\u003e by retrieving the customer’s active Stripe subscription and reading the metered subscription item’s current-period usage summaries.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEnforces plan limits\u003c\/strong\u003e using the subscription’s Stripe \u003cem\u003eprice ID\u003c\/em\u003e to determine the per-plan monthly cap. If there’s no active subscription or the limit is exceeded, it returns a \u003cstrong\u003e402\u003c\/strong\u003e JSON error.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGenerates output\u003c\/strong\u003e:\n    \u003cul\u003e\n      \u003cli\u003e\n\u003cstrong\u003eText:\u003c\/strong\u003e calls the Anthropic Messages API.\u003c\/li\u003e\n      \u003cli\u003e\n\u003cstrong\u003eImages:\u003c\/strong\u003e calls a configured image-generation HTTP endpoint.\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRecords Stripe usage\u003c\/strong\u003e by incrementing the metered subscription item and returns a success JSON payload including the generated content and updated usage counters.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSaaS operators offering \u003cstrong\u003eAPI-based AI generation\u003c\/strong\u003e with pay-per-use limits.\u003c\/li\u003e\n  \u003cli\u003eTeams building a “Claude-powered” feature where every request must be billed via \u003cstrong\u003eStripe metered subscriptions\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eAutomation engineers creating a webhook-based content service that immediately responds with generated text or images.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook:\u003c\/strong\u003e POST endpoint accepting \u003ccode\u003eapiKey\u003c\/code\u003e, \u003ccode\u003econtentType\u003c\/code\u003e, and \u003ccode\u003eprompt\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIntegrations:\u003c\/strong\u003e Stripe (Customers, Subscriptions, Subscription Items, Usage Records) + Anthropic Claude (Messages API) + an external image-generation HTTP API.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n nodes used:\u003c\/strong\u003e \u003ccode\u003eif\u003c\/code\u003e, \u003ccode\u003eset\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003emerge\u003c\/code\u003e, \u003ccode\u003eswitch\u003c\/code\u003e, \u003ccode\u003ewebhook\u003c\/code\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eBest for teams who need Claude text \u0026amp; image generation tightly coupled to Stripe billing, limits, and usage tracking.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46047278203059,"sku":"N8N-19670","price":21.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/x37XXeXQyl7dKF2wfNhkw_9vZL3rps.png?v=1789635950","url":"https:\/\/buyflowscripts.com\/products\/n8n-webhook-claude-text-image-gen-with-stripe-metered-billing","provider":"N8N Commerce","version":"1.0","type":"link"}