Hi there,
We're experiencing difficulties setting up Apple Pay for our native macOS app written in Swift. The main issue seems to be with the "Apple Pay Merchant Identity" configuration.
When setting up the Merchant ID on the Apple Developer portal (https://developer.apple.com/account/resources/certificates/list), the only available platform listed is iOS. There's no option for us to add macOS to the supported platforms.
Our app uses PKPaymentAuthorizationController to present the Apple Pay sheet, but it fails immediately with a "Payment Not Completed" error. The macOS Console.app shows:
com.apple.PassKit.PaymentAuthorizationUIExtension - Payment failed with fatal error <private>
PKPeerPaymentService XPC Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.passd.peer-payment was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.passd.peer-payment was invalidated: failed at lookup with error 159 - Sandbox restriction.}
We've verified that our code works correctly on iOS, but we can't get it functioning on macOS. It seems like adding Apple Pay to a macOS app might not be fully supported, although the developer docs outline support for macOS.
Additionally, we suspect this could be an issue with sandboxing.
Are there additional steps or configurations required for Apple Pay on macOS that differ from iOS? Any guidance on properly setting up Apple Pay for a native macOS app would be greatly appreciated.
Thanks for the quick response and for the additional context. The intention of my prior reply was to provide the expectations for both web and native Mac apps, and now realize I failed to mention the latter.
For macOS apps (using the merchant session-based authentication), the initiative should use "in_app"
, and the initiativeContext should use the app's Developer Team ID.
I've made a note to get this expectation included in the documentation and integration guide (r. 132814540).
Cheers,
Paris