Class Paywall

java.lang.Object
com.codename1.payment.paywall.Paywall

public final class Paywall extends Object

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() {
    }
});
  • 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
      • offering: the offering to sell

      • listener: 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
      • offering: the offering the document is for; may be null
      Returns

      a new paywall document, which the caller may change