Hi David,
Welcome to Microsoft Community. If your Microsoft Flex Keyboard is not charging and is still under warranty, you can contact Microsoft Support to initiate a warranty return or repair. Here’s how you can proceed: Contact Us - Microsoft Support
I hope this helps. If there is anything not clear, please do not hesitate to let me know.Your SincerelyHahn. W - MSFT | Microsoft Community Support Specialist