It's all legal, and that's the way it's generally done with what is considered uncollectable unsecured debt. Let's say you have an outstanding balance of $10,000 on a credit card and you just stop paying what you owe. Since CC debt is unsecured, there's really not to much the card issuer can do to "hurt" you if you don't pay up, other than adding that unpaid debt as a negative entry on your credit report.
Next, the card issuer may sell your debt to a debt collection agency for say, $5000. Nothing wrong with that at all. That way, the car issuer gets "something" back for the $10,000 of outstanding debt.
Next, the debt collection agency who now owns that debt will be contacting you. Generally, they're going to try to collect the entire $10,000, as that's how they make their money. If they can, they'll also tack on addditional "collection fees" which is perfectly legal also. (even collection agencies have to pay their employess too!). A collection agency will attempt to collect the debt for anywhere from 1 to 3 years before they will sell it to yet another collection agency for even less than they paid for it. The selling agency is also going to update your credit report with your unpaid debt to them too.
So the next collection agency may pay only $2500 for the debt. It's somewhat common (Not "Very" common, but "somewhat" common) for the 2nd collection agency to send you a final notice settlement letter where they will agree to "settle" the $10,000 debt for say, $4000, provided you pay the debt in full within a specified time period - usually 30 days or so. When that occurs, you "might" be able to call them and get that settlement even lower. But don't count on it. So lets say you agree to pay the $4000 and they'll leave you alone, and of course, you actually do pay it.
At that point, you can expect to receive a 1099-C Forgiveness of Debt for the $6000 that was not collected on the debt. That means on the legal front, that nobody will make any further attempt to collect the balance of that debt. However, you will have to report and pay taxes on that forgiven amount.
All of this activity will be recorded on your credit report, and nothing just "goes away" because you paid and/or settled. But the fact you settled the debt will be on the credit report and it will show the unpaid amount as a "write off". All that of course is a ding on your credit. The only thing that makes that ding go away, is time. THe older that bad debt gets, the less impact is has on your credit score.
So if from this point forward you are "never" late with another payment on anything again, your credit score today may be 300. But a year from now as that bad debt ages, your score may rise to 400 *provided* of course, you don't get behind or stop paying any other debt in the meantime.
All debt, bad and good, remains on your credit report for anywhere from 3 to 10 years. It just depend on what the debt is for, and the amount of that debt, as to how long it will be before it just "Falls off" your credit report. As an example, and unpaid $500 bank signature loan may fall off after there years. Whereas a real estate foreclosure will not fall off for 7-10 years.
that credit score is part of the Banks assessment of your 'willingness to pay' and 'ability to pay'.
So past payment performance is a strong predictor of future payment behavior so failure to maintain 'ability to pay' affects the Banks decision whether to extend additional credit to you. Hence those past 'dings' stay on your report for seven years
It doesn't really matter which company you actually owes to now. If you are able to settle every single cent at the end of the day, your credit history will be wiped out eventually. It might take time for the records to be updated but just keep the payment receipt handy just in case any lending bodies ask for verification.