Skip to content

Commit

Permalink
TTP new methods docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cesar-sosa-hol authored and plinio-square committed Feb 28, 2025
1 parent 04f3550 commit 66becb7
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
52 changes: 52 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
44 changes: 44 additions & 0 deletions docs/REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> | Links the Apple account for Tap to Pay functionality (iOS only).
[relinkAppleAccount](#relinkAppleAccount) | Promise<void> | Relinks the Apple account if required (iOS only).
[isAppleAccountLinked](#isAppleAccountLinked) | Promise<Boolean> | Checks if an Apple account is linked for Tap to Pay (iOS only).
[isDeviceCapable](#isDeviceCapable) | Promise<Boolean> | Checks if the current device is capable of using Tap to Pay (iOS only).


## Method details

Expand All @@ -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
Expand Down

0 comments on commit 66becb7

Please sign in to comment.