For example.. For my M1 Mini i traded in an old 27" iMac and used my Apple Card for the purchase. They knocked the ~$700 of the price of the mini (trade-in value)... Then shipped me out a box for the iMac once I received my Mini.
The website will tell you exactly how much $$ they will give you for the trade-in.
Its always super painless UNLESS:
1) you lie about the hardware you are trading in (damaged)
2) you expect to get top dollar for your trade in.
For #2.. in my case i probably could have got about $200 more by selling it myself... but i didn't want to deal with the hassle.