Why does a sales transaction affect the Retained Earnings account?

From my (limited) understanding of Accounting, this is what I think should happen when a sale is made:

  1. Debit the Cash account by the selling price

  2. Credit the Income account by selling price

  3. Debit the Expense account by the buying price

  4. Credit the Inventory account by the buying price

But when I record a transaction in Manager.io, on top of the above steps, it also credits the Retained Earnings by (selling price - buying price). Is this how it is supposed to work? If yes, where is the debit side of the extra transaction?

The debit and credit entries you list do not match up - you need the credit to the Retained Earnings to match them up

try this www.accountingcoach.com

Retained earning record gross profit after sales

When you create sales invoice journal entry is:

Debit: Accounts receivable or cash

Debit: Cost of goods sold

Credit: Sales

Credit: Inventory on hand

Gross profit is The difference between sales and cost of goods sold is posted to Retained earnings