integrating passbook into your ecosystem · 2016. 7. 9. · these are confidential...

116
These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook into Your Ecosystem Joelle Lam Engineering Manager

Upload: others

Post on 13-Oct-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

These are confidential sessions—please refrain from streaming, blogging, or taking pictures

Session 303

Integrating Passbook into Your Ecosystem

Joelle LamEngineering Manager

Page 2: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

PassbookRe-imagine what’s in your pocket

Page 3: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

PassbookEnriching customer experiences via iOS technologies

Page 4: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Apple Store Gift CardA pass implementation

Page 5: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Overview

•Apple Store Gift Card• Leveraging Existing Systems•Determining Complexity•Web Services Tips and Tricks

Page 6: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Lifecycle reviewApple Store Gift Card

Page 7: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

LifecycleApple Store gift card

Update gift card

Delivergift card

Redeemgift card

Passbook

Page 8: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Getting Apple Store gift card to the right userDeliver the Pass

Page 9: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook
Page 10: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Deliver the PassStep One—purchase

Page 11: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Deliver the PassStep Two—populate gift card recipient details

Page 12: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Deliver the PassStep Three—user receives a gift card

Page 13: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Deliver the PassStep Four—user clicks add to Passbook

Page 14: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Deliver the PassStep Five—user receives Apple Store gift card

Text

Page 15: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Apple Store gift card goalsDeliver the Pass

• Passbook should make it easier• Existing avenues shouldn’t get harder• Companion app not required• Integrate with existing systems

Page 16: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Using Apple Store gift card on web or in the storeUse the Pass

Page 17: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Use the PassPurchase inside Apple retail store

Page 18: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Use the PassPurchase on the web or on the phone

Page 19: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Apple Store gift card goalsUse the Pass

• Leverage existing systems■ Retail store

■ Point of sale device■ Optical scanners

■ Web■ Phone

•Human factor

Page 20: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Our retail employeesHuman Factor

• Retail employees• Build a great point of sale user interface•Which scanner do I use?

■ Laser scanner■ Optical scanner

Page 21: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Barcodes

GTIN-12

EAN-13

Code 93

1-Dimensional

Page 22: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

GTIN-12

EAN-13

Code 93

1-Dimensional

Barcodes

PDF-417

QR Code

Aztec

2-Dimensional

Page 23: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Our retail employeesHuman Factor

• Target user-experience consistency

Page 24: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Updating Apple Store gift cardUpdate the Pass

Page 25: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Keeping our passes aliveFeedback Loop

•Once a redemption occurs, update the pass• Feeds back into human factor•Use Apple Push Notification service

Page 26: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Lifecycle reviewApple Store Gift Card

Page 27: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Abstraction 101Leveraging Your Existing Systems

Page 28: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 29: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 30: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 31: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 32: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 33: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 34: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 35: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 36: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database Database

Systems Diagram

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 37: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

EmailServicesDatabase

Order InductionApplications & Service LayerOrder ProcessorDatabase

Push to the Black Box

PhysicalGift CardServices

Point of SaleDevice

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 38: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Identify the Minimum Interface

PhysicalGift CardServices

PassbookServices

Point of SaleDevice

Page 39: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Identify the Minimum Interface

PhysicalGift CardServices

PassbookServices

1 Create the pass

Point of SaleDevice

Page 40: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Identify the Minimum Interface

PhysicalGift CardServices

PassbookServices

1 Create the pass

2 Identify thesource of truth

Point of SaleDevice

Page 41: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Identify the Minimum Interface

PhysicalGift CardServices

PassbookServices

1 Create the pass

2 Identify thesource of truth

3 Redeem the passPoint of Sale

Device

Page 42: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Identify the Minimum Interface

PhysicalGift CardServices

PassbookServices

1 Create the pass

2 Identify thesource of truth

3 Redeem the pass

4 Callback for update

Point of SaleDevice

Page 43: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Common Currency

PhysicalGift CardServices

PassbookServices

GCN

GCN

1 Create the pass

2 Identify thesource of truth

3 Redeem the pass

4 Callback for update

Point of SaleDevice

GCN

Page 44: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Value known by all interfacing systemsCommon Currency

•Gift card number• Club card number• Insurance policy number•Order number• Event ID• Event ID with a customer ID

Page 45: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Systems Diagram

EmailServices

PhysicalGift CardServices

Applications & Service Layer

Order Processor

Order Induction

Database DatabasePoint of Sale

Device

PassbookServices

PassbookStorage

ApplePush

NotificationService

PushServices

Push Queue

Page 46: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Identify the Minimum Interface

PhysicalGift CardServices

PassbookServices

1 Create the pass

2 Identify thesource of truth

3 Redeem the pass

4 Callback for update

Point of SaleDevice

Page 47: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

A way to anticipate the level of effortDetermining Complexity

Page 48: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Facets of Complexity

• Value•Uniqueness• Static vs. Dynamic• Scale• Systems Integration

Page 49: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Mountain Trail Signs

Page 50: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Value

Boarding PassesMovie TicketNewspaperCoupon

Page 51: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Value

Boarding PassesMovie TicketNewspaperCoupon

Page 52: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Uniqueness

Quantified useMultiple useSingle person

Multiple useMultiple person

Page 53: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Uniqueness

Quantified useMultiple useSingle person

Multiple useMultiple person

Page 54: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Static vs. Dynamic

Multi-stateTime sensitiveInformational

Page 55: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Static vs. Dynamic

Multi-stateTime sensitiveInformational

Page 56: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Scale

Many useMoreFew

1

Page 57: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Scale

Many useMoreFew

1

Page 58: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Systems Integration

100+ Printed paper, cards, desktop, mobile

Electronic onlyiPhone only

Page 59: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Systems Integration

100+ Printed paper, cards, desktop, mobile

Electronic onlyiPhone only

Page 60: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook
Page 61: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Don’t Assume

Page 62: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook
Page 63: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

=Complexity Better

Page 64: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

=Complexity Better

Page 65: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Summary—Facets of Complexity

• Value•Uniqueness• Static vs. dynamic• Scale• Systems integration

Page 66: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Something for every complexity levelWeb Services Tips and Tricks

Page 67: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Tips—Basic

• Review Pass Asset Sizes•Adhere to If-Modified-Since • Implement Logging Endpoints• Expect Dependency Outages

Page 68: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

One—Review Pass Asset Sizes

4 - 20 Kb

Page 69: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

One—Review Pass Asset Sizes

4 - 20 Kb

280 Kb

Page 70: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

One—Review Pass Asset Sizes

4 - 20 Kb

280 Kb

Page 71: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts performance and scalabilityReview Pass Asset Sizes

• Size your image assets appropriately for the pass• Set an upper limit for the size of pass• Log and/or alert if the pass size exceeds this limit

Page 72: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts performance, scalability, reliabilityTwo—Adhere to If-Modified-Since

• RFC 2616 • Lets clients make conditional requests • Required by Passbook• Reduces bandwidth usage

Page 73: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Adhere to If-Modified-SinceRequest response contents

Get Pass Request

Method: GETHeader:If-modified-since <timestamp>

Get Pass Response

HTTP Status: 200Header: Last-Modifed<timestamp>

Contents: PKPASS

Page 74: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Adhere to If-Modified-SinceRequest response contents

Get Pass Request

Method: GETHeader:If-modified-since <timestamp>

Get Pass Response

HTTP Status: 200Header: Last-Modifed<timestamp>

Contents: PKPASS

HTTP Status: 304

Page 75: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

It’s free feedbackThree—Implement Logging Endpoints

•Highly recommended • Passbook sends error message back to the log back endpoint•Human readable errors

https://webServiceURL/v1/log

Method: POST{ logs = [

“Server ignored the 'if-modified-since' header (date) and returned the full unchanged pass data for serial number”

]}

Page 76: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Four—Expect Dependency OutagesWith your own service

Page 77: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Four—Expect Dependency OutagesWith your own service

Apple StorePass

Services

Page 78: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Expect Dependency OutagesRedundancy is good

Apple StorePass

Services

Apple StorePass

Services

Page 79: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Expect Dependency OutagesDependencies will go down

Apple StorePass

Services

Apple StorePass

Services

Page 80: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Expect Dependency OutagesDependencies will go down

Apple StorePass

Services

Apple StorePass

Services

Location Services

Page 81: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Expect Dependency OutagesDependencies will go down

Apple StorePass

Services

Apple StorePass

Services

Location Services

Page 82: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Expect Dependency OutagesDependencies will go down

Apple StorePass

Services

Apple StorePass

Services

Location Services

Page 83: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Expect Dependency OutagesIs that dependency required?

Apple StorePass

Services

Apple StorePass

Services

Page 84: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts reliabilityExpect Dependency Outages

• Pass should be served with bare minimum assets even when dependencies are not responding■ Make default fallback data readily available for assets (images, text), locations

Page 85: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Tips—Intermediate

• Validate the Origin• Validate Significant Contents• Leverage Caching•Monitor

Page 86: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts performance, security and reliabilityOne—Validate the Origin

• It’s not sufficient to simply test if the card is valid•Make sure the pass came from you• Sign your pass and check your signature

Page 87: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Remember authentication tokenValidate the Origin

authenticationToken

Page 88: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Passbook package contentsValidate the Origin

description

pass.json

formatVersion organizationName

passTypeIdentifier serialNumber teamIdentifier

authenticationToken webServiceUrl

Page 89: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Web services with authorization headerValidate the Origin

• Register a device•Get latest version of a pass•Unregister a device

Register a device

Method: GETdeviceLibraryIdenfitier

passTypeIdentifierserialNumber

Headers:Authorization: ApplePass

84jhadk9587dlad...

Page 90: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Build your authentication token using HMACValidate the Origin

•HMAC—Keyed Hash Message Authentication Code (RFC2014)• Verify

■ Auth token is signed■ Key is private■ Strong enough against brute force

• Then auth token was created by you

Pick your message contents

HMAC it

Prepend some value

Page 91: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

hash_hmacOpenSSL::HMAC

hmac.newBouncy Castle

Validate the OriginEvery language has it

Page 92: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts securityTwo—Validate Significant Contents

•Anyone can create a pass• The pass is not authoritative•Always check the source of truth

Page 93: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts performance, scalability, reliabilityThree—Leverage Caching

• Cache as much downstream data as possible■ Product services■ Location services■ Image services

• Cache encrypted and decrypted values for HMAC or authentication token• Consider caching the .pkpass file

Page 94: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts reliabilityFour—Monitor

• Be the first to know when your servers go down• There are numerous external websites that do monitoring

■ Build a query against one of your production test passes■ Validate response is status 200■ Check your pass size

• Internal logging systems■ Asset sizes■ Certificate expiration warnings (signing and push notifications)

• Internal monitoring

Page 95: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

For the most complex passesTips—Advanced

• Rate Limit• Process Asynchronously• Leverage AuthToken as Storage •Distinguish Dev and Prod Passes• Build in Debug-ability

Page 96: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts reliabilityOne—Rate Limit

• Prevents■ Denial of service attack■ Brute force attack

• Set high limits for IP based rules• Set lower limits based on serial numbers

Page 97: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts performance and scalabilityTwo—Process Asynchronously

• Pre-warm your caches (i.e. images)• Logs can be written to disk asynchronously•Use a queue for push notifications•Avoid holding connections open for long periods of time

Page 98: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Three—Leverage Auth Token as StorageImpacts performance and reliability

Page 99: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Three—Leverage Auth Token as StorageImpacts performance and reliability

You have serial number

Apple StorePass

Services

Page 100: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Three—Leverage Auth Token as StorageImpacts performance and reliability

You have serial number

Apple StorePass

Services

Get the gift card number and pin

Page 101: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Three—Leverage Auth Token as StorageImpacts performance and reliability

You have serial number

Apple StorePass

Services

Get the gift card number and pin

Database

Page 102: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Three—Leverage Auth Token as StorageImpacts performance and reliability

Look up gift card number and pin within the authentication token

Apple StorePass

ServicesDatabase

Page 103: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Three—Leverage Auth Token as StorageImpacts performance and reliability

Look up gift card number and pin within the authentication token

Apple StorePass

Services

Page 104: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Leverage Auth Token as StorageRemember authentication token

authenticationToken

Page 105: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Leverage Auth Token as StorageStore pass specific information inside the “message”

Pick your message contents

HMAC it

Prepend some value

Page 106: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Minimize your dependencies

• Store encrypted relevant data in authentication token to minimize your dependency on DB and increase your reliability• Items you could store

■ Product details - strip image url■ Gift card number or PIN numbers■ Important dates■ Nearest 10 locations

Leverage Auth Token as Storage

Page 107: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Four—Distinguish Test and ProductionRemember the pass type identifier

passTypeIdentifier

Page 108: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Distinguish Test and ProductionPassbook package contents

description

pass.json

formatVersion organizationName

passTypeIdentifier serialNumber teamIdentifier

authenticationToken webServiceUrl

Page 109: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Distinguish Test and Production

Production

pass.json

Test

pass.json

pass.com.store.giftcardpass.com.store.giftcardpass.com.store.giftcard

Page 110: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Distinguish Test and Production

Production

pass.json

Test

pass.com.store.giftcard.test

pass.json

pass.com.store.giftcardpass.com.store.giftcard

Page 111: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Impacts reliabilityFive—Build in Debugging

• Be ready to troubleshoot it in production• Leverage the back of pass for debug information•Have a test serial number for production • Turn on a flag on this test pass•Display extra information on the back of the pass

■ Host or data center■ Locations■ Last updated date

Page 112: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Summary

•Apple Store Gift Card• Leveraging Existing Systems•Determining Complexity•Web Services Tips and Tricks

Page 113: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

More Information

Paul Marcos App Services [email protected]

DocumentationPassbook Programming Guidehttp://developer.apple.com/passbook

Apple Developer Forumshttp://devforums.apple.com

Page 114: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Related Sessions

Harnessing iOS to Create Magic in Your Apps PresidioFriday 11:30AM

What’s New in Passbook Pacific HeightsWednesday 11:30AM

Page 115: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook

Labs

Passbook Lab Services Lab AWednesday 4:30PM

Page 116: Integrating Passbook into Your Ecosystem · 2016. 7. 9. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 303 Integrating Passbook