Apple Pay and Google Pay in your app
Accept Apple Pay on iOS and Google Pay on Android with the drop-in's wallet button or the iOS, Android, and React Native SDKs' wallet methods.
The iOS, Android, and React Native SDKs take Apple Pay on iOS and Google Pay on Android. The drop-in shows the wallet's button when you turn it on, or you show your own button and pay with the SDK's wallet methods. Pay.com decrypts the wallet's token, so your app handles no card data.
Requirements
Each wallet needs settings outside the SDK.
- The Apple Pay capability in your app, with your merchant ID.
- A payment processing certificate for that merchant ID, held by Pay.com for your account. Pay.com decrypts the tokens with it, so ask Pay.com to set it up. Without it, the payment fails.
- A payment session (capture or hold) that offers
applepay.
Choose how to show the button
Each SDK offers three ways to show the wallet. The drop-in needs the least code, and your own sheet gives you the most control.
| Approach | iOS | Android | React Native |
|---|---|---|---|
| The drop-in's button | Drop-in, Apple Pay | Drop-in, googlePay option | applePay and googlePay options |
| Your button, the SDK's sheet | checkout.payWithApplePay() | checkout.payWithGooglePay() | Drop-in only |
| Your button and your sheet | checkout.applePayPaymentRequest() | checkout.googlePayPaymentDataRequest() | Drop-in only |
Pay with the SDK's wallet methods
Check that the customer can pay with the wallet, show your button, then pay when they tap it.
checkout.canPayWithApplePay(_:) checks whether the session and device support Apple Pay. checkout.payWithApplePay(_:presenter:) displays the Apple Pay sheet and submits the payment the customer authorizes.
let applePay = PayApplePayConfiguration(merchantIdentifier: "merchant.com.myshop")
if checkout.canPayWithApplePay(applePay) {
let result = try await checkout.payWithApplePay(applePay, presenter: self)
}Confirm the charge on your server with webhooks before you fulfill the order.
Next steps
- iOS: Accept payments in an iOS app.
- Android: Accept payments in an Android app.
- React Native: Accept payments in a React Native app.