title: Unable to dismiss PKPaymentAuthorizationViewController
body: <p>I am working on implementing Apple Pay for my Application. While I have everything mostly figured out, I am not able to dismiss the PKPaymentAuthorizationViewController that authenticates. 
  Here is my code..</p>
  
  <pre><code>-(void) viewDidAppear:(BOOL)animated {
      // request is initialized here.
      paymentPane = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
  
      //paymentPane is not nil. 
      paymentPane.delegate = self;
  
      [self presentViewController:paymentPane animated:TRUE completion:nil];
  }
  </code></pre>
  
  <p>The above function is called and successfully presents the Apple Pay View Controller to authenticate the payment. I have implemented the following methods from the delegate as follows: </p>
  
  <pre><code>-(void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewController *)controller {
      [self dismissViewControllerAnimated:YES completion:nil];
  }
  
  - (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didAuthorizePayment:(PKPayment *)payment completion:(void (^)(PKPaymentAuthorizationStatus))completion {
       NSLog(@"%@", [payment.token description]);
       completion(PKPaymentAuthorizationStatusSuccess);
  }
  </code></pre>
  
  <p>Ideally it hits the didAuthorizePayment first, where we authenticate the payment, and pass success if its successful, then the paymentAuthorizationViewControllerDidFinish is called and that is used to complete transaction and hide the Apple View Controller. I put breakpoints in there and it hits both functions, but the ViewController doesn't go away. It doesn't go even if you tap the Cancel button inside Apple Pay View. </p>
  
  <p>My class declaration is as follows and does implement the required delegates. </p>
  
  <pre><code>@interface ApplePayManager : UIViewController&lt;PKPaymentAuthorizationViewControllerDelegate, UIAlertViewDelegate&gt;
  </code></pre>
  
  <p>Any ideas on what I am doing wrong? Why is the view controller not dismissing? </p>
  
  <p>Lastly, I am a bit new to iOS. So I'd appreciate guides and/or links to clarify my doubts! </p>
  
  <p>Already looked at: 
  <a href="http://www.raywenderlich.com/87300/apple-pay-tutorial" rel="nofollow">http://www.raywenderlich.com/87300/apple-pay-tutorial</a>
  <a href="https://dzone.com/articles/integrating-your-ios-app-apple" rel="nofollow">https://dzone.com/articles/integrating-your-ios-app-apple</a></p>