# configure()

A static function that configures a shared instance of Superwall for use throughout your app.

> **Warning**

**Deprecated SDK**We strongly recommend migrating to the new [Superwall Expo SDK](/docs/expo), see our [migration guide](/docs/expo/guides/migrating-react-native) for details.



> **Note**

This is a static method called on the `Superwall` class itself, not on the shared instance.



Purpose [#purpose]

Configures the shared instance of Superwall with your API key and optional configurations, making it ready for use throughout your app.

Signature [#signature]

```typescript
static async configure({
  apiKey,
  options,
  purchaseController,
  completion,
}: {
  apiKey: string
  options?: SuperwallOptions
  purchaseController?: PurchaseController
  completion?: () => void
}): Promise<Superwall>
```

Parameters [#parameters]

<TypeTable
  type="{
  apiKey: {
    type: &#x22;string&#x22;,
    description: &#x22;Your Public API Key from the Superwall dashboard settings.&#x22;,
    required: true,
  },
  options: {
    type: &#x22;SuperwallOptions?&#x22;,
    typeDescriptionLink: &#x22;/react-native/sdk-reference/SuperwallOptions&#x22;,
    description: &#x22;Optional configuration object for customizing paywall appearance and behavior.&#x22;,
    default: &#x22;undefined&#x22;,
  },
  purchaseController: {
    type: &#x22;PurchaseController?&#x22;,
    description: &#x22;Optional object for handling all subscription-related logic yourself. If omitted, Superwall handles subscription logic.&#x22;,
    default: &#x22;undefined&#x22;,
  },
  completion: {
    type: &#x22;(() => void)?&#x22;,
    description: &#x22;Optional completion handler called when Superwall finishes configuring.&#x22;,
    default: &#x22;undefined&#x22;,
  },
}"
/>

Returns / State [#returns--state]

Returns a Promise that resolves to the configured `Superwall` instance. The instance is also accessible via [`Superwall.shared`](/docs/react-native/sdk-reference/Superwall).

Usage [#usage]

Basic configuration:

```typescript
import Superwall from "@superwall/react-native-superwall"

await Superwall.configure({
  apiKey: "pk_your_api_key"
})
```

With custom options:

```typescript
import Superwall, { SuperwallOptions } from "@superwall/react-native-superwall"

const options = new SuperwallOptions({
  paywalls: {
    shouldShowPurchaseFailureAlert: false
  }
})

await Superwall.configure({
  apiKey: "pk_your_api_key",
  options: options,
  completion: () => {
    console.log("Superwall configured successfully")
  }
})
```

With custom purchase controller:

```typescript
import Superwall, { PurchaseController } from "@superwall/react-native-superwall"

class MyPurchaseController extends PurchaseController {
  async purchaseFromAppStore(productId: string): Promise<PurchaseResult> {
    // Your purchase logic
  }
  
  async purchaseFromGooglePlay(productId: string, basePlanId?: string, offerId?: string): Promise<PurchaseResult> {
    // Your purchase logic
  }
  
  async restorePurchases(): Promise<RestorationResult> {
    // Your restore logic
  }
}

await Superwall.configure({
  apiKey: "pk_your_api_key",
  purchaseController: new MyPurchaseController()
})
```