# Capacitor

Superwall plugin for Capacitor by Capawesome

> **Info**

**Community SDK**This SDK is developed and maintained by [Capawesome](https://capawesome.io), not by Superwall. For support, please visit the [official documentation](https://capawesome.io/plugins/superwall/).



The [Capacitor Superwall plugin](https://capawesome.io/plugins/superwall/) by [Capawesome](https://capawesome.io) enables you to integrate Superwall into your Capacitor apps for iOS and Android.

Installation [#installation]

Install the plugin via npm:

```bash
npm install @capawesome/capacitor-superwall
npx cap sync
```

Android Setup [#android-setup]

Add the following activities to your `AndroidManifest.xml` inside the `<application>` tag:

```xml
<activity android:name="com.superwall.sdk.paywall.vc.SuperwallPaywallActivity" android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<activity android:name="com.superwall.sdk.debug.DebugViewActivity" android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<activity android:name="com.superwall.sdk.debug.localizations.SWLocalizationActivity" android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<activity android:name="com.superwall.sdk.debug.SWConsoleActivity" android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
```

Configuration [#configuration]

Initialize the SDK with your API key:

```typescript
import { Superwall } from '@capawesome/capacitor-superwall';

await Superwall.configure({
  apiKey: 'YOUR_API_KEY',
  options: {
    paywalls: {
      shouldPreload: true,
      automaticallyDismiss: true
    },
    logging: {
      level: 'WARN',
      scopes: ['ALL']
    }
  }
});
```

Core Methods [#core-methods]

| Method                    | Description                               |
| ------------------------- | ----------------------------------------- |
| `configure()`             | Initialize the SDK with your API key      |
| `register()`              | Present a paywall for a placement         |
| `getPresentationResult()` | Check if a paywall would display          |
| `identify()`              | Associate a user ID with the current user |
| `reset()`                 | Clear user identity on logout             |
| `setUserAttributes()`     | Set custom user attributes                |
| `getSubscriptionStatus()` | Get the current subscription status       |

Event Listeners [#event-listeners]

The plugin supports the following event listeners:

* `superwallEvent` - Analytics events
* `subscriptionStatusDidChange` - Subscription status changes
* `paywallPresented` - Paywall displayed
* `paywallWillDismiss` - Before paywall closes
* `paywallDismissed` - After paywall closes
* `customPaywallAction` - Custom paywall element interactions

Full Documentation [#full-documentation]

## Capawesome Superwall Plugin

https://capawesome.io/plugins/superwall/

View the complete API reference and detailed documentation on capawesome.io