Cards & Wallets · Mobile SDK · UI Components
Apple Pay Button
There is no pre-defined Apple Pay component.
Use the following example, based on PassKit, to create an Apple Pay button and initiate a payment with it.
Example
Swift
import SwiftUI
import PassKit
import mobilesdk
struct ApplePayExample: View {
...
var body: some View {
ScrollView {
VStack(
alignment: .leading
) {
...
PayWithApplePayButton(action: {
do {
try processor?.processApplePayPayment(
appleMerchantId: applePayMerchantId, // Your Apple Pay merchant id (from the developer console)
billingAddress: billingAddress
)
} catch {}
}).frame(height: 50)
}
}
}
}