<?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: Ossama Berghai</title>
    <description>The latest articles on DEV Community by Ossama Berghai (@ossama_berghai_7238962982).</description>
    <link>https://dev.to/ossama_berghai_7238962982</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%2F4210406%2Fa18e3fbc-17d8-463c-97df-a982d215d407.png</url>
      <title>DEV Community: Ossama Berghai</title>
      <link>https://dev.to/ossama_berghai_7238962982</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ossama_berghai_7238962982"/>
    <language>en</language>
    <item>
      <title>I added 3% to cover PayPal's fee and still came up short. Here's the math I got wrong.</title>
      <dc:creator>Ossama Berghai</dc:creator>
      <pubDate>Tue, 27 Oct 2026 09:23:12 +0000</pubDate>
      <link>https://dev.to/ossama_berghai_7238962982/i-added-3-to-cover-paypals-fee-and-still-came-up-short-heres-the-math-i-got-wrong-3hc0</link>
      <guid>https://dev.to/ossama_berghai_7238962982/i-added-3-to-cover-paypals-fee-and-still-came-up-short-heres-the-math-i-got-wrong-3hc0</guid>
      <description>&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4p971vmbdnvl5sctcl5r.png" alt=" " width="799" height="333"&gt;
&lt;/h2&gt;

&lt;p&gt;My first real PayPal invoice was for $200. I knew PayPal "takes about 3%", so I expected roughly $194.&lt;/p&gt;

&lt;p&gt;I got $192.53.&lt;/p&gt;

&lt;p&gt;That's $7.47 gone, not $6. It isn't a huge amount, but I couldn't explain it, and that bothered me more than the money.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the $7.47 came from
&lt;/h2&gt;

&lt;p&gt;The buyer paid from their PayPal balance, so the rate was &lt;strong&gt;3.49% + $0.49&lt;/strong&gt;, not "about 3%":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;200 × 0.0349 = 6.98
6.98 + 0.49  = 7.47
200 − 7.47   = 192.53
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things I'd ignored: the percentage was higher than I thought, and there's a fixed fee on top. On small payments, that fixed part hurts more than the percentage does.&lt;/p&gt;

&lt;h2&gt;
  
  
  The second mistake: "just add 3%"
&lt;/h2&gt;

&lt;p&gt;My first instinct for the next invoice: if I want to &lt;em&gt;receive&lt;/em&gt; $200, add 3% and charge $206. Run the numbers, and you'd keep $198.32. Still short.&lt;/p&gt;

&lt;p&gt;The reason: &lt;strong&gt;the fee is charged on the extra you added too.&lt;/strong&gt; Adding a percentage on top doesn't undo taking a percentage off, because the second percentage is taken from a bigger number.&lt;/p&gt;

&lt;p&gt;The fix is to solve for the price instead of guessing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;you keep = price − (price × rate + fixed)
you keep = price × (1 − rate) − fixed

price = (target + fixed) / (1 − rate)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a $200 target:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0349&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fixed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.49&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;priceFor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;fixed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;priceFor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 207.74&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Charge &lt;strong&gt;$207.74&lt;/strong&gt; and you keep exactly $200. It's two lines of algebra, and it's easy to skip.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's not just PayPal
&lt;/h2&gt;

&lt;p&gt;Once I started checking, every platform had its own trap:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;eBay&lt;/strong&gt; charges its fee on the &lt;em&gt;whole order&lt;/em&gt;, including the sales tax the buyer pays. My $50 item + $8 shipping + 7% tax had a fee base of $62.06, not $58, so the fee was $8.84, not the $8.29 I'd worked out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stripe&lt;/strong&gt; keeps its processing fee when you refund. A returned $100 sale still cost me $3.20.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Depop&lt;/strong&gt; dropped its US selling fee, but the fixed 45¢ is about 3% on its own when you sell a $15 item.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is hidden. It's all on the official fee pages. It's just spread across tables you have to squint at, and it's easy to calculate the simple version in your head and be wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I do now
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Run the numbers before listing, not after the sale.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask how the buyer will pay.&lt;/strong&gt; The rate can change a lot between a balance, a card and an international card.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price backwards from what I want to keep&lt;/strong&gt;, using the formula above, not "add a few percent".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I got tired of redoing this in a spreadsheet, so I put all of it into a small free calculator that shows each deduction line by line: &lt;a href="https://nettedfees.com" rel="noopener noreferrer"&gt;Netted&lt;/a&gt;. Even if you never use it, the formula above is the useful part. Drop it into whatever invoicing script you have.&lt;/p&gt;

&lt;p&gt;What fee caught &lt;em&gt;you&lt;/em&gt; off guard the first time? I'm curious which ones trip people up most.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>sideprojects</category>
    </item>
  </channel>
</rss>
