Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class Paywall
- Object
- Paywall
Shows the paywall of an offering as a form of its own.
Offering offering = CommerceManager.getInstance().getOfferings().getCurrent();
Paywall.show(offering, new PaywallListener() {
public void purchaseStarted(CommercePackage pkg) {
}
public void purchaseCompleted(CustomerInfo info) {
Dialog.show("Thanks", "Your purchase is active", "OK", null);
}
public void purchaseCancelled() {
}
public void restoreCompleted(CustomerInfo info) {
}
public void closed() {
}
});
Methods
public static PaywallView show(Offering offering, PaywallListener listener) | Shows the paywall of the offering in a new form over the current one. |
public static Map<String, Object> createDefault(Offering offering) | The built-in paywall document: a close button, a title, the packages of the offering as a list, a purchase button, a restore button and a footer. |
Inherited methods
Method details
show
public static PaywallView show(Offering offering, PaywallListener listener)Shows the paywall of the offering in a new form over the current one.
Closing the paywall, or going back, returns to the form that was
showing, and so does a purchase or a restore that completes: the
paywall returns to that form first and the listener hears
purchaseCompleted or restoreCompleted, then closed, over it. An offering with no paywall document is shown with
the built-in one. The form’s UIID is
PaywallForm.
Call on the EDT.
Parameters
offeringOffering- the offering to sell
listenerPaywallListener- told what happens on the paywall, or null
Returns
the view that was shown
createDefault
public static Map<String, Object> createDefault(Offering offering)The built-in paywall document: a close button, a title, the packages
of the offering as a list, a purchase button, a restore button and a
footer. It names no colors, so the theme decides them all.
Parameters
offeringOffering- the offering the document is for; may be null
Returns
a new paywall document, which the caller may change