I don’t know anything about publishing, if the book doesn’t perform, don’t you have to pay the advance back?
Sorry, didn't answer this part of your post! (Covid brain fog, yay).
You don't have to pay back. An advance is against earnings, so if you don't earn it back, you don't have to pay back, BUT it goes on your record and affects future deals. You will get smaller advances if you don't earn out, for example. If your advance was 50k but you only made 25k, then your next advance will probably be 20k or under. If you want to change publishers, this will follow you too. It's a tough business.
Or, like I'm guessing happened with Zoe and Amy's Magpie books, an intended longer series will be cut short if it doesn't earn back. The publisher bought two books, intending to see how they performed. They gave what was likely a good advance, expecting to cash in on Zoe's 9 million followers. But when the first book underperformed severely, they probably decided to cut their losses. They might have yanked away the option for more books completely, or they might have offered Zozo bean less money, prompting her to say no. We probably will never know, but Book 1's terrible sales definitely played a role, since Zoe initially talked about it as a "multibook series" and even the title with the numbers seemed to imply there'd be more.