Skip to main content
Version: 5.x

Lens+ Paywall

The Lens+ paywall API lets a game Lens put content behind Lens+. Your game checks whether the player can use that content, and if they can't, asks Snapchat to show the Lens+ upgrade offer. Snapchat handles the payment, so your game never takes one.

Use it to let players try your game before they subscribe: they play a first round or a few levels, and your Lens offers Lens+ at the point you choose.

Your Lens must not misrepresent what you will provide Lens+ subscribers. This will result in your Lens being removed from the platform.

How it works​

  1. When the Lens starts, your game checks whether the player has Lens+.
  2. The player plays the free part until your paywall point. Your game pauses and asks Snapchat to show the Lens+ upgrade offer.
  3. Snapchat shows the offer and reports whether the player subscribed. Your game unlocks the content or keeps it locked.

Before you submit​

Only a Lens+ Lens has Lens+ content, so a Lens that uses the Lens+ paywall has to be one. Snapchat marks a Lens that includes the module as Exclusive after you submit it, so you don't sign up separately. When you submit a Lens that includes the module:

  • The Lens must be categorized as a Game. The API isn't supported on a Lens that isn't a Game.
  • A new Lens becomes a Lens+ Lens. Lens+ Lenses have requirements, such as Public visibility, a video preview, and music you have the rights to use. See Lens+ Payouts for the details.
  • An update may not be able to add the module to a Lens that isn't a Lens+ Lens. Add it before your first submission.

Submitting your Lens covers the rest of the upload and review.

If your Game Lens is Exclusive but doesn't include the module, Snapchat shows the standard Lens+ game paywall instead, and you don't control when it appears.

Add the module​

The module needs Lens Studio 5.25 or later.

  1. Import the module from the Remote Service Modules section of the Asset Library. You can also create a Remote Service Module in the Asset Browser panel: click +, select the new module, and in the Inspector set its Api Spec Id to:

    442f091d-82c3-480d-84a7-4ed4782ecb2f
  2. Reference the module from your game script. The helper script at the end of this page calls the endpoints through the RemoteServiceModule and reads the error metadata on failure. Wire its remoteServiceModule input to the module from step 1.

Check support​

The API needs these Snapchat versions or later:

PlatformMinimum Snapchat version
iOS14.33
Android14.35

On older versions, requests can fail or never get a response. Keep the game playable up to your free-play limit, and keep the player locked out after that.

Gate content on eligible​

Call isEligible() when the Lens starts, so subscribers never hit a paywall:

this.hasLensPlus = await this.gate.isEligible();

is_user_eligible_for_exclusive_lens returns { "eligible": true } when the player can use your Lens+ content and { "eligible": false } when they can't. It never shows the offer. On a Lens+ Lens, a player with Lens+ is eligible, and anyone else isn't until they subscribe. If the call fails, the helper returns false, so premium content stays locked.

Offer the upgrade​

showUpsell() calls show_exclusive_lens_upsell, which shows the Lens+ upgrade offer to a non-subscriber. It resolves when the offer closes:

const result = await this.gate.showUpsell();
  • { ok: true, subscribed }: subscribed is whether the player has Lens+ now. A player who already has Lens+ gets true right away and sees nothing.
  • { ok: false, reason }: the offer didn't complete. See When the offer doesn't complete.

The offer covers your Lens only. It blocks input to your Lens until the player subscribes or closes it, but it doesn't block Snapchat. The player can still exit full screen, swipe to another Lens, or open another game, so don't depend on the call returning before your Lens closes.

The call has no fixed timeout. It can stay open as long as the player looks at the offer. Pause your game and its timers before you call it, and don't treat a slow response as a failure.

When the offer doesn't complete​

When a request can't complete, the response has a non-success status code. It can include a short reason in the response metadata under the key error. Some failures don't include one, so don't depend on it.

error valueMeaningWhat to do
lens_not_snapchat_plus_exclusiveThe Lens isn't marked Exclusive. On some platforms you get this error. On others the calls succeed but gate nothing.Submit the Lens and wait for Snapchat to mark it Exclusive.
too_soonYou requested the offer too soon after the Lens opened or after the last offer. Snapchat limits how often it appears.Don't retry in a loop. Keep the player locked out and offer an "Unlock with Lens+" button they can tap later.
already_in_flightAn offer is already on screen.Wait for the first call to resolve. Don't send another request while one is open.
presenter_unavailableSnapchat can't show the offer in the current context.Keep the player locked out and let them retry.
internal_error or another valueSomething unexpected went wrong.Treat the player as not subscribed, keep them locked out, and let them retry.

Treat any error as not subscribed, and always give the player a way to retry.

If every call fails with a Bad Request status and no error metadata, the API may not be available on that Snapchat version yet. Check the supported versions.

Unlock the next round​

Act on the result of showUpsell() when the player reaches your paywall point:

// At startup
this.hasLensPlus = await this.gate.isEligible();

// When a non-subscriber finishes their free round
async onFreePlayUsedUp() {
if (this.hasLensPlus) return this.startNextRound();

this.game.pause();
this.showPaywallScreen(); // Your own "Unlock with Lens+" screen with a button

const result = await this.gate.showUpsell();
if (result.ok && result.subscribed) {
this.hasLensPlus = true;
this.hidePaywallScreen();
this.startNextRound();
}
// Otherwise stay on the paywall screen. Its button calls showUpsell() again.
}

When every player is eligible​

Snapchat decides who is eligible, not your game. On a Lens that isn't a Lens+ Lens, the API doesn't gate anything. See lens_not_snapchat_plus_exclusive.

Snapchat may also make a Lens+ Lens free for everyone, for example during a promotion that brings it more players and subscribers. Your game doesn't need to handle this: keep gating on eligible.

Right after you submit, Snapchat is still processing a new Lens+ Lens for Lens+ eligibility. Until Snapchat marks the Lens, it answers like any other Lens: is_user_eligible_for_exclusive_lens returns { "eligible": true } and show_exclusive_lens_upsell returns { "subscribed": true } right away with no offer, so your Lens+ content is open to everyone. Snapchat returns no separate result for this state, so don't build logic around it or around how long it lasts. Gate on eligible, and the Lens behaves correctly in both states.

The real offer appears only in a Lens that Snapchat has marked Exclusive, so use the editor mock to build and test the locked path before you submit.

Test in Lens Studio​

The offer and subscription state aren't available in the Lens Studio preview. The helper's Mock Result dropdown tests each path: Already Subscribed, Accept Upsell, or Reject Upsell. Like a device, the mock always replies on a later frame, and the mock offer stays open for Upsell Seconds. Try a long value to check that your game stays paused while the offer is up.

The real offer appears only in a Lens that Snapchat has marked Exclusive. Once your submitted Lens is marked, test it with a Snapchat account that doesn't have Lens+, and again with one that does. Confirm that:

  • Subscribers never see the offer and get full access right away.
  • Non-subscribers see the offer at your chosen paywall point.
  • Closing the offer leaves the player locked out, with a working retry button.
  • Subscribing unlocks content right away, without restarting the Lens.

API reference​

The module has two endpoints. Neither takes parameters.

EndpointReturns
is_user_eligible_for_exclusive_lens{ "eligible": true } or { "eligible": false }. Never shows the offer.
show_exclusive_lens_upsell{ "subscribed": true } or { "subscribed": false }, after the offer closes. Returns true right away, with nothing shown, for a player who already has Lens+.

Best practices​

  • Offer at natural breaks. Show the offer between rounds, at a level boundary, or when free turns run out. Don't show it mid-action.
  • Pause first. Stop timers, physics, and audio before calling show_exclusive_lens_upsell, and restart them after it returns.
  • Keep a retry path. After a closed offer or an error, keep the player on a clear locked screen with a button that opens the offer again. Don't call it in a loop or right after the Lens opens, because Snapchat limits how often it appears (too_soon).
  • Fail closed. If a call fails, treat the player as not subscribed.
  • Say what Lens+ unlocks. Tell the player plainly what they get by subscribing, such as more levels or unlimited rounds, and deliver it right after they subscribe.

FAQ​

Do I get the purchase details? No. Your Lens only learns whether the player has Lens+ (eligible or subscribed). Billing and account details never reach the Lens.

Who tracks free plays? You do. The API only reports whether the player has Lens+. Store free-play counts with Lens Studio's persistent storage. The player can clear device-local storage, so treat it as best effort.

What if my Lens isn't a Game? The API isn't supported on a Lens that isn't a Game, and the standard Lens+ experience applies.

Helper script​

This script wraps both endpoints for the sections above. Attach it to an object in your scene and wire its remoteServiceModule input to the module from Add the module. It includes an editor mock for testing in the preview.

type UpsellOutcome =
| { ok: true; subscribed: boolean }
| { ok: false; reason: string };

@component
export class LensPlusGate extends BaseScriptComponent {
@input remoteServiceModule: RemoteServiceModule;

// Editor-only mock. The upgrade offer and subscription state aren't available in
// Lens Studio's preview, so this stands in for them. Replies are delayed so the
// editor behaves like a device: responses always arrive on a later frame.
@ui.group_start('Editor Mock')
@input('string', 'reject')
@widget(
new ComboBoxWidget()
.addItem('Already Subscribed', 'subscribed')
.addItem('Accept Upsell', 'accept')
.addItem('Reject Upsell', 'reject')
)
@label('Mock Result')
@hint('How the player behaves in the editor preview')
mockResult: 'subscribed' | 'accept' | 'reject';

@input('float', '3.0')
@label('Upsell Seconds')
@hint(
'Seconds the mock offer stays open before the player accepts or rejects'
)
mockUpsellSeconds: number;
@ui.group_end
private upsellPending = false;
private mockPurchased = false; // Editor mock: the player accepted an upsell this session.

/** Call at startup (and on resume) to decide what content is unlocked. */
async isEligible(): Promise<boolean> {
try {
const body = await this.call('is_user_eligible_for_exclusive_lens');
return JSON.parse(body).eligible === true;
} catch (e) {
print(`[LensPlusGate] eligibility check failed: ${e}`);
return false; // Fail closed: keep premium content locked.
}
}

/** Call at your paywall point, after pausing the game. */
async showUpsell(): Promise<UpsellOutcome> {
if (this.upsellPending) return { ok: false, reason: 'already_in_flight' };
this.upsellPending = true;
try {
const body = await this.call('show_exclusive_lens_upsell');
return { ok: true, subscribed: JSON.parse(body).subscribed === true };
} catch (e) {
return { ok: false, reason: String(e) };
} finally {
this.upsellPending = false;
}
}

private call(endpoint: string): Promise<string> {
if (global.deviceInfoSystem.isEditor()) return this.mockCall(endpoint);

const request = RemoteApiRequest.create();
request.endpoint = endpoint;
return new Promise((resolve, reject) => {
this.remoteServiceModule.performApiRequest(
request,
(response: RemoteApiResponse) => {
if (response.statusCode === 1) {
resolve(response.body);
} else {
const reason =
response.metadata?.['error'] ?? `status_${response.statusCode}`;
reject(reason);
}
}
);
});
}

/** Editor stand-in for the device API. Always replies on a later frame. */
private mockCall(endpoint: string): Promise<string> {
const hasLensPlus = this.mockResult === 'subscribed' || this.mockPurchased;
const isUpsell = endpoint === 'show_exclusive_lens_upsell';
const subscribed =
hasLensPlus || (isUpsell && this.mockResult === 'accept');
const body = isUpsell ? { subscribed } : { eligible: hasLensPlus };
// Subscribers get an immediate reply on device, so only non-subscribers wait.
const delay = isUpsell && !hasLensPlus ? this.mockUpsellSeconds : 0.1;

return new Promise((resolve) => {
const evt = this.createEvent('DelayedCallbackEvent');
evt.bind(() => {
// Like a real purchase, accepting sticks for the rest of the session.
if (isUpsell && subscribed) this.mockPurchased = true;
print(
`[LensPlusGate] (editor mock) ${endpoint} -> ${JSON.stringify(body)}`
);
resolve(JSON.stringify(body));
});
evt.reset(delay);
});
}
}
Was this page helpful?
Yes
No