Class CommercePackage

java.lang.Object
com.codename1.payment.CommercePackage

public final class CommercePackage extends Object

One thing a customer can buy from an Offering: a store product together with the role it plays in the offering (the monthly plan, the annual plan, a lifetime unlock).

Everything the Codename One Commerce service said about the package is fixed when the instance is made. The store's own Product, which carries the localized price, is attached later, once the store has been asked.

  • Field Details

  • Method Details

    • getOfferingId

      public String getOfferingId()
      The id of the offering this package was listed in, or null for a package that came from no offering. A web checkout names the package by both ids.
    • getId

      public String getId()
      The id of the package inside its offering.
    • getType

      public String getType()
      The role of the package, one of the TYPE_ constants. A package the service gave no type is TYPE_CUSTOM.
    • isType

      public boolean isType(String packageType)

      Whether the package is of the given type. Types are compared without regard to case.

      Parameters
      • packageType: one of the TYPE_ constants
    • getProductId

      public String getProductId()
      The store product id (SKU) this package sells.
    • getPeriod

      public String getPeriod()
      The billing period as an ISO-8601 duration such as P1M, or null for a package that is not billed periodically.
    • getTrialPeriod

      public String getTrialPeriod()
      The free trial as an ISO-8601 duration such as P7D, or null when the package has none.
    • getIntroPrice

      public String getIntroPrice()
      The introductory price as text, or null when the package has none.
    • getIntroPeriod

      public String getIntroPeriod()
      How long the introductory price lasts, as an ISO-8601 duration, or null when the package has none.
    • isEligibleForIntro

      public boolean isEligibleForIntro()
      Whether this customer may still take the free trial or introductory price of the package, as far as the service knows.
    • isSubscription

      public boolean isSubscription()
      Whether buying the package starts a subscription. Everything is a subscription except a TYPE_LIFETIME package and a TYPE_CUSTOM one with no billing period.
    • getProduct

      public Product getProduct()

      The store's product for this package, which carries the localized price and name.

      Returns

      the product, or null while the store has not been asked or does not list products on this platform

    • toString

      public String toString()
      Description copied from class: Object
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
      Overrides:
      toString in class Object