title: How to get email and phone number from Apple Pay using Swift
body: <p>I'm able to successfully retrieve all data from Apple Pay including encrypted payment data, first name, last name, and billing address. I cannot, however, seems to figure out how to retrieve the <strong>phone number</strong> and <strong>email address</strong> from the "contact" section displayed during Apple Pay checkout. I need to retrieve these values so I can submit them to my downstream payment provider. Please help: </p>
  
  <pre><code>extension ViewController: PKPaymentAuthorizationViewControllerDelegate {
  
      /* USER HAS AUTHORIZED PAYMENT */
      func paymentAuthorizationViewController(controller: PKPaymentAuthorizationViewController!, didAuthorizePayment payment: PKPayment!, completion: ((PKPaymentAuthorizationStatus) -&gt; Void)!) {
  
          //Declare a dictionary of request parameters
          var parameters = Dictionary&lt;String, String&gt;()
  
          //Get Encrypted Payment Data from AP
          parameters["encryptedPayment_data"] = payment.token.paymentData.base64EncodedStringWithOptions(nil)
  
          let billingAddress: ABRecord = payment.billingAddress
  
          parameters["billTo_firstName"] = ABRecordCopyValue(billingAddress, kABPersonFirstNameProperty).takeRetainedValue() as? String
          parameters["billTo_lastName"] = ABRecordCopyValue(billingAddress, kABPersonLastNameProperty).takeRetainedValue() as? String
  
          //Extract billing address from ABRecord format and assign accordingly
          let addressProperty: ABMultiValueRef = ABRecordCopyValue(billingAddress, kABPersonAddressProperty).takeUnretainedValue() as ABMultiValueRef
  
          if let dict: NSDictionary = ABMultiValueCopyValueAtIndex(addressProperty, 0).takeUnretainedValue() as? NSDictionary {
              parameters["billTo_street1"] = dict[String(kABPersonAddressStreetKey)] as? String
              parameters["billTo_city"] = dict[String(kABPersonAddressCityKey)] as? String
              parameters["billTo_state"] = dict[String(kABPersonAddressStateKey)] as? String
              parameters["billTo_postalCode"] = dict[String(kABPersonAddressZIPKey)] as? String
              parameters["billTo_country"] = dict[String(kABPersonAddressCountryKey)] as? String //"United States"
          }
  
          //Can't figure out how to obtain these from Apple Pay!
          parameters["billTo_email"] = "null@sample.com"
          parameters["billTo_phoneNumber"] = "5555555555"
  </code></pre>