Some aspect is legal some in grey area.
Please maintain proper documentation. Generally for amounts in question, there is less scrutiny from Income tax.
Buying on behalf of your friends... First there is a limit of 250,000 USD, so fine on this point. Second is only licensed dealers can participate in FX. In your case, it can appear that you are acting as dealer.
On getting money back, this looks like gift and if it's more than 50,000 in a year it is taxable. Of course if you establish that it was convenience then no issues.
So you need good amount of documentation, plus if you are getting paid after few months, tax can treat this as personal loan and arrive at deemed interest.
There is no guideline as to what the income tax will ask you, if there is a scrutiny. One would need to have paper work, a letter from friend requesting you to purchase things. You would have to keep a record of items ordered and match it with credit card statement. Proof that the goods were delivered to his address. Proof of equivalent credit entry from your friend into your bank statement. Reason why your friend could not do this himself. i.e. what is stopping him from getting a international debit/credit card?
So if you think you can convince that its convenience, yes, else taxes.