Book Image

Apple Pay Essentials

By : Ernest Bruce
Book Image

Apple Pay Essentials

By: Ernest Bruce

Overview of this book

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
Table of Contents (13 chapters)

Preface

Whether you are relatively new to iOS app development or a seasoned expert, Apple Pay Essentials provides the skills that you need to easily incorporate Apple Pay into the payment workflows of your apps. This book shows you how to obtain the certificates that ensure payment information is securely transmitted between the user's iOS device, your payment gateway, and the banks involved in an Apple Pay transaction. The book teaches you how to provide a simple and consistent user experience, which expedites the time between desire and acquire. You learn how to respond to changes that the user makes to your preconfigured payment sheet, which is where the user confirms or modifies order and payment details. This book guides you through the interactions that your app makes with your payment gateway and your order-processing system. Finally, this book shows you how to design a simple order-processing web app that processes orders and payments submitted by client apps.

What this book covers

Chapter 1, Getting Started with Apple Pay, describes how online payments work in general, and it introduces Apple Pay—a simpler and more secure online payment model. This chapter also shows you how to obtain the Apple Pay merchant certificates that ensure that only the appropriate entities have access to sensitive payment information.

Chapter 2, Payment Request Workflow, describes how to create a payment request, which is an object that stores information that is critical to payment processing (such as currency and payment network requirements) and details about the customer's order. It also shows you how to manage the main elements of the Apple Pay user experience: the Apple Pay button, and the payment sheet. This chapter also explains how to get inventory details from an order-processing web app, and how to present product information to the user.

Chapter 3, Payment Authorization Workflow, shows you how your app should respond to payment sheet events, such as shipping address change, and user authorization of the payment.

Chapter 4, Payment Processing Workflow, describes the actors and operations involved in processing a payment, including your order processing web app.

Chapter 5, Designing an Order Management Server, describes the main components of an order management server, including its data structure, and client API.

Chapter 6, Apple Pay API Summary, summarizes the API that is used for Apple Pay transactions.

What you need for this book

To follow along with the content presented in this book, which is based on the book's example code, you need the hardware and software needed for iOS development: a development Mac, an iOS device that supports Apple Pay, and a recent version of the Xcode developer tools. You need to be able to build apps on your Mac and run them on the iOS device, which requires a wired connection between the computer and the device (so that Xcode can install the app on the device). When running the example app on iOS Simulator, the example app connects to the order management web app running on the computer through a URI that targets the appropriate process. When running the app on the iOS device, however, the connection must be done wirelessly. Therefore, you need to configure your development Mac as a proxy server so that HTTP requests to the order management web app from the iOS device are resolved by the web app on the computer and do not go to the wider network. The documentation in the example code explains how to configure your development Mac as a proxy server using the SquidMan proxy-server software.

Who this book is for

This book is intended for people who want to learn how to incorporate Apple Pay into their iOS apps so that their customers can pay for goods and services quickly and securely. A moderate knowledge of the iOS API and the Xcode developer tools is required.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Enter the identifier string in the ID field—for example, merchant.com.company.merchantapp."

A block of code is set as follows:

PKContact contact= [PKContact new];
contact.phoneNumber= 
  [CNPhoneNumber phoneNumberWithStringValue: @"678-555-1234"];

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

- (void) paymentAuthorizationViewControllerDidFinish:
            (PKPaymentAuthorizationViewController*) controller
{
   [self dismissViewControllerAnimated:true completion:nil];
}

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Under iOS Apps, click on Identifiers."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.