It is not legal to buy Cocaine or any class A drug in the UK.
If you are caught purchasing cocaine online, you may be subject to legal consequences. Depending on the amount of cocaine involved, a misdemeanor or felony may be charged. In addition, your name would be added to a criminal database, which could make it challenging to find a job or housing in the future.