Apple Pay works by storing credit card and debit card information securely on a user's device. During a transaction, it uses a process called tokenization to ensure that the actual card details are never shared with the merchant. Instead, a unique token is generated for each transaction. This adds a layer of security and minimizes the risk of fraud.