Gateway Compatibility

Hi guys, I want to connect MKR 1310 to a lora gateway which then transmits data to a server.I don't have an Arduino Lora Pro Gateway so instead I want to use a RAK831.
Will this work, are these two compatible with each other or an Arduino Gateway is mandatory?
Thank you!

It is not mandatory. However, you need to set your module the same way the gateway is. Channel plan and frequency sub band need to match both in your gateway and in your module.