Answer:
Your first sentence uses the simple past (Did you buy ...?) and your second sentence uses the present perfect (Have you bought ...?). Sometimes there is a difference in meaning between these two forms, but in your example there is not.
In the sentence pairs below, there is a difference in meaning. The sentences in the simple past describe something that is over, while the sentences in the present perfect, have/had + the past participle, describe an action or situation that still continues in the present.
Simple past: I ate a lot of cake. (I’m finished eating cake.)
Present perfect: I’ve eaten a lot of cake. (I may eat more cake.)
Simple past: I lived in London for three years. (I don’t live in London anymore.)
Present perfect: I have lived in London for three years. (I still live in London.)
Simple past: Why didn’t you send me any messages? (The time for sending messages is over.)
Present perfect: Why haven’t you sent me any messages? (You can still send me a message.)
Explanation: