First, you need to create a sandbox account in App Store Connect.
Then, on an actual device, go to Settings > Developer and scroll to the bottom. There's a "Sign In" button below the "SANDBOX APPLE ACCOUNT" heading. Sign in with the email and password of your new sandbox account.
You can then make purchases and refunds in your app on the device.
Try that, and if it doesn't work, come back and tell us exactly what steps you take, and tell us the exact text you see on the screen. As @endecotp said, we don't know what you mean, so being a little clearer would help.
Topic:
App & System Services
SubTopic:
StoreKit
Tags: