Short answer: at least 25 mm wide, with strong contrast and a clear border of about four modules.
Why: a phone camera needs to see each small square as its own dot. A 0.4 mm nozzle prints lines about 0.4 mm wide, so a code with many small squares needs more room. If the squares come out fuzzy, the scan fails.
Rules of thumb: - Print the code at least 25 mm wide. Larger is safer. - Use raised or sunk-in squares, and add contrast with two colors or a little paint. - Keep a quiet border of about four squares on every side. - Print a 10 minute test piece and scan it with your phone before the full print.
Shapiful makes the QR code in your browser and puts it on a flat face or on a tag. You download the STL and print as usual.
Try it: https://www.shapiful.com/?utm_source=mataroa&utm_medium=social&utm_campaign=qr_oct26