How to programatically fetch the unique ID of user who installed/paid the app

Hello,

Which API can be used to programatically fetch the ID of user who installed/paid the app?

This is useful if an app has to create a path hierarchy for different users who have installed/paid the app, for instance, /AppName/<uniqueUserID>/user_files, how to get the uniqueUserID, and also, to get the information about which user these files belong to based on this uniqueUserID.

App is using Swift, SwiftUI.

Thanks.