Your social security number is what you use instead of an tax payer id number, which is what a big corporation would have.
Always have a contract.
Never let them low ball you. If you know it will take three months to write, troubleshoot, and fine polish the program, and some other guy says he can do it in two weeks for 1/4 your price, then tell them to hire him, and, 2 months later when they come back, with a half baked system that doesn't work, raise your rates. Next time they won't low ball you..
Write the code on your OWN site, show it to them, and deliver it upon payment, no sooner, no later. They don't deserve line 1 of code if they haven't paid you yet. Many companies WILL try to rip you off. The worst offenders are the biggest companies. I once did a contract job for cable giant TCI, and it took them over three months to pay, on an invoice that was clearly marked net-30, and they would NOT pay interest without actually having a court give me a judgment to make them pay, and of course, that wasn't worth it to me.
A good estimate is that it will take 1/6 your time to code it, 1/6 your time to test it, and 2/3 your time to do all the other crap the customer is going to actually want in there. So, if you're sure you can do a project in 2 weeks, tell them 12 weeks, maybe 10 if they don't scope creep the project too much. Make it clear this includes coding, testing, and upgrades as needed by the customer, i.e. the whole package, not just some piece of code with no support whatsoever.
Charge for support. Oracle does it, RedHat does it, and so does IBM. You should too. 6 months after building a system for someone, when they call you, they are "on the clock". If they don't have a support contract, demand they sign one and pay for it before you will provide support. You're time's not free, but a lot of companies will treat you like it is if you let them.