As a tourist in Japan, you are able to shop for a lot of goods Tax-Free, meaning you can get it for a cheaper price than residents of Japan.
There are two different types of Tax-Free shopping procedures, the procedure depends on the store. The first one is to present your passport during the payment, at this moment they will deduct the tax from the price instantly. The second one is to pay the full price, including tax, and then head to the tax-free counter on the day of purchase. Then, you will have to show your passport and receipt here and you will get a refund of the tax. You will have to sign a receipt, as proof that you got the products tax-free and you bought it for yourself. The cashier will then staple the receipt in your passport. You are not allowed to remove this yourself!
At the airport, while leaving Japan, the customs officials will confirm your passport and the goods that you have bought tax-free. Officially, you need to carry the tax-free products that are listed on the receipts with you, since there is a chance they might check it. After they have confirmed the passport and the goods, they will take the receipt out of your passport and you will be able to leave the country again.