Get macOS AppleID

How can I know the email related to the AppleID of the user who is using my application?
Or… when a user is purchasing an InApp product, how do I know which AppleID is buying?

Ask the user for an email.

Otherwise: you don’t get it.

apple is jealously keeping that in a complete secret… you will never get it !

Ok… But my App is free, and if the user wants it can buy an InApp subscription with greater functionality.
I can know when the user buys the first subscription because he does it from the App. But I do not know when the user renews.
In the InApp receipts there are no references to the Apple user.

You can use StoreKit classes, e.g. with MBS Xojo Plugins.

So you can see what client purchased by checking transactions.
Also check AppReceiptIAPMBS class to read the receipt of the app. When you buy an add-on, you should get a new receipt stating what you bought including expiration date.

Ok, thank you. I have MBS Xojo Plugin, will try it.

But if the same user change the Mac, and redownload my App, how do I know that the user on this new computer is the same one who bought with another computer? bcs in my App the user has some settings, and I would like to repeat them even if the user changes computers.

Well, you could check what two receipts have in common.