How to transfer ICP to a dapp's account

I want the following:

  1. associate to each user’s principal in my dapp an ICP-holding account
  2. make it easy for a user to top-up this account

The first I don’t know to do, because I know about nns.icp0.app accounts, but I need this account not on nns.icp0.app but on app UI. So, how? (How a dapp can create an account for itself?)

The second, is there an easier way than the user manually copying&pasting the account address to nns.icp0.app to pay? The payments may be done by the user multiple times; should he/she copy&paste every time?

README.md explains how to do it. Particularly, it tells that

dfx ledger account-id --of-canister icp_transfer_backend

command can be used to know the account ID that the canister controls.

It remains the questions, however, how to do this in Motoko, rather than in dfx command line.

Here’s some Motoko functions you can copy/paste that I wrote a while back: memeployer/src/memeployer_backend/Account.mo at 07e5c69e7121f8524851124d36193a6edeb22d69 · sesi200/memeployer · GitHub