├── .gitignore ├── ApplePayDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── jack.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── jack.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── ApplePayDemo.xcscheme │ └── xcschememanagement.plist ├── ApplePayDemo ├── AppDelegate.swift ├── ApplePayDemo.entitlements ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ShippingRateCalculator.swift └── ViewController.swift └── ApplePayDemoTests ├── ApplePayDemoTests.swift └── Info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | ApplePayDemo.xcodeproj/project.xcworkspace/xcuserdata/* -------------------------------------------------------------------------------- /ApplePayDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 040718D71A2E5B5D00F1FDC3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040718D61A2E5B5D00F1FDC3 /* AppDelegate.swift */; }; 11 | 040718D91A2E5B5D00F1FDC3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040718D81A2E5B5D00F1FDC3 /* ViewController.swift */; }; 12 | 040718DC1A2E5B5D00F1FDC3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 040718DA1A2E5B5D00F1FDC3 /* Main.storyboard */; }; 13 | 040718DE1A2E5B5D00F1FDC3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 040718DD1A2E5B5D00F1FDC3 /* Images.xcassets */; }; 14 | 040718E11A2E5B5D00F1FDC3 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 040718DF1A2E5B5D00F1FDC3 /* LaunchScreen.xib */; }; 15 | 040718ED1A2E5B5D00F1FDC3 /* ApplePayDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040718EC1A2E5B5D00F1FDC3 /* ApplePayDemoTests.swift */; }; 16 | 040718F81A2E936D00F1FDC3 /* ShippingRateCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040718F71A2E936D00F1FDC3 /* ShippingRateCalculator.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 040718E71A2E5B5D00F1FDC3 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 040718C91A2E5B5D00F1FDC3 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 040718D01A2E5B5D00F1FDC3; 25 | remoteInfo = ApplePayDemo; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 040718D11A2E5B5D00F1FDC3 /* ApplePayDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ApplePayDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 040718D51A2E5B5D00F1FDC3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 040718D61A2E5B5D00F1FDC3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 040718D81A2E5B5D00F1FDC3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | 040718DB1A2E5B5D00F1FDC3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 040718DD1A2E5B5D00F1FDC3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 36 | 040718E01A2E5B5D00F1FDC3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 37 | 040718E61A2E5B5D00F1FDC3 /* ApplePayDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApplePayDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 040718EB1A2E5B5D00F1FDC3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | 040718EC1A2E5B5D00F1FDC3 /* ApplePayDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplePayDemoTests.swift; sourceTree = ""; }; 40 | 040718F61A2E5E2500F1FDC3 /* ApplePayDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = ApplePayDemo.entitlements; sourceTree = ""; }; 41 | 040718F71A2E936D00F1FDC3 /* ShippingRateCalculator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShippingRateCalculator.swift; sourceTree = ""; }; 42 | /* End PBXFileReference section */ 43 | 44 | /* Begin PBXFrameworksBuildPhase section */ 45 | 040718CE1A2E5B5D00F1FDC3 /* Frameworks */ = { 46 | isa = PBXFrameworksBuildPhase; 47 | buildActionMask = 2147483647; 48 | files = ( 49 | ); 50 | runOnlyForDeploymentPostprocessing = 0; 51 | }; 52 | 040718E31A2E5B5D00F1FDC3 /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | 040718C81A2E5B5D00F1FDC3 = { 63 | isa = PBXGroup; 64 | children = ( 65 | 040718D31A2E5B5D00F1FDC3 /* ApplePayDemo */, 66 | 040718E91A2E5B5D00F1FDC3 /* ApplePayDemoTests */, 67 | 040718D21A2E5B5D00F1FDC3 /* Products */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | 040718D21A2E5B5D00F1FDC3 /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 040718D11A2E5B5D00F1FDC3 /* ApplePayDemo.app */, 75 | 040718E61A2E5B5D00F1FDC3 /* ApplePayDemoTests.xctest */, 76 | ); 77 | name = Products; 78 | sourceTree = ""; 79 | }; 80 | 040718D31A2E5B5D00F1FDC3 /* ApplePayDemo */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 040718F61A2E5E2500F1FDC3 /* ApplePayDemo.entitlements */, 84 | 040718D61A2E5B5D00F1FDC3 /* AppDelegate.swift */, 85 | 040718D81A2E5B5D00F1FDC3 /* ViewController.swift */, 86 | 040718F71A2E936D00F1FDC3 /* ShippingRateCalculator.swift */, 87 | 040718DA1A2E5B5D00F1FDC3 /* Main.storyboard */, 88 | 040718DD1A2E5B5D00F1FDC3 /* Images.xcassets */, 89 | 040718DF1A2E5B5D00F1FDC3 /* LaunchScreen.xib */, 90 | 040718D41A2E5B5D00F1FDC3 /* Supporting Files */, 91 | ); 92 | path = ApplePayDemo; 93 | sourceTree = ""; 94 | }; 95 | 040718D41A2E5B5D00F1FDC3 /* Supporting Files */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 040718D51A2E5B5D00F1FDC3 /* Info.plist */, 99 | ); 100 | name = "Supporting Files"; 101 | sourceTree = ""; 102 | }; 103 | 040718E91A2E5B5D00F1FDC3 /* ApplePayDemoTests */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 040718EC1A2E5B5D00F1FDC3 /* ApplePayDemoTests.swift */, 107 | 040718EA1A2E5B5D00F1FDC3 /* Supporting Files */, 108 | ); 109 | path = ApplePayDemoTests; 110 | sourceTree = ""; 111 | }; 112 | 040718EA1A2E5B5D00F1FDC3 /* Supporting Files */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 040718EB1A2E5B5D00F1FDC3 /* Info.plist */, 116 | ); 117 | name = "Supporting Files"; 118 | sourceTree = ""; 119 | }; 120 | /* End PBXGroup section */ 121 | 122 | /* Begin PBXNativeTarget section */ 123 | 040718D01A2E5B5D00F1FDC3 /* ApplePayDemo */ = { 124 | isa = PBXNativeTarget; 125 | buildConfigurationList = 040718F01A2E5B5D00F1FDC3 /* Build configuration list for PBXNativeTarget "ApplePayDemo" */; 126 | buildPhases = ( 127 | 040718CD1A2E5B5D00F1FDC3 /* Sources */, 128 | 040718CE1A2E5B5D00F1FDC3 /* Frameworks */, 129 | 040718CF1A2E5B5D00F1FDC3 /* Resources */, 130 | ); 131 | buildRules = ( 132 | ); 133 | dependencies = ( 134 | ); 135 | name = ApplePayDemo; 136 | productName = ApplePayDemo; 137 | productReference = 040718D11A2E5B5D00F1FDC3 /* ApplePayDemo.app */; 138 | productType = "com.apple.product-type.application"; 139 | }; 140 | 040718E51A2E5B5D00F1FDC3 /* ApplePayDemoTests */ = { 141 | isa = PBXNativeTarget; 142 | buildConfigurationList = 040718F31A2E5B5D00F1FDC3 /* Build configuration list for PBXNativeTarget "ApplePayDemoTests" */; 143 | buildPhases = ( 144 | 040718E21A2E5B5D00F1FDC3 /* Sources */, 145 | 040718E31A2E5B5D00F1FDC3 /* Frameworks */, 146 | 040718E41A2E5B5D00F1FDC3 /* Resources */, 147 | ); 148 | buildRules = ( 149 | ); 150 | dependencies = ( 151 | 040718E81A2E5B5D00F1FDC3 /* PBXTargetDependency */, 152 | ); 153 | name = ApplePayDemoTests; 154 | productName = ApplePayDemoTests; 155 | productReference = 040718E61A2E5B5D00F1FDC3 /* ApplePayDemoTests.xctest */; 156 | productType = "com.apple.product-type.bundle.unit-test"; 157 | }; 158 | /* End PBXNativeTarget section */ 159 | 160 | /* Begin PBXProject section */ 161 | 040718C91A2E5B5D00F1FDC3 /* Project object */ = { 162 | isa = PBXProject; 163 | attributes = { 164 | LastUpgradeCheck = 0610; 165 | ORGANIZATIONNAME = ""; 166 | TargetAttributes = { 167 | 040718D01A2E5B5D00F1FDC3 = { 168 | CreatedOnToolsVersion = 6.1; 169 | SystemCapabilities = { 170 | com.apple.OMC = { 171 | enabled = 1; 172 | }; 173 | }; 174 | }; 175 | 040718E51A2E5B5D00F1FDC3 = { 176 | CreatedOnToolsVersion = 6.1; 177 | TestTargetID = 040718D01A2E5B5D00F1FDC3; 178 | }; 179 | }; 180 | }; 181 | buildConfigurationList = 040718CC1A2E5B5D00F1FDC3 /* Build configuration list for PBXProject "ApplePayDemo" */; 182 | compatibilityVersion = "Xcode 3.2"; 183 | developmentRegion = English; 184 | hasScannedForEncodings = 0; 185 | knownRegions = ( 186 | en, 187 | Base, 188 | ); 189 | mainGroup = 040718C81A2E5B5D00F1FDC3; 190 | productRefGroup = 040718D21A2E5B5D00F1FDC3 /* Products */; 191 | projectDirPath = ""; 192 | projectRoot = ""; 193 | targets = ( 194 | 040718D01A2E5B5D00F1FDC3 /* ApplePayDemo */, 195 | 040718E51A2E5B5D00F1FDC3 /* ApplePayDemoTests */, 196 | ); 197 | }; 198 | /* End PBXProject section */ 199 | 200 | /* Begin PBXResourcesBuildPhase section */ 201 | 040718CF1A2E5B5D00F1FDC3 /* Resources */ = { 202 | isa = PBXResourcesBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | 040718DC1A2E5B5D00F1FDC3 /* Main.storyboard in Resources */, 206 | 040718E11A2E5B5D00F1FDC3 /* LaunchScreen.xib in Resources */, 207 | 040718DE1A2E5B5D00F1FDC3 /* Images.xcassets in Resources */, 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | 040718E41A2E5B5D00F1FDC3 /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXResourcesBuildPhase section */ 219 | 220 | /* Begin PBXSourcesBuildPhase section */ 221 | 040718CD1A2E5B5D00F1FDC3 /* Sources */ = { 222 | isa = PBXSourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | 040718D91A2E5B5D00F1FDC3 /* ViewController.swift in Sources */, 226 | 040718F81A2E936D00F1FDC3 /* ShippingRateCalculator.swift in Sources */, 227 | 040718D71A2E5B5D00F1FDC3 /* AppDelegate.swift in Sources */, 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | }; 231 | 040718E21A2E5B5D00F1FDC3 /* Sources */ = { 232 | isa = PBXSourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 040718ED1A2E5B5D00F1FDC3 /* ApplePayDemoTests.swift in Sources */, 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | /* End PBXSourcesBuildPhase section */ 240 | 241 | /* Begin PBXTargetDependency section */ 242 | 040718E81A2E5B5D00F1FDC3 /* PBXTargetDependency */ = { 243 | isa = PBXTargetDependency; 244 | target = 040718D01A2E5B5D00F1FDC3 /* ApplePayDemo */; 245 | targetProxy = 040718E71A2E5B5D00F1FDC3 /* PBXContainerItemProxy */; 246 | }; 247 | /* End PBXTargetDependency section */ 248 | 249 | /* Begin PBXVariantGroup section */ 250 | 040718DA1A2E5B5D00F1FDC3 /* Main.storyboard */ = { 251 | isa = PBXVariantGroup; 252 | children = ( 253 | 040718DB1A2E5B5D00F1FDC3 /* Base */, 254 | ); 255 | name = Main.storyboard; 256 | sourceTree = ""; 257 | }; 258 | 040718DF1A2E5B5D00F1FDC3 /* LaunchScreen.xib */ = { 259 | isa = PBXVariantGroup; 260 | children = ( 261 | 040718E01A2E5B5D00F1FDC3 /* Base */, 262 | ); 263 | name = LaunchScreen.xib; 264 | sourceTree = ""; 265 | }; 266 | /* End PBXVariantGroup section */ 267 | 268 | /* Begin XCBuildConfiguration section */ 269 | 040718EE1A2E5B5D00F1FDC3 /* Debug */ = { 270 | isa = XCBuildConfiguration; 271 | buildSettings = { 272 | ALWAYS_SEARCH_USER_PATHS = NO; 273 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 274 | CLANG_CXX_LIBRARY = "libc++"; 275 | CLANG_ENABLE_MODULES = YES; 276 | CLANG_ENABLE_OBJC_ARC = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 280 | CLANG_WARN_EMPTY_BODY = YES; 281 | CLANG_WARN_ENUM_CONVERSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 284 | CLANG_WARN_UNREACHABLE_CODE = YES; 285 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 286 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 287 | COPY_PHASE_STRIP = NO; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu99; 290 | GCC_DYNAMIC_NO_PIC = NO; 291 | GCC_OPTIMIZATION_LEVEL = 0; 292 | GCC_PREPROCESSOR_DEFINITIONS = ( 293 | "DEBUG=1", 294 | "$(inherited)", 295 | ); 296 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 304 | MTL_ENABLE_DEBUG_INFO = YES; 305 | ONLY_ACTIVE_ARCH = YES; 306 | SDKROOT = iphoneos; 307 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 308 | }; 309 | name = Debug; 310 | }; 311 | 040718EF1A2E5B5D00F1FDC3 /* Release */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 316 | CLANG_CXX_LIBRARY = "libc++"; 317 | CLANG_ENABLE_MODULES = YES; 318 | CLANG_ENABLE_OBJC_ARC = YES; 319 | CLANG_WARN_BOOL_CONVERSION = YES; 320 | CLANG_WARN_CONSTANT_CONVERSION = YES; 321 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 322 | CLANG_WARN_EMPTY_BODY = YES; 323 | CLANG_WARN_ENUM_CONVERSION = YES; 324 | CLANG_WARN_INT_CONVERSION = YES; 325 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 326 | CLANG_WARN_UNREACHABLE_CODE = YES; 327 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 328 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 329 | COPY_PHASE_STRIP = YES; 330 | ENABLE_NS_ASSERTIONS = NO; 331 | ENABLE_STRICT_OBJC_MSGSEND = YES; 332 | GCC_C_LANGUAGE_STANDARD = gnu99; 333 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 334 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 335 | GCC_WARN_UNDECLARED_SELECTOR = YES; 336 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 337 | GCC_WARN_UNUSED_FUNCTION = YES; 338 | GCC_WARN_UNUSED_VARIABLE = YES; 339 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 340 | MTL_ENABLE_DEBUG_INFO = NO; 341 | SDKROOT = iphoneos; 342 | VALIDATE_PRODUCT = YES; 343 | }; 344 | name = Release; 345 | }; 346 | 040718F11A2E5B5D00F1FDC3 /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | buildSettings = { 349 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 350 | CODE_SIGN_ENTITLEMENTS = ApplePayDemo/ApplePayDemo.entitlements; 351 | CODE_SIGN_IDENTITY = "iPhone Developer"; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | INFOPLIST_FILE = ApplePayDemo/Info.plist; 354 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | PROVISIONING_PROFILE = ""; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | }; 359 | name = Debug; 360 | }; 361 | 040718F21A2E5B5D00F1FDC3 /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 365 | CODE_SIGN_ENTITLEMENTS = ApplePayDemo/ApplePayDemo.entitlements; 366 | CODE_SIGN_IDENTITY = "iPhone Developer"; 367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 368 | INFOPLIST_FILE = ApplePayDemo/Info.plist; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | PROVISIONING_PROFILE = ""; 372 | TARGETED_DEVICE_FAMILY = "1,2"; 373 | }; 374 | name = Release; 375 | }; 376 | 040718F41A2E5B5D00F1FDC3 /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | BUNDLE_LOADER = "$(TEST_HOST)"; 380 | FRAMEWORK_SEARCH_PATHS = ( 381 | "$(SDKROOT)/Developer/Library/Frameworks", 382 | "$(inherited)", 383 | ); 384 | GCC_PREPROCESSOR_DEFINITIONS = ( 385 | "DEBUG=1", 386 | "$(inherited)", 387 | ); 388 | INFOPLIST_FILE = ApplePayDemoTests/Info.plist; 389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 390 | PRODUCT_NAME = "$(TARGET_NAME)"; 391 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ApplePayDemo.app/ApplePayDemo"; 392 | }; 393 | name = Debug; 394 | }; 395 | 040718F51A2E5B5D00F1FDC3 /* Release */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | BUNDLE_LOADER = "$(TEST_HOST)"; 399 | FRAMEWORK_SEARCH_PATHS = ( 400 | "$(SDKROOT)/Developer/Library/Frameworks", 401 | "$(inherited)", 402 | ); 403 | INFOPLIST_FILE = ApplePayDemoTests/Info.plist; 404 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 405 | PRODUCT_NAME = "$(TARGET_NAME)"; 406 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ApplePayDemo.app/ApplePayDemo"; 407 | }; 408 | name = Release; 409 | }; 410 | /* End XCBuildConfiguration section */ 411 | 412 | /* Begin XCConfigurationList section */ 413 | 040718CC1A2E5B5D00F1FDC3 /* Build configuration list for PBXProject "ApplePayDemo" */ = { 414 | isa = XCConfigurationList; 415 | buildConfigurations = ( 416 | 040718EE1A2E5B5D00F1FDC3 /* Debug */, 417 | 040718EF1A2E5B5D00F1FDC3 /* Release */, 418 | ); 419 | defaultConfigurationIsVisible = 0; 420 | defaultConfigurationName = Release; 421 | }; 422 | 040718F01A2E5B5D00F1FDC3 /* Build configuration list for PBXNativeTarget "ApplePayDemo" */ = { 423 | isa = XCConfigurationList; 424 | buildConfigurations = ( 425 | 040718F11A2E5B5D00F1FDC3 /* Debug */, 426 | 040718F21A2E5B5D00F1FDC3 /* Release */, 427 | ); 428 | defaultConfigurationIsVisible = 0; 429 | defaultConfigurationName = Release; 430 | }; 431 | 040718F31A2E5B5D00F1FDC3 /* Build configuration list for PBXNativeTarget "ApplePayDemoTests" */ = { 432 | isa = XCConfigurationList; 433 | buildConfigurations = ( 434 | 040718F41A2E5B5D00F1FDC3 /* Debug */, 435 | 040718F51A2E5B5D00F1FDC3 /* Release */, 436 | ); 437 | defaultConfigurationIsVisible = 0; 438 | defaultConfigurationName = Release; 439 | }; 440 | /* End XCConfigurationList section */ 441 | }; 442 | rootObject = 040718C91A2E5B5D00F1FDC3 /* Project object */; 443 | } 444 | -------------------------------------------------------------------------------- /ApplePayDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ApplePayDemo.xcodeproj/project.xcworkspace/xcuserdata/jack.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jflinter/ApplePayExample/1188aade4188f864b47283c79f678818abeb686e/ApplePayDemo.xcodeproj/project.xcworkspace/xcuserdata/jack.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ApplePayDemo.xcodeproj/xcuserdata/jack.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /ApplePayDemo.xcodeproj/xcuserdata/jack.xcuserdatad/xcschemes/ApplePayDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /ApplePayDemo.xcodeproj/xcuserdata/jack.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ApplePayDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 040718D01A2E5B5D00F1FDC3 16 | 17 | primary 18 | 19 | 20 | 040718E51A2E5B5D00F1FDC3 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ApplePayDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ApplePayDemo 4 | // 5 | // Created by Jack Flintermann on 12/2/14. 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 16 | application.setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false) 17 | return true 18 | } 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /ApplePayDemo/ApplePayDemo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.in-app-payments 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ApplePayDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ApplePayDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ApplePayDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ApplePayDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.test.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarStyle 34 | UIStatusBarStyleLightContent 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UIViewControllerBasedStatusBarAppearance 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /ApplePayDemo/ShippingRateCalculator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ShippingRateCalculator.swift 3 | // ApplePayDemo 4 | // 5 | // Created by Jack Flintermann on 12/2/14. 6 | // 7 | 8 | import UIKit 9 | import PassKit 10 | 11 | class ShippingRateCalculator: NSObject { 12 | 13 | class func defaultShippingMethod() -> PKShippingMethod { 14 | let shippingMethod = PKShippingMethod(label: "Shipping (Cost TBD)", amount: NSDecimalNumber(string: "0")) 15 | shippingMethod.identifier = "" 16 | shippingMethod.detail = "" 17 | return shippingMethod 18 | } 19 | 20 | class func fetchShippingRatesForAddress(address: ABRecord!, completion: (([PKShippingMethod]?, NSError?) -> Void)) { 21 | 22 | func urlForAddress(address: ABRecord!) -> NSURL { 23 | let base = "https://applepay-shipping-example.herokuapp.com/rates" 24 | let addressValues : CFTypeRef = ABRecordCopyValue(address, kABPersonAddressProperty).takeRetainedValue(); 25 | if ABMultiValueGetCount(addressValues) > 0 { 26 | var dict = ABMultiValueCopyValueAtIndex(addressValues, 0).takeRetainedValue() as NSDictionary 27 | var urlArgs = [String]() 28 | let keyMapping = [ 29 | String(kABPersonAddressStreetKey): "address", 30 | String(kABPersonAddressCityKey) : "city", 31 | String(kABPersonAddressStateKey) : "state", 32 | String(kABPersonAddressZIPKey) : "zip", 33 | String(kABPersonAddressCountryKey) : "country", 34 | ] 35 | for (key : String, value : String) in keyMapping { 36 | if let queryParam = dict[key] as String? { 37 | if let escapedQueryParam = queryParam.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) { 38 | urlArgs.append("\(value)=\(escapedQueryParam)") 39 | } 40 | } 41 | } 42 | let urlString = base + "?" + join("&", urlArgs) 43 | return NSURL(string: urlString) ?? NSURL(string: base)! 44 | } 45 | return NSURL(string: base)! 46 | } 47 | 48 | let url = urlForAddress(address) 49 | NSURLSession.sharedSession().dataTaskWithURL(url, completionHandler: { (data, response, error) -> Void in 50 | if (error != nil) { 51 | completion(nil, error) 52 | return 53 | } 54 | if data != nil { 55 | if let rawRates = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) as? [Dictionary] { 56 | let shippingMethods = map(rawRates, { (rate : [String : String]) -> PKShippingMethod in 57 | let label = rate["carrier"]! + " " + rate["service"]! 58 | let amount = NSDecimalNumber(string: rate["amount"]) 59 | let shippingMethod = PKShippingMethod(label: label, amount: amount) 60 | shippingMethod.identifier = rate["id"] 61 | shippingMethod.detail = rate["formatted_arrival_date"] ?? "" // make sure to set this, or it will display as (NULL) in the UI. 62 | return shippingMethod 63 | }) 64 | completion(shippingMethods, nil) 65 | return 66 | } 67 | } 68 | }).resume() 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ApplePayDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // ApplePayDemo 4 | // 5 | // Created by Jack Flintermann on 12/2/14. 6 | // 7 | 8 | import UIKit 9 | import PassKit 10 | 11 | class ViewController: UIViewController, PKPaymentAuthorizationViewControllerDelegate { 12 | 13 | override func viewDidAppear(animated: Bool) { 14 | if PKPaymentAuthorizationViewController.canMakePaymentsUsingNetworks([PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa]) { 15 | let request = PKPaymentRequest() 16 | request.supportedNetworks = [PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa] 17 | request.countryCode = "US" 18 | request.currencyCode = "USD" 19 | request.merchantIdentifier = "<#Replace me with your Apple Merchant ID#>" 20 | request.merchantCapabilities = PKMerchantCapability.Capability3DS 21 | request.paymentSummaryItems = self.paymentSummaryItemsForShippingMethod(ShippingRateCalculator.defaultShippingMethod()) 22 | request.requiredShippingAddressFields = PKAddressField.PostalAddress 23 | let vc = PKPaymentAuthorizationViewController(paymentRequest: request) 24 | vc.delegate = self 25 | presentViewController(vc, animated: true, completion: nil) 26 | } 27 | else { 28 | // You'll have to collect your user's payment details another way, such as building your own form. 29 | } 30 | } 31 | 32 | func paymentSummaryItemsForShippingMethod(shipping: PKShippingMethod) -> ([PKPaymentSummaryItem]) { 33 | 34 | let wax = PKPaymentSummaryItem(label: "Mustache Wax", amount: NSDecimalNumber(string: "10.00")) 35 | let discount = PKPaymentSummaryItem(label: "Movember discount", amount: NSDecimalNumber(string: "-1.00")) 36 | let totalAmount = wax.amount.decimalNumberByAdding(shipping.amount).decimalNumberByAdding(discount.amount) 37 | let total = PKPaymentSummaryItem(label: "NSHipster", amount: totalAmount) 38 | 39 | return [wax, shipping, discount, total] 40 | } 41 | 42 | func processPayment(payment: PKPayment, completion: (PKPaymentAuthorizationStatus -> Void)) { 43 | // Use your payment processor's SDK to finish charging your user. 44 | // When this is done, call completion(PKPaymentAuthorizationStatus.Success) 45 | completion(PKPaymentAuthorizationStatus.Failure) 46 | } 47 | 48 | // MARK: PKPaymentAuthorizationViewControllerDelegate 49 | 50 | func paymentAuthorizationViewController(controller: PKPaymentAuthorizationViewController!, didAuthorizePayment payment: PKPayment!, completion: ((PKPaymentAuthorizationStatus) -> Void)!) { 51 | self.processPayment(payment, completion: completion) 52 | } 53 | 54 | func paymentAuthorizationViewControllerDidFinish(controller: PKPaymentAuthorizationViewController!) { 55 | dismissViewControllerAnimated(true, completion: nil) 56 | } 57 | 58 | func paymentAuthorizationViewController(controller: PKPaymentAuthorizationViewController!, didSelectShippingAddress address: ABRecord!, completion: ((PKPaymentAuthorizationStatus, [AnyObject]!, [AnyObject]!) -> Void)!) { 59 | 60 | ShippingRateCalculator.fetchShippingRatesForAddress(address, completion: { (shippingMethods, error) -> Void in 61 | if (error != nil || shippingMethods == nil || shippingMethods!.isEmpty) { 62 | completion(PKPaymentAuthorizationStatus.InvalidShippingPostalAddress, nil, nil) 63 | return 64 | } 65 | completion(PKPaymentAuthorizationStatus.Success, shippingMethods, self.paymentSummaryItemsForShippingMethod(shippingMethods![0])) 66 | }) 67 | } 68 | 69 | func paymentAuthorizationViewController(controller: PKPaymentAuthorizationViewController!, didSelectShippingMethod shippingMethod: PKShippingMethod!, completion: ((PKPaymentAuthorizationStatus, [AnyObject]!) -> Void)!) { 70 | completion(PKPaymentAuthorizationStatus.Success, paymentSummaryItemsForShippingMethod(shippingMethod)) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /ApplePayDemoTests/ApplePayDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ApplePayDemoTests.swift 3 | // ApplePayDemoTests 4 | // 5 | // Created by Jack Flintermann on 12/2/14. 6 | // 7 | 8 | import UIKit 9 | import XCTest 10 | 11 | class ApplePayDemoTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ApplePayDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.test.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | --------------------------------------------------------------------------------