getWalletsAvailable
getWalletsAvailable1. Overview
The DEUNA SDKs provide the getWalletsAvailable method to obtain the list of digital wallet providers (Google Pay, Apple Pay) that are available and ready to process payments on the current device, browser, or mobile platform.
Make sure to follow the Getting Started guide for our SDKs depending on your specific integration:
Method signatures by platform:
| Platform | Method signature |
|---|---|
| Web | DeunaSDK.getWalletsAvailable(): Promise<WalletProvidersEnum[]> |
| iOS | deunaSdk.getWalletsAvailable { providers, error in } |
| Android | deunaSdk.getWalletsAvailable { providers, error -> } |
| React Native | deunaSdk.getWalletsAvailable(): Promise<WalletProvidersEnum[]> |
type WalletProvidersEnum = "GOOGLE_PAY" | "APPLE_PAY";What it does behind the scenes (by platform):
| Platform | Capability checks performed |
|---|---|
| Web | Loads pay.js / Apple Pay JS → calls isReadyToPay / canMakePayments → caches wallet instance |
| iOS | Checks device via native frameworks (PassKit) → verifies valid card in Apple Wallet |
| Android | Checks Google Play Services → verifies wallet via PaymentRequest API in WebView |
| React Native | Bridges to native modules → performs iOS / Android specific checks |
2. Use cases (all platforms)
| Use case | How to use |
|---|---|
| Show/hide wallet buttons on your custom checkout UI | Call getWalletsAvailable() on page load / app start → conditionally render buttons based on the returned array |
| Pre-warm the SDK before initializing payment elements | Call at startup → SDK caches the wallet instance → subsequent initElements calls are faster |
| Feature-flag which wallets to support in your app | Use the returned array to determine if you should offer Google Pay, Apple Pay, both, or none |
3. Environment
- HTTPS — Both Apple Pay and Google Pay refuse to run on
http://(exceptlocalhostfor development). - Supported browser — evergreen Chrome, Edge, Firefox, Safari. Apple Pay only surfaces in Safari (in‑device) or iOS 18+ (QR fallback). Google Pay requires a signed‑in Google account with a saved card.
- Merchant configuration — the wallets you expect must be enabled for your merchant in the DEUNA Dashboard. A wallet that is disabled at the merchant level will never appear in the returned array.
3.1. Side effects to be aware of
-
Caching: the first call initializes
DeunaSDK.walletand caches it. Subsequent calls return the cached list without re‑running SSR or capability checks. If you need to re‑check (e.g. after the user signs into Google), you must create a fresh SDK instance viaDeunaSDK.newInstance(). -
SSR state: when called via the SSR path, the SDK also stores
resolvedWalletConfig,walletUserToken, andwalletUserIdinternally — these are used byinitElementsfor card tokenization.
4. Return value & handling empty results
The method returns an array containing only the providers that pass all platform-specific checks. An empty array [] means no wallet is available on the current device/platform.
Common reasons for empty results:
- Device/browser does not support any wallet (e.g., desktop Firefox without Google account)
- Merchant has no wallets enabled in DEUNA Dashboard
- Platform check failed (e.g., no saved card in Google account, Apple Wallet empty)
- SDK not initialized before calling
getWalletsAvailable
Examples:
// Web / React Native
const available = await DeunaSDK.getWalletsAvailable();
if (available.length === 0) {
showCardFormOnly();
return;
}// iOS
DeunaSDK.shared.getWalletsAvailable { providers, error in
if let providers = providers, providers.contains(.applePay) {
showApplePayButton()
} else {
showCardForm()
}
}// Android
DeunaSDK.getInstance().getWalletsAvailable { providers, error ->
if (providers?.contains("GOOGLE_PAY") == true) {
showGooglePayButton()
} else {
showCardForm()
}
}5. Platform-specific notes
| Platform | Google Pay availability | Apple Pay availability |
|---|---|---|
| Web (desktop) | Chrome, Edge, Opera (requires signed-in Google account + saved card) | Safari only (macOS) |
| Web (mobile) | Chrome, Safari (requires saved card) | Safari only (iOS) |
| iOS (native) | Not available | Real device with Wallet card |
| Android (native) | Real device with Play Services + saved card | Not available |
| React Native | Real Android device | Real iOS device |
6. Common mistakes (by platform)
| Mistake | Consequence |
|---|---|
All platforms: Calling before initialize() | Missing publicApiKey → request fails / empty array |
| Web: Domain not registered in Google Pay Console (production) | DEVELOPER_ERROR in payment sheet |
| Web: Serving checkout over HTTP | Google Pay refuses to run |
| iOS: Merchant ID not configured in Xcode | Apple Pay check always fails |
| Android: Missing WebKit dependency or intent queries | Google Pay check fails silently |
Android: PaymentRequest API not enabled | Google Pay unavailable in WebView |
| React Native: Testing Apple Pay on simulator | Always fails (requires real device) |
7. When to use this method
| Integration type | Do you need getWalletsAvailable? | Why? |
|---|---|---|
| Payment Widget (drop-in DEUNA UI) | Optional (for pre-warming only) | The widget automatically shows/hides wallet buttons based on availability |
| Payment Vault (headless / custom UI) | Required | You need to know which wallets to render in your own UI |
| Pre-warming the SDK | Recommended | Calling it at startup caches the wallet, making subsequent calls faster |