因為工程需要使用apple pay, 網(wǎng)上找了很多資料, 要么陳舊, 要么就是直接復制轉(zhuǎn)載, 無奈之下, 找到蘋果的官方文檔: 官方傳送門, 很詳細, 我接下來的操作, 也是按照這個文檔進行的.
1. Apple Pay Setup 官方傳送門
- 創(chuàng)建商戶id (Create a merchant ID)
- 創(chuàng)建付款處理的證書 (Create a Payment Processing certificate.)
步驟1,2
參看官方說明, 中文的, 在此就不贅述
配置 Apple Pay
- xcode的相關(guān)設(shè)置 (Enable Apple Pay in Xcode. )
常規(guī)設(shè)置, 類似后臺播放那樣, 勾選剛才創(chuàng)建的
添加apple pay的capability
2. Apple Pay Availability
- 判斷設(shè)備是否支持apple pay, 以及用戶是否已經(jīng)添加卡片
tips: The PKPaymentAuthorizationController class performs the same role as the PKPaymentAuthorizationViewController class, but it does not depend on the UIKit framework. This means that the authorization controller can be used in places where a view controller cannot (for example, in watchOS apps or in SiriKit extensions).
