# Present paywalls

Paywalls are displayed by calling a Placement.

A Placement represents a specific location in your user journey inside your app (e.g. Onboarding, Settings, Home page, Article). A placement is linked to a paywall and a single paywall can be used for different Placements. You can create as many Placements as you want, and this is the only thing that ties the app developer to the marketer.

Once the placements are defined and called from the app, you can change the displayed paywall remotely without any developer action.

## What Placements should you create ?

Let's take the example of the New Yorker app who has many triggers to display paywalls.

![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-9cad178641f61ca143d5aaf62a24f884a3657dd5%2Fimage%20\(163\).png?alt=media)

![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-34ac27a8f761157dc366fd9651d989af1f2e4f01%2Fimage%20\(203\).png?alt=media)

For this specific case the New Yorker should create 4 Placements:

* ![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-aa88f70ea048d21cf0b9981fd8bb8c5a9e77d697%2FApp%20launch%20\(1\).png?alt=media)
* ![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-cc1b72b0ce954366336678e2bc9c6c7daf535ec4%2FNav%20bar.png?alt=media)
* ![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-05d3476b8df98497a57c7d1c4a57932db647cc36%2FToaster.png?alt=media)
* ![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-17d2c1491a453e44bb214823f429d7afff8adbae%2FMagazine%20issue.png?alt=media)
* ![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-54ae185f0b1aca1937ac483049120d963d34610b%2FSettings.png?alt=media)

Once these Placements created the displayed paywalls for each Placement can be changed remotely, instantly and independently.

## How to define placements in the Purchasely console

First of all you will find in the main menu a new entry dedicated to manage your Placements.

![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-0b259197d46e83fa85c6a24f2551453985d18b5f%2Fimage%20\(122\).png?alt=media)

Once you are on the Placements page you will be able to create as much Placement as you want to fit your app and user journey. For example let's say that in your user journey you display a paywall right at the end of a new user onboarding. Want you want to do is Create a new Placement dedicated to that situation and name it *Onboarding*.

Clic on the top right corner of the Placements page on "New placement".

![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-f983f3217f57c5354d5c969cfbf8a2d30a5aa655%2Fimage%20\(166\).png?alt=media)

Then you will have to fill different text fields.

* `NAME` : the name is only used in the Purchasely console
* `ID` : the id is what the developer will need to call in the app
* `DESCRIPTION` : the description is only used in the Purchasely console and is meant to help for collaborative work.
* `PAYWALL` : the paywall is the paywall that will be displayed when the Placement will be called in the app. This is where the magic is, you will be able to change the displayed Paywall for that Placement whenever you want without any further developer action.

![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-5df8f42e61aced93b1569060ccf61d3c8387ea0f%2Fimage%20\(144\).png?alt=media)

Once it's created you can manage all your Placements at the same place and edit them whenever you see fit.

![](https://2145676854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuAJGBnHJWZbqzA4g8yO%2Fuploads%2Fgit-blob-b96db7493e3ee8420b1fcc939badb31afdd2bf47%2Fimage%20\(182\).png?alt=media)

## How to implement a Placement in your app

Once the placement has been define in the Purchasely Console you have to call it in your app.

You can do it using an almost identical method than the one you already used for a `presentationController`with an id.

{% tabs %}
{% tab title="Swift" %}

```swift
let placementId = "ONBOARDING"
paywallCtrl = Purchasely.presentationController(for: placementId, contentId: contentId, loaded: { _, _, _ in
            }, completion: completion)
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
UIViewController *paywallCtrl = [Purchasely presentationControllerFor:@"my_placement_id"
						            contentId:@"my_content_id"
                                                            completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
}];

```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
Purchasely.presentationViewForPlacement(
    context = context,
    placementId = placementId,
    contentId = contentId,
    onClose = { }
) { result, plan ->
    Log.d("Purchasely", "Result is $result with plan $plan")
}
```

{% endtab %}

{% tab title="Java" %}

```java
String placementId = "onboarding";
String contentId = "my_content_id"; // or null

Purchasely.presentationViewForPlacement(context, placementId, contentId, null, null);
```

{% endtab %}

{% tab title="React Native" %}

```jsx
await Purchasely.presentPresentationForPlacement({
    placementVendorId: 'onboarding',
    contentId: 'my_content_id',
    isFullscreen: true,
});
```

{% endtab %}

{% tab title="Cordova" %}

```jsx
Purchasely.presentPresentationForPlacement('onboarding');
```

{% endtab %}

{% tab title="Flutter" %}

```jsx
await Purchasely.presentPresentationForPlacement('onboarding');
```

{% endtab %}

{% tab title="Unity" %}

```csharp
private PurchaselyRuntime.Purchasely _purchasely;

_purchasely.PresentPresentationForPlacement("placementId",
			OnPresentationResult,
			OnPresentationContentLoaded,
			OnPresentationContentClosed,
			"contentId");
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The callback `PLYProductViewControllerResult`(iOS) / `ProductViewResultListener` (Android) is optional, you can set to null if you do not need it.
{% endhint %}

{% hint style="info" %}
You can be alerted if the purchase was made by listening to the [Notifications](https://github.com/Purchasely/Purchasely-iOS#notifications) or by implementing the optional completion block
{% endhint %}
