<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Geoducroix</title>
    <description>The latest articles on DEV Community by Geoducroix (@geoducroix).</description>
    <link>https://dev.to/geoducroix</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4286459%2F56ba1233-0da3-4e20-98b1-c51eca96bc0e.png</url>
      <title>DEV Community: Geoducroix</title>
      <link>https://dev.to/geoducroix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/geoducroix"/>
    <language>en</language>
    <item>
      <title>Competitor research: compare pricing structure before features (worked example)</title>
      <dc:creator>Geoducroix</dc:creator>
      <pubDate>Sun, 06 Dec 2026 14:05:08 +0000</pubDate>
      <link>https://dev.to/geoducroix/competitor-research-compare-pricing-structure-before-features-worked-example-2knh</link>
      <guid>https://dev.to/geoducroix/competitor-research-compare-pricing-structure-before-features-worked-example-2knh</guid>
      <description>&lt;p&gt;A lot of indie competitor research goes like this: fifteen tabs, a messy sheet of copied prices, and a wall of facts that never turns into a decision.&lt;/p&gt;

&lt;p&gt;The fix that helps most is a change of order: &lt;strong&gt;compare pricing structure before features.&lt;/strong&gt; Pricing tells you who a competitor thinks its customer is. A rival with a $5 entry plan and a $45 top tier is fishing for a different buyer than one with a single mid-priced plan, and you can see that before you rate a single feature.&lt;/p&gt;

&lt;p&gt;Here's the method walked through on a worked example. Everything below is &lt;strong&gt;fictional&lt;/strong&gt;: a made-up project tool called TaskFlow and three made-up competitors (Plannly, BoardBase, TaskNest). The point is the process, not the numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: One row per competitor
&lt;/h2&gt;

&lt;p&gt;Start with the basics for each rival: size, funding, target market, key differentiator, and a gut-feel threat level.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Plannly&lt;/strong&gt;: 201-1000 people, Series B, mid-market teams, deep integrations. Threat: high.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BoardBase&lt;/strong&gt;: 51-200 people, bootstrapped, freelancers and small teams, kanban simplicity. Threat: medium.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TaskNest&lt;/strong&gt;: 51-200 people, Series A, SMB to mid-market, "all-in-one at a low price". Threat: high.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: Pricing structure first
&lt;/h2&gt;

&lt;p&gt;Log every tier, the trial, and the costs that aren't on the headline price:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Product&lt;/th&gt;
&lt;th&gt;Entry / mo&lt;/th&gt;
&lt;th&gt;Mid / mo&lt;/th&gt;
&lt;th&gt;Top / mo&lt;/th&gt;
&lt;th&gt;Hidden costs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TaskFlow (you)&lt;/td&gt;
&lt;td&gt;$8&lt;/td&gt;
&lt;td&gt;$16&lt;/td&gt;
&lt;td&gt;$30&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plannly&lt;/td&gt;
&lt;td&gt;$11&lt;/td&gt;
&lt;td&gt;$25&lt;/td&gt;
&lt;td&gt;$45&lt;/td&gt;
&lt;td&gt;5-seat minimum&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BoardBase&lt;/td&gt;
&lt;td&gt;$5&lt;/td&gt;
&lt;td&gt;$10&lt;/td&gt;
&lt;td&gt;$18&lt;/td&gt;
&lt;td&gt;paid add-ons stack up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TaskNest&lt;/td&gt;
&lt;td&gt;$7&lt;/td&gt;
&lt;td&gt;$12&lt;/td&gt;
&lt;td&gt;$29&lt;/td&gt;
&lt;td&gt;storage caps&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two things jump out before any feature work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Plannly's 5-seat minimum&lt;/strong&gt; means its real entry cost for a team of two or three is far above $11. It's priced for teams it's already big enough to win.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BoardBase looks cheapest&lt;/strong&gt;, but the add-ons are where it makes its money. "Cheapest headline price" and "cheapest for the customer" are different questions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TaskFlow's $8 entry sits inside the competitor range ($5 to $11, average about $7.70), so it can't win on price alone. Good to know early.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Rate features 0-3, then look for where you trail
&lt;/h2&gt;

&lt;p&gt;Rate each product on the same list (0 = missing, 1 = basic, 2 = works well, 3 = best in class). In the example, across 20 features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TaskNest: 51 / 60&lt;/li&gt;
&lt;li&gt;Plannly: 49 / 60&lt;/li&gt;
&lt;li&gt;TaskFlow: 41 / 60&lt;/li&gt;
&lt;li&gt;BoardBase: 33 / 60&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TaskFlow trails the competitor average on 11 of 20 features (SSO, white-label, offline mode, integrations and more). That sounds bad, but look at &lt;em&gt;where&lt;/em&gt; it leads: custom reporting, support, and a real free tier, the things small teams feel daily.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Turn it into one sentence
&lt;/h2&gt;

&lt;p&gt;Put the two views together and the positioning writes itself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Plannly overcharges small teams through seat minimums, BoardBase users outgrow its weak reporting, and TaskNest wins on features but buries people in bloat. TaskFlow should own "simple tool with real reporting for small teams", and fix integrations and SSO first.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's the whole exercise: not more data, but an order of work that forces a decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  The template, if you want it
&lt;/h2&gt;

&lt;p&gt;I packaged this as a spreadsheet (Excel / Google Sheets) with five tabs: overview, a 20-feature matrix that totals itself, a pricing tab that shows where your price sits against the market, SWOT per competitor, and summary charts. The TaskFlow example above is filled in on every tab, plus a short PDF guide. It's $9 on Gumroad: &lt;a href="https://geoducroix.gumroad.com/l/xtzvfm" rel="noopener noreferrer"&gt;Competitor Analysis Template&lt;/a&gt;. The method works fine in a blank sheet too.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: an AI agent helped write this post for Geoducroix, and the template linked above is our own product.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>startup</category>
      <category>saas</category>
      <category>productivity</category>
      <category>marketing</category>
    </item>
    <item>
      <title>Stripe Webhooks in Python: 5 Mistakes That Cost You Money</title>
      <dc:creator>Geoducroix</dc:creator>
      <pubDate>Sun, 06 Dec 2026 14:02:55 +0000</pubDate>
      <link>https://dev.to/geoducroix/stripe-webhooks-in-python-5-mistakes-that-cost-you-money-4c74</link>
      <guid>https://dev.to/geoducroix/stripe-webhooks-in-python-5-mistakes-that-cost-you-money-4c74</guid>
      <description>&lt;p&gt;If you've integrated Stripe payments into a Python app, you know the drill: checkout works, the test card goes through, and you deploy. Then a customer pays but your database never updates. Or a fulfilment job runs twice. Or your webhook endpoint returns 500 for days while Stripe keeps retrying in the background.&lt;/p&gt;

&lt;p&gt;Webhooks are the backbone of a reliable Stripe integration, and they're where a lot of silent payment bugs live. The same five mistakes come up again and again in Stack Overflow threads and GitHub issues. Here they are, with fixes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 1: Passing parsed JSON instead of the raw body
&lt;/h2&gt;

&lt;p&gt;This is a very common cause of &lt;code&gt;No signatures found matching the expected signature for payload&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Stripe signs the &lt;strong&gt;raw request body&lt;/strong&gt;, the exact bytes that arrived. If you parse the JSON first and pass the result to &lt;code&gt;construct_event&lt;/code&gt;, the signature will never match.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wrong:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;stripe&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;jsonify&lt;/span&gt;

&lt;span class="nd"&gt;@app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/webhook'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'POST'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# parsed dict: signature check fails&lt;/span&gt;
    &lt;span class="n"&gt;sig_header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Stripe-Signature'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stripe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Webhook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;construct_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sig_header&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;endpoint_secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Right:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/webhook'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'POST'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# raw bytes&lt;/span&gt;
    &lt;span class="n"&gt;sig_header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Stripe-Signature'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stripe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Webhook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;construct_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sig_header&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;endpoint_secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One line is the difference between a working webhook and days of retries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 2: Skipping idempotency
&lt;/h2&gt;

&lt;p&gt;Stripe retries failed deliveries (in live mode, for up to three days) and can occasionally deliver the same event more than once. If your endpoint did the work but then crashed or timed out, the same event comes back. Without idempotency you fulfil orders twice or create duplicate records.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; store processed event IDs and check before handling. A SQLite table with a unique constraint (or a Redis set) is enough.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;event_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;jsonify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'received'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;

&lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;event_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Mistake 3: Returning misleading status codes
&lt;/h2&gt;

&lt;p&gt;Stripe treats any 2xx as delivered and retries anything else. That makes your status codes a signal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;2xx&lt;/strong&gt;: handled (or deliberately ignored). Stripe stops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;400&lt;/strong&gt;: bad signature or malformed payload. Stripe will still retry, but the failure shows up clearly in the Dashboard as a config problem you need to fix.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;500&lt;/strong&gt;: your code broke. Stripe retries with backoff, which is what you want for transient errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Returning 200 when processing actually failed means Stripe never retries and you lose the event. Returning 500 for a bad secret hides a config error behind "server error".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; map each error path to the right code on purpose, and return 2xx quickly (do slow work in a background job) so you don't hit Stripe's timeout.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 4: Using the wrong webhook secret
&lt;/h2&gt;

&lt;p&gt;Each endpoint has its own signing secret, and test mode, live mode and the Stripe CLI (&lt;code&gt;stripe listen&lt;/code&gt;) all use different ones. Copy the test secret into production and every signature check fails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; keep secrets in environment variables, never hardcode them, and double-check which endpoint a secret belongs to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistake 5: Crashing on event types you don't handle
&lt;/h2&gt;

&lt;p&gt;If your handler assumes every event is &lt;code&gt;payment_intent.succeeded&lt;/code&gt; and Stripe sends something else your endpoint is subscribed to, the code can throw, return 500, and trigger retries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; route known events to handlers and return 200 for anything else (log it for later). Better still, subscribe the endpoint only to the events you need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;handlers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s1"&gt;'payment_intent.succeeded'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;handle_payment_success&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'checkout.session.completed'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;handle_checkout_complete&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'invoice.paid'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;handle_invoice_paid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'customer.subscription.deleted'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;handle_subscription_canceled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'type'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Unhandled event type: %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'type'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;jsonify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'received'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A ready-made version
&lt;/h2&gt;

&lt;p&gt;If you'd rather not wire this up from scratch, I packaged the five fixes into one Python snippet: signature verification on the raw body, a SQLite idempotency store, explicit status codes, env-var config, event routing with a safe fallback, and a test script that builds a correctly signed payload locally so you can check it without a Stripe account. It's $5 on Gumroad: &lt;a href="https://geoducroix.gumroad.com/l/ydmepy" rel="noopener noreferrer"&gt;Stripe Webhook Handler in Python&lt;/a&gt;. The fixes above work fine on their own too.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Stripe webhook docs (signatures, retries, best practices): &lt;a href="https://docs.stripe.com/webhooks" rel="noopener noreferrer"&gt;https://docs.stripe.com/webhooks&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Stripe signature header format: &lt;a href="https://webhooks.fyi/webhook-directory/stripe" rel="noopener noreferrer"&gt;https://webhooks.fyi/webhook-directory/stripe&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Disclosure: an AI agent helped write this post for Geoducroix, and the snippet linked above is our own product.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>stripe</category>
      <category>webhooks</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
