diff --git a/docs/README.md b/docs/README.md index 48479be..a4a6f9e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -186,3 +186,55 @@ try { hideMockReaderUI(); ``` Note that you might get an error if you try to call these methods outside of Sandbox, so you can handle the errors by using a `try/catch` block. + +## Tap to Pay Settings on iPhone + +For iOS devices, you can manage Tap to Pay settings using the `TapToPaySettings` namespace. The following methods are available: + +### Link Apple Account + +Before using Tap to Pay on iPhone, you need to link an Apple account: + +```typescript +import { TapToPaySettings } from 'mobile-payments-sdk-react-native'; + +try { + await TapToPaySettings.linkAppleAccount(); + console.log('Apple account linked successfully'); +} catch (error) { + console.error('Failed to link Apple account:', error); +} +``` + +### Relink Apple Account + +If the Apple account needs to be relinked, use: + +```typescript +try { + await TapToPaySettings.relinkAppleAccount(); + console.log('Apple account relinked successfully'); +} catch (error) { + console.error('Failed to relink Apple account:', error); +} +``` + +### Check if Apple Account is Linked + +You can check if an Apple account is already linked: + +```typescript +const isLinked = await TapToPaySettings.isAppleAccountLinked(); +console.log('Apple account linked:', isLinked); +``` + +### Check Device Capability + +To verify if the device supports Tap to Pay on iPhone: + +```typescript +const isCapable = await TapToPaySettings.isDeviceCapable(); +console.log('Device supports Tap to Pay:', isCapable); +``` + +> **Note:** These methods are only available on iOS. Calling them on Android will result in an error. diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index f6d47f7..fe8da8b 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -152,6 +152,17 @@ Method | Returns [getEnvironment](#getEnvironment) | String | Returns the current environment the SDK was initialized on. [getSdkVersion](#getSdkVersion) | String | Returns the current Mobile Payments SDK version. +### TapToPaySettings Namespace + +The `TapToPaySettings` namespace provides methods specifically for managing Tap to Pay functionality on iOS devices. + +Method | Returns | Description +--------------------------------------------------------- | --------------------------------- | --- +[linkAppleAccount](#linkAppleAccount) | Promise | Links the Apple account for Tap to Pay functionality (iOS only). +[relinkAppleAccount](#relinkAppleAccount) | Promise | Relinks the Apple account if required (iOS only). +[isAppleAccountLinked](#isAppleAccountLinked) | Promise | Checks if an Apple account is linked for Tap to Pay (iOS only). +[isDeviceCapable](#isDeviceCapable) | Promise | Checks if the current device is capable of using Tap to Pay (iOS only). + ## Method details @@ -177,7 +188,40 @@ Returns the current Mobile Payments SDK version running. Note this is the versio * **On failure**: Not applicable. --- +### TapToPaySettings Methods + +#### linkAppleAccount + +Links the Apple account for Tap to Pay functionality. This method is only available on iOS. + +* **On success**: completes successfully. +* **On failure**: throws an error if the operation fails or is attempted on Android. + +--- +#### relinkAppleAccount + +Relinks the Apple account if required for Tap to Pay functionality. This method is only available on iOS. +* **On success**: completes successfully. +* **On failure**: throws an error if the operation fails or is attempted on Android. + +--- +#### isAppleAccountLinked + +Checks if an Apple account is linked for Tap to Pay. + +* **On success**: returns `true` if an Apple account is linked, `false` otherwise. +* **On failure**: throws an error if the operation fails or is attempted on Android. + +--- +#### isDeviceCapable + +Checks if the current device supports Tap to Pay functionality. + +* **On success**: returns `true` if the device is capable, `false` otherwise. +* **On failure**: throws an error if the operation fails or is attempted on Android. + +--- ## Objects ### Location