Apple Pay Essentials
By Bruce Ernest
()
About this ebook
Harness the power of Apple Pay in your iOS apps and integrate it with global payment gateways
About This Book- Be it adding an Apple Pay button to your app or calculating sales tax with Apple Pay- this book gives you all the information you need to build a fully-functional Apply Pay application
- Paying within iOS Apps made easier and secure with this no nonsense and powerful guide
- Escape tedious payment options by creating compelling product card screens that present the Pay button, which your customers can tap to quickly order your products
This book is for anyone who wants to integrate Apple Pay in their applications. Basic familiarity with programming and the Xcode developer tools is expected.
What You Will Learn- Design a product card that includes the Apple Pay button
- Implement the Apple Pay workflow in an efficient way
- Use NSDecimalNumber objects to perform financial calculations accurately
- Manage custom order information in the Apple Pay workflow and your custom order management system
- Extract payment information from a payment token
- Implement a secure, server-side payment-processor program
- Find out everything you wanted to know about Apple Pay in iOS 9
Apple Pay, one of the most talked about offerings of the latest iOS 9 release, is a digital wallet and electronic payment system developed by Apple Inc. Paying in stores or within apps has never been easier or safer. Gone are the days of searching for your wallet, and the wasted moments finding the right card! Now you can use your credit cards and rewards cards with just a touch.
It allows payment to merchants, using Near field Communication (NFC), and within iOS apps. Implementing Apple Pay within apps for payment is a bit tricky, but our book solves this problem for you.
Whether you are a brand new iOS app developer or a seasoned expert, this book arms you with necessary skills to successfully implement Apple Pay in your online-payment workflow.
Whether you are a brand new iOS app developer or a seasoned expert, this book arms you with the necessary skills to successfully implement Apple Pay. We start off by teaching you how to obtain the certificates necessary to encrypt customers' payment information. We will use Xcode and Objective C for the interface and Node.js for server side code. You will then learn how to determine whether the customer can use Apple Pay, and how to create payment requests. You will come to grips with designing a payment-processor program to interact with the payment gateway. Finally, we take a look at a business-focused view of Apple Pay protocols and classes.
By the end of this book, you will be able to build a fully functional Apple Pay-integrated iOS app
Style and approachThis is an easy-to-follow guide on integrating Apple Pay in your iOS Application. With step by step instructions along with excellent screen shots you will be able to learn everything that you wanted to know about Passbook and Apple Pay in iOS 8.
Related to Apple Pay Essentials
Related ebooks
Apple Pay Essentials Rating: 0 out of 5 stars0 ratingsBuilding Bots with Microsoft Bot Framework Rating: 0 out of 5 stars0 ratingsPassbook App Development for iOS How-to: Create and customize a Passbook Pass with the exciting new iOS features. Rating: 0 out of 5 stars0 ratingsMEAN Blueprints Rating: 0 out of 5 stars0 ratingsRuby on Rails Web Mashup Projects Rating: 0 out of 5 stars0 ratingsLearning Bing Maps API Rating: 0 out of 5 stars0 ratingsASP.NET Web API Security Essentials Rating: 0 out of 5 stars0 ratingsMicrosoft Azure IaaS Essentials Rating: 4 out of 5 stars4/5.NET Core 2.0 By Example: Learn to program in C# and .NET Core by building a series of practical, cross-platform projects Rating: 0 out of 5 stars0 ratingsBuilding RESTful Web services with Go: Learn how to build powerful RESTful APIs with Golang that scale gracefully Rating: 0 out of 5 stars0 ratingsBuilding Bots with Node.js Rating: 0 out of 5 stars0 ratingsAngular Services Rating: 0 out of 5 stars0 ratingsModular Programming with PHP 7 Rating: 0 out of 5 stars0 ratingsSwift Essentials Rating: 0 out of 5 stars0 ratingsLearning SAP BusinessObjects Dashboards Rating: 0 out of 5 stars0 ratingsMastering Android Application Development Rating: 5 out of 5 stars5/5Mastering ASP.NET Core 2.0: MVC patterns, configuration, routing, deployment, and more Rating: 0 out of 5 stars0 ratingsJavaScript by Example Rating: 0 out of 5 stars0 ratingsOracle JET for Developers: Implement client-side JavaScript efficiently for enterprise Oracle applications Rating: 0 out of 5 stars0 ratingsBuilding Web Apps with Spring 5 and Angular Rating: 0 out of 5 stars0 ratingsDjango 1.2 e-commerce Rating: 3 out of 5 stars3/5Microsoft Dynamics NAV 2009: Professional Reporting Rating: 0 out of 5 stars0 ratingsBootstrap for ASP.NET MVC - Second Edition Rating: 0 out of 5 stars0 ratingsApache Superset Quick Start Guide: Develop interactive visualizations by creating user-friendly dashboards Rating: 0 out of 5 stars0 ratings
Programming For You
Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Learn Python in 10 Minutes Rating: 4 out of 5 stars4/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Grokking Simplicity: Taming complex software with functional thinking Rating: 4 out of 5 stars4/5Python Machine Learning By Example Rating: 4 out of 5 stars4/5Beginning C++ Programming Rating: 3 out of 5 stars3/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5Grokking Artificial Intelligence Algorithms Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python for Finance Cookbook: Over 50 recipes for applying modern Python libraries to financial data analysis Rating: 0 out of 5 stars0 ratingsMicroservices Architecture Handbook: Non-Programmer's Guide for Building Microservices Rating: 4 out of 5 stars4/5Narrative Design for Indies: Getting Started Rating: 4 out of 5 stars4/5Learn Algorithmic Trading: Build and deploy algorithmic trading systems and strategies using Python and advanced data analysis Rating: 0 out of 5 stars0 ratingsTensorFlow in 1 Day: Make your own Neural Network Rating: 4 out of 5 stars4/5Mastering C# and .NET Framework Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5How To Become A Data Scientist With ChatGPT: A Beginner's Guide to ChatGPT-Assisted Programming Rating: 4 out of 5 stars4/5Learn NodeJS in 1 Day: Complete Node JS Guide with Examples Rating: 3 out of 5 stars3/5
Reviews for Apple Pay Essentials
0 ratings0 reviews
Book preview
Apple Pay Essentials - Bruce Ernest
Table of Contents
Apple Pay Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Apple Pay
An overview of the online payment process
The Apple Pay payment workflow
Presenting the Apple Pay button
Creating the payment request
Presenting the payment sheet
Responding to order changes and payment authorization
Submitting the payment information to the payment gateway
Enabling Apple Pay in your app
Creating your app's Apple Pay merchant identifier
Installing your app's Apple Pay merchant certificate on your Mac
Enabling Apple Pay in your app's Xcode project
Summary
2. Payment Request Workflow
Getting information from an inventory service
Getting inventory information
Getting shipping information
Displaying the product card
Presenting product information
Presenting the Apple Pay button
Creating the payment request
Specifying payment details
Country and currency code
Merchant identifier and capabilities
Requiring shipping and billing information
Requiring shipping or billing addresses
Specifying shipping or billing addresses
Specifying shipping methods
Specifying summary items
Specifying custom information tied to the order
Summary
3. Payment Authorization Workflow
Actors and operations in the authorization workflow
Implementing a shared method to compute summary items
Responding to user interactions with the payment sheet
User changes shipping information
User changes shipping method
User authorizes payment request
Summary
4. Payment Processing Workflow
Actors and operations in the processing workflow
The preprocess phase
The merchant app receives the payment token
The merchant app receives the charge token from the payment gateway
The merchant app sends the order information to the order processing system
The process phase
The postprocess phase
The merchant app receives the transaction status from the order processing web app
The merchant app conveys the transaction status to the user
The merchant app dismisses the payment sheet
Summary
5. Designing an Order Management Server
Configuring an order management server web app
Defining order management data structures
Providing inventory information to clients
Processing orders from clients
Implementing secure communication
Summary
6. Apple Pay API Summary
Main classes
The PKPaymentButton class
Creating the button
+buttonWithType:style
The PKPaymentRequest class
Payment processing information
countryCode (NSString*)
currencyCode (NSString*)
merchantCapabilities (PKMerchantCapability)
merchantIdentifier (NSString*)
supportedNetworks (NSArray
Payment summary items
paymentSummaryItems (NSArray
The required address fields
requiredBillingAddressFields (PKAddressField), requiredShippingAddressFields (PKAddressField)
Billing and shipping contacts
billingContact (PKContact*), shippingContact (PKContact*)
Shipping methods
shippingMethods (NSArray
Shipping type
shippingType (PKShippingType)
Application data
applicationData (NSData*)
The PKPaymentSummaryItem class
Creating a summary item
+summaryItemWithLabel:amount:
+summaryItemWithLabel:amount:type:
Summary item components
label (NSString*)
amount (NSDecimalNumber*)
Pending or final
type (PKPaymentSummaryItemType)
The PKPaymentMethod class
Card tame
displayName (NSString*)
Card type
type (PKPaymentMethodType)
Payment network
network (NSString*)
Payment pass
paymentPass (PKPaymentPass*)
The PKShippingMethod class
User-friendly description
detail (NSString*)
App-level identifier
identifier (NSString*)
The PKPaymentAuthorizationViewController class
Determining Apple Pay support
+canMakePayments
+canMakePaymentsUsingNetworks:
+canMakePaymentsUsingNetworks:capabilities:
Initializing and presenting
-initWithPaymentRequest:
-initWithPaymentRequest:
Payment sheet delegate
delegate id
The PKPayment class
Payment information
token (PKPaymentToken*)
Billing and shipping contacts
billingContact (PKContact*)
shippingContact (PKContact*)
shippingMethod
The PKPaymentToken class
Encrypted payment information
paymentData (NSData*)
Payment method and transaction identifier
paymentMethod (PKPaymentMethod*)
transactionIdentifier (NSString*)
Payment sheet user event protocol
The PKPaymentAuthorizationViewControllerDelegate protocol
The user chooses a payment card
-paymentAuthorizationViewController:didSelectPaymentMethod: completion:
The user selects a shipping address
-paymentAuthorizationViewController:didSelectShippingContact: completion:
The user selects a shipping method
-paymentAuthorizationViewController:didSelectShippingMethod: completion:
The user authorizes the payment request
-paymentAuthorizationViewControllerWillAuthorizePayment:
-paymentAuthorizationViewController:didAuthorizePayment: completion:
The payment sheet is done
-paymentAuthorizationViewControllerDidFinish:
Auxiliary classes
The PKContact class
Contact address components
emailAddress (NSString*)
name (NSPersonNameComponents*)
phoneNumber (CNPhoneNumber*)
postalAddress (CNPostalAddress*)
The NSPersonNameComponents class
Person name components
namePrefix (NSString*)
givenName (NSString*)
middleName (NSString*)
familyName (NSString*)
nameSuffix (NSString*)
nickname (NSString)
phoneticRepresentation (NSPersonNameComponents*)
The CNPhoneNumber class
Creating a phone number
+phoneNumberWithStringValue:
Phone number string
stringValue (NSString*)
The CNPostalAddress class
Postal address components
street (NSString*)
city (NSString*)
state (NSString*)
postalCode (NSString*)
country (NSString*)
ISOCountryCode (NSString*)
Summary
Index
Apple Pay Essentials
Apple Pay Essentials
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: February 2016
Production reference: 1190216
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-638-6
www.packtpub.com
Credits
Author
Ernest Bruce
Reviewer
Zeeshan Chawdhary
Commissioning Editor
Veena Pagare
Acquisition Editor
Kirk D'Costa
Content Development Editor
Preeti Singh
Technical Editor
Siddhesh Patil
Copy Editors
Shruti Iyer
Priyanka Ravi
Project Coordinator
Shweta H Birwatkar
Proofreader
Safis Editing
Indexer
Rekha Nair
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
About the Author
Ernest Bruce is an accomplished technical writer and software engineer. He has worked for 13 years at Apple, Inc., where he held the position of Senior Technical Writer writing developer documentation. At Apple, Ernest specialized in writing documentation for the Xcode toolset, focusing on the Xcode user guide, and Xcode overview, as well as unit testing documentation and sample code. He also worked extensively on API documentation for the OS X and iOS platforms. Ernest helped design and develop the Xcode help articles that aid developers in getting around the user interface of the Xcode app. Before his years at Apple, Ernest worked as a programmer for Ping, Inc., where he helped manage the manufacturing processes using APL (A Programming Language). Ernest also has extensive experience in customer service, which has been instrumental to him developing content that readers find clear and easy to read, and that makes complex concepts more approachable.
Ernest is the head of Nerd Brawn, LLC, a software development company that focuses on developing platforms that help people learn about their environment and each other in innovative ways. The company is also working on new techniques to present content on desktop computers, tablets, and mobile phones.
About the Reviewer
Zeeshan Chawdhary has been dabbling with location-based technologies since 2007, having working with industry leaders like Foursquare, Google, and Yahoo in the LBS space. He is been working with startups for the past few years; e-commerce, location-based services, mobile apps – he has built them all, and scaled up for millions of users.
He is also an author, having written three books for Packt Publishing on iOS, Windows Phone, and iBooks Author respectively. He is currently writing another book on Ubuntu and getting his hands dirty with Android.
I would like to thank Packt Publishing for generously offering me books to review; it not only helps me learn new technologies but helps me strengthen what I know, as well as learn how other programmers work.
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers