Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ApplePay iOS Error on PKInAppPaymentService connection - com.apple.passd.in-app-payment - Connection to remote alert view service failed

While trying to integrate Apple Pay into my test app, I couldn't get the payment sheet to show up, even though I followed all instructions in Apple's Getting Started with Apple Pay document.

When making the payment request:

PKPaymentAuthorizationViewController *auth = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:paymentRequest];

I get two weird errors, with no results on web searches:

Error on PKInAppPaymentService connection: Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)" (connection to service named com.apple.passd.in-app-payment) UserInfo=0x174273780 {NSDebugDescription=connection to service named com.apple.passd.in-app-payment}

Connection to remote alert view service failed

like image 871
y2chaits Avatar asked Oct 21 '14 00:10

y2chaits


3 Answers

After following the four steps in Apple's getting started doc, the solution is hidden step number 5:

Enable Apple Pay in your project settings, on the Capabilities tab. This is arguably part of step 4 in Apple's doc, but the step that really tripped me up was checking on the merchant id as shown in the screenshot below:

Enable Apple Pay - Screenshot

Edit: Also see answer from @ChristopherJones if you still have trouble.

(Make sure the merchantId you use with a payment request is exactly the same as the one in your Apple Pay capabilities section. Remove the alphanumeric stuff in the beginning if you included it.)

After that, just build and run again.

like image 155
y2chaits Avatar answered Nov 15 '22 19:11

y2chaits


Also can happen if you subclass from PKPaymentRequest and feed your subclass to PKPaymentAuthorizationViewController

like image 36
Taras Kalapun Avatar answered Nov 15 '22 19:11

Taras Kalapun


I had this same issue and the problem was you have to make sure your PKPaymentRequest's merchantIdentifier matches exactly without the random number. Also, you need to make sure that the same identifier is check marked in the Capabilities tab.

PKPaymentRequest *request = [PKPaymentRequest new];
request.merchantIdentifier = @"merchant.com.example";
like image 20
Christopher Jones Avatar answered Nov 15 '22 20:11

Christopher Jones