0

I am implementing apple pay for Canada, to know the location of user i should have his/her postal code to estimate shipping price. I input

H4A2R4

as my postal code as shipping address for ApplePay. when I am trying to get info from PKContact it just return me

H4A

. how can i have it completely ? my sample code :

- (NSString *)postCodeForContact:(PKContact *)contact {
  return contact.postalAdress.postalCode;
}

I also tried ABPersonRef and i got same result.

Ali
  • 287
  • 1
  • 2
  • 13

2 Answers2

1

Ali's answer is correct. You have all needed info in

- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
                   didAuthorizePayment:(PKPayment *)payment
                            completion:(void (^)(PKPaymentAuthorizationStatus status))completion;

Just access it via payment.shippingContact.postalAdress.postalCode and if you want the user to know his shipping address is incorrect, then call completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress) in the same method.

The Windwaker
  • 1,054
  • 12
  • 24
0

I found that this change has been made by Apple. you only get the full postcode when users applies their thumbprint.

https://forums.developer.apple.com/thread/15217

Ali
  • 287
  • 1
  • 2
  • 13