Purchasely
3.4
Rechercher…
⌃K

Paywall only mode

This mode is made to use Purchasely solely for paywalls display.

When to use it ?

In this mode, Purchasely allows you to modify your paywall remotely and gain much flexibility to iterate on your user flows and still keep your legacy transaction processor in place.
If you only have a "one size fits all" paywall in your app and want to optimize your subscription flows and increase your conversion by iterating swiftly on the paywalls, without changing the way transactions are processed, this mode is meant for you.
Purchasely won't perform purchases and won't observe transactions. The dashboards will thus be empty.

What you can do in this mode ?

You can:
  • display paywalls and modify them remotely
  • create as many paywalls as you need and multiply the touch points
To display paywalls, Purchasely will provide (or display) controllers / fragments and will also let you handle purchases thanks to the action interceptor. You will be notified when the user taps on a purchase button and you will be able to perform the purchase with your own code.

General overview

Implementation

1- Start the SDK

The first thing you need to do is to call the start method passing the mode paywallOnly / PLYRunningModePaywallOnly. View implementation details

2- Set user identifier

We need to know whenever a user is logged in or logged out to:
  • Hide the login button in the paywalls
  • Check if the user already used a trial and display the correct price

3- Configure your catalog of in-app purchases and subscriptions

To be able to display paywalls, the catalog of IAP must be configured into the Purchasely Console. Each product must be mapped with the corresponding SKU in the different app stores.

4- Configure and present paywalls

To display a paywall, you need to can get a Controller / Fragment from Purchasely.
Then you must use the Paywall Actions Interceptor to perform the purchase triggered from Purchasely's paywalls with your purchase system.
Here is an example where MyPurchaseSystem is your internal subscription management system.
Swift
Objective-C
Kotlin
Java
ReactNative
Cordova
Flutter
Purchasely.setPaywallActionsInterceptor { [weak self] (action, parameters, presentationInfos, proceed) in
switch action {
// Intercept the tap on purchase to display the terms and condition
case .purchase:
// Grab the plan to purchase
guard let plan = parameters?.plan, let appleProductId = plan.appleProductId else {
proceed(false)
return
}
MyPurchaseSystem.purchase(appleProductId) { (success, error) {
// We handle the purchase so we tell Purchasley not to handle it
proceed(false)
if success {
presentationInfos?.controller?.dismiss(animated: true, completion: nil)
}
}
default:
proceed(true)
}
}
[Purchasely setPaywallActionsInterceptor:^(enum PLYPresentationAction action, PLYPresentationActionParameters *parameters, PLYPresentationInfo *presentationInfos, void (^ proceed)(BOOL)) {
switch (action) {
// Intercept the tap on purchase to display the terms and condition
case PLYPresentationActionPurchase:{
// Grab the plan to purchase
NSString *appleProductId = parameters.plan.appleProductId;
if (appleProductId == nil) {
proceed(NO);
return;
}
[MyPurchaseSystem purchase:appleProductId completion:^(BOOL success, NSError *Error) {
// We handle the purchase so we tell Purchasely not to handle it
proceed(false);
if (success) {
[presentationInfos.controller dismissViewControllerAnimated:YES completion:nil];
}
}];
break;
}
default:
proceed(YES);
break;
}
}];
Purchasely.setPaywallActionsInterceptor { info, action, parameters, processAction ->
if (info?.activity == null) return@setPaywallActionsInterceptor
when(action) {
PLYPresentationAction.PURCHASE -> {
Purchasely.plan("PLAN_VENDOR_ID",
onSuccess = { plan ->
MyPurchaseSystem.purchase(plan.store_product_id)
processAction(false)
},
onError = { throwable ->
//display an error
processAction(false)
}
)
}
else -> processAction(true)
}
}
Purchasely.setPaywallActionsInterceptor((info, action, parameters, listener) -> {
switch (action) {
case PURCHASE:
Purchasely.plan("PLAN_VENDOR_ID", new PlanListener() {
@Override
public void onSuccess(@Nullable PLYPlan plan) {
MyPurchaseSystem.purchase(plan.store_product_id);
listener.processAction(false);
}
@Override
public void onFailure(@NotNull Throwable throwable) {
//display an error
listener.processAction(false);
}
});
break;
default:
listener.processAction(true);
}
});
Purchasely.setPaywallActionInterceptorCallback((result) => {
if (result.action === PLYPaywallAction.PURCHASE) {
try {
const plan = await Purchasely.planWithIdentifier('PLAN_VENDOR_ID');
//If you want to intercept it, close paywall and display your screen
Purchasely.closePaywall();
MyPurchaseSystem.purchase(plan.productId)
Purchasely.onProcessAction(false);
} catch (e) {
console.log(e);
Purchasely.onProcessAction(false);
}
} else {
Purchasely.onProcessAction(true);
}
});
Purchasely.setPaywallActionInterceptorCallback((result) => {
if (result.action === Purchasely.PaywallAction.purchase) {
Purchasely.planWithIdentifier('PLAN_VENDOR_ID', (plan) => {
//If you want to intercept it, close paywall and display your screen
Purchasely.closePaywall();
MyPurchaseSystem.purchase(plan.productId)
Purchasely.onProcessAction(false);
}, (error) => {
Purchasely.onProcessAction(false);
});
} else {
Purchasely.onProcessAction(true);
}
});
Purchasely.setPaywallActionInterceptorCallback(
(PaywallActionInterceptorResult result) {
if (result.action == PLYPaywallAction.purchase) {
try {
var plan = await Purchasely.planWithIdentifier('PLAN_VENDOR_ID');
//If you want to intercept it, close paywall and display your screen
Purchasely.closePaywall();
MyPurchaseSystem.purchase(plan.productId)
Purchasely.onProcessAction(false);
} catch (e) {
print(e);
Purchasely.onProcessAction(false);
}
} else {
Purchasely.onProcessAction(true);
}
});
Paywalls can be used in many othe ways that can be: