applepay - How to get email and phone number from Apple Pay using Swift -


i'm able retrieve data apple pay including encrypted payment data, first name, last name, , billing address. cannot, however, seems figure out how retrieve phone number , email address "contact" section displayed during apple pay checkout. need retrieve these values can submit them downstream payment provider. please help:

extension viewcontroller: pkpaymentauthorizationviewcontrollerdelegate {      /* user has authorized payment */     func paymentauthorizationviewcontroller(controller: pkpaymentauthorizationviewcontroller!, didauthorizepayment payment: pkpayment!, completion: ((pkpaymentauthorizationstatus) -> void)!) {          //declare dictionary of request parameters         var parameters = dictionary<string, string>()          //get encrypted payment data 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 abrecord format , assign accordingly         let addressproperty: abmultivalueref = abrecordcopyvalue(billingaddress, kabpersonaddressproperty).takeunretainedvalue() 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 obtain these apple pay!         parameters["billto_email"] = "null@sample.com"         parameters["billto_phonenumber"] = "5555555555" 

you can try

let emails: abmultivalueref = abrecordcopyvalue(billingaddress, kabpersonemailproperty).takeretainedvalue() abmultivalueref   if abmultivaluegetcount(emails) > 0 {     let email = abmultivaluecopyvalueatindex(emails, 0).takeretainedvalue() string     nslog(email)     }