If your Beoplay H4 2nd Gen is added to the Bang & Olufsen app, you can find the 8-digit serial number under "Product information -> Product settings -> About." The Bang & Olufsen app is available for download from the App Store and Google Play Store.
Alternatively, the serial number can be found on the packaging of Beoplay H4 2nd Gen. If these options are not available, it is the 8-digit number printed at the site of the left earcup.