1. If they're truly pirates, they'll attack only if you run. Stop if they ask you to do so, try to make your answers short & quick to show that you are willing to cooperate early in the encounter. If they attack you right away, they're likely not after cargo and you should just run for your life (more on that a paragraph below).
2. As I said previously, if they attack it is either because you did not comply and stop or because they are not interested into cargo at all. In the first case, you can try dropping a meaningful amount while you run. This way they'll have to choose between killing you for the example or scooping the cargo. If its the latter case, just run as dropping cargo won't solve the problem.
3. They'll likely tell you how much they want. You can then try to negotiate. 10% of your hold (20+ tons in a T7) was a common request back when I was trade grinding a few month ago.
Now, some tips to increase your chances of survival if you DO get shot at :
1. Submit to interdictions to avoid taking hull damage & reduce the FSD cooldown. In a T7 you are going to lose them anyway.
2. Always put 4 pips into SYS to maximize the durability of your shield & the remaining two into ENG. You are not going to fight, just survive long enough to get the hell out of here.
3. As soon as you can, select a nearby star system as a destination if this is not already the case.
4. Why ? Because you NEED to make an hyperspace jump rather than merely going back into surpercruise. H-Jumps are not affected by masslock so you will actually be out of there sooner. And most importantly your aggressor won't pop behind you a split second later to interdict you again. Also, you can start charging you FSD way before you line up with you destination. Do it as soon as they become hostile. Time is of the essence here.
4. Do not flee in a straight line, this will get you killed. Use thrusters, do barrel rolls boost in random directions ... in short, spoil their aim. Also, use chaff if they use gimbals / turrets (you should always pack two chaff launcher for uninterupted disruption)
5. If your shields drop, redirect all pips in ENG to boost as often as possible. Engage silent running so that they cannot target your drives. And try to shake them off your tail so that it will be harder for them to hit them manually.
6. Once (if) you manage to jump out, drop into normal space immediately upon arrival & boost away from your drop point. This way even if they follow your high-wake, they'll need to notice the low wake. And even if they do, they'll only see an empty instance when they drop because you'll be out of their sensors' range. Wait for your shields to recharge, plot your next jump, carry on with your life.
7. Congratulation, you survived an attack in a trading ship ... hopefully.