When you test billing feature on a physical device, you are not interacting with Production servers (live servers), but instead your app will be using Sandbox servers.

And that means you can test the features without fear of getting charged on iOS. However on Android, you will be charged but will get a refund in 14 days.

In iOS device, for testing functionalities you need to setup Sandbox test user accounts in iTunes Connect and also ensure that you are logged out of the Store with real account.

Android has more checklist, have a look at Troubleshooting section.