Apple Pay Enhancements

PDF for offline use:
Related Samples:

Let us know how you feel about this.


0/250
Thanks for the feedback!

last updated: 2016-08

This article covers the enhancements Apple has made to Apple Pay in iOS 10 and how to implement them in Xamarin.iOS.

Overview

Apple has made several enhancements to Apple Pay in iOS 10 that allow the user to make secure payments from websites and through interaction with Siri and Maps.

The following topics will be covered in detail:

About Apple Pay Enhancements

As Stated above, Apple has made several enhancements to Apple Pay in iOS 10 that allow the user to make secure payments from websites and through interaction with Siri and Maps.

With iOS 10, several new APIs have been added that work with both iOS and watchOS to support dynamic payment networks and a new sandbox test environment.

Apple Pay Website Integration

New to iOS 10, the developer can incorporate Apple Pay directly into their websites using ApplePay JS. Users browsing the website with Safari in iOS or macOS can make payments with Apple Pay by validating the transaction on their iPhone or Apple Watch. For more information, please see Apple's ApplePay JP Framework Reference.

PassKit Framework Enhancements

In iOS 10, the PassKit framework has been expanded to support Apple Pay outside of UIKit and to allow card issuers to present their own cards from within their apps.

Supporting Apple Pay Outside of UIKit

By using PKPaymentAuthorizationController and PKPaymentAuthorixationControllerDelegate, an app can support the same functionality provided by PKPaymentAuthorizationViewController without using UIKit. While this new API is required for supporting Apple Pay on the Apple Watch (and in specific Intents as well), it is optional in other situations (such as existing apps). However, Apple suggests moving to the new API as soon as possible to provide broad Apple Pay support throughout all of the developer's apps with a single code base. For more information about Intents and Siri integration, please see our Introduction to SiriKit documentation.

Presenting Issuer Cards from within Apps

With iOS 10, new features have been added to the PassKit framework that allow card issuers to present their cards from within their own apps. The developer can add a PKPaymentButtonTypeInStore UIButton to the app's user interface that will display an Apple Pay button for a card.

The PresentPaymentPass method of the PKPassLibrary class can also be used to programmatically display the card.

New Payment Network Support

New to iOS 10, an app can automatically support a new payment network when it becomes available without the developer having to modify, recompile the app and resubmit it to the App Store.

The new AvailableNetworks method of the PKPaymentNetwork class allows an app to discover the networks available on the user's device at runtime. Additionally, the SupportedNetworks property has been expanded to take the payment provider's name as an argument. Using these methods, an app can automatically support any network that the payment provider supports.

For more information, please see our Apple Pay Configuration and Apple's Apple Pay Guide.

New Testing Environment

With iOS 10, Apple introduced a new testing environment that allows the developer to provision test payment cards directly on an iOS device. This new testing environment then returns encrypted test payment data to the app.

To enable the new testing environment, do the following:

  1. Create a new testing iCloud Account in iTunes Connect.
  2. Log into the iOS device with the new testing account.
  3. Set the desired region to test the app in.
  4. Use one of the test payment cards from the Apple Pay Guide to make payments.

NOTE: By switching iCloud Accounts, the device will automatically switch to the new testing environment. However, Apple still requires the app to be tested with real cards in a production environment before submission to the iTunes App Store.

Summary

This article has covered the enhancements Apple has made to Apple Pay in iOS 10 and how to implement them in Xamarin.iOS.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.