Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2020 App Services

WWDC20 · 15 min · App Services

What’s new in Wallet and Apple Pay

Apple Pay makes it simple to pay for goods and services in your app and on your website. Discover how you can integrate API updates like context-specific button types, contact data formatting, and cross-platform support to make the service more effective for you and people using it. And, if you’re building app clips, adopting Apple Pay can help you unlock new commerce experiences.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 1 snippet

Implementing Apple Pay on the Mac swift · at 7:44 ↗
// PKPaymentAuthorizationControllerDelegate 

func presentationWindow(for controller: PKPaymentAuthorizationController) -> UIWindow? {
    let purchaseWindow = yourViewController.view.window
    return (purchaseWindow) // The window presenting the payment sheet.
}


func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didRequestMerchantSessionUpdate handler: @escaping (PKPaymentRequestMerchantSessionUpdate) -> Void) {
    // Get merchant session to enable the user to authorize a transaction.
    var dict = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any] {
        let session = PKPaymentMerchantSession(dictionary: dict)
        let update = PKPaymentRequestMerchantSessionUpdate(status: .success, merchantSession: session)
        handler(update)
    }
}

Resources