# configure()

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

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

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

## [Purpose](/content/docs/react-native/sdk-reference/configure#purpose/index.html)

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

## [Signature](/content/docs/react-native/sdk-reference/configure#signature/index.html)

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

## [Parameters](/content/docs/react-native/sdk-reference/configure#parameters/index.html)

| Prop                  | Type                                                              |
|-----------------------|-------------------------------------------------------------------|
| `apiKey`              | string                                                            |
| `options?`           | [SuperwallOptions?](/content/docs/react-native/sdk-reference/SuperwallOptions/index.html) |
| `purchaseController?` | PurchaseController?                                               |
| `completion?`        | (() => void)?                                                   |

## [Returns / State](/content/docs/react-native/sdk-reference/configure#returns--state/index.html)

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

## [Usage](/content/docs/react-native/sdk-reference/configure#usage/index.html)

Basic configuration:

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

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

With custom options:

```
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:

```
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()
})
```

How is this guide?

Good  /  Bad

[Overview](/content/docs/react-native/sdk-reference/index.html)  
[Superwall](/content/docs/react-native/sdk-reference/Superwall/index.html)

### On this page

[Purpose](/content/docs/react-native/sdk-reference/configure#purpose/index.html)  
[Signature](/content/docs/react-native/sdk-reference/configure#signature/index.html)  
[Parameters](/content/docs/react-native/sdk-reference/configure#parameters/index.html)  
[Returns / State](/content/docs/react-native/sdk-reference/configure#returns--state/index.html)  
[Usage](/content/docs/react-native/sdk-reference/configure#usage/index.html)
