The blockchain.info API for XPUBs only works with Legacy Bitcoin XPUBs, whereas their web interface confusingly works with Segwit as well.
I provide a couple solutions at the end, and we end up with three useful functions:
legacy_wallet_balance
segwit_wallet_balance
segwit_wallet_balance_hack