Class Margin

All Implemented Interfaces:
HasId, MetadataStore<Margin>, StripeActiveObject, StripeObjectInterface

public class Margin extends ApiResource implements HasId, MetadataStore<Margin>
A (partner) margin represents a specific discount distributed in partner reseller programs to business partners who resell products and services and earn a discount (margin) for doing so.
  • Constructor Details

    • Margin

      public Margin()
  • Method Details

    • create

      public static Margin create(Map<String,Object> params) throws StripeException
      Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
      Throws:
      StripeException
    • create

      public static Margin create(Map<String,Object> params, RequestOptions options) throws StripeException
      Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
      Throws:
      StripeException
    • create

      public static Margin create(MarginCreateParams params) throws StripeException
      Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
      Throws:
      StripeException
    • create

      public static Margin create(MarginCreateParams params, RequestOptions options) throws StripeException
      Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
      Throws:
      StripeException
    • list

      public static MarginCollection list(Map<String,Object> params) throws StripeException
      Retrieve a list of your margins.
      Throws:
      StripeException
    • list

      public static MarginCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieve a list of your margins.
      Throws:
      StripeException
    • list

      public static MarginCollection list(MarginListParams params) throws StripeException
      Retrieve a list of your margins.
      Throws:
      StripeException
    • list

      public static MarginCollection list(MarginListParams params, RequestOptions options) throws StripeException
      Retrieve a list of your margins.
      Throws:
      StripeException
    • retrieve

      public static Margin retrieve(String margin) throws StripeException
      Retrieve a margin object with the given ID.
      Throws:
      StripeException
    • retrieve

      public static Margin retrieve(String margin, RequestOptions options) throws StripeException
      Retrieve a margin object with the given ID.
      Throws:
      StripeException
    • retrieve

      public static Margin retrieve(String margin, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieve a margin object with the given ID.
      Throws:
      StripeException
    • retrieve

      public static Margin retrieve(String margin, MarginRetrieveParams params, RequestOptions options) throws StripeException
      Retrieve a margin object with the given ID.
      Throws:
      StripeException
    • update

      public Margin update(Map<String,Object> params) throws StripeException
      Update the specified margin object. Certain fields of the margin object are not editable.
      Specified by:
      update in interface MetadataStore<Margin>
      Throws:
      StripeException
    • update

      public Margin update(Map<String,Object> params, RequestOptions options) throws StripeException
      Update the specified margin object. Certain fields of the margin object are not editable.
      Specified by:
      update in interface MetadataStore<Margin>
      Throws:
      StripeException
    • update

      public Margin update(MarginUpdateParams params) throws StripeException
      Update the specified margin object. Certain fields of the margin object are not editable.
      Throws:
      StripeException
    • update

      public Margin update(MarginUpdateParams params, RequestOptions options) throws StripeException
      Update the specified margin object. Certain fields of the margin object are not editable.
      Throws:
      StripeException
    • getActive

      public Boolean getActive()
      Whether the margin can be applied to invoices, invoice items, or invoice line items. Defaults to true.
    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getLivemode

      public Boolean getLivemode()
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • getName

      public String getName()
      Name of the margin that's displayed on, for example, invoices.
    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to margin.

    • getPercentOff

      public BigDecimal getPercentOff()
      Percent that will be taken off the subtotal before tax (after all other discounts and promotions) of any invoice to which the margin is applied.
    • getUpdated

      public Long getUpdated()
      Time at which the object was last updated. Measured in seconds since the Unix epoch.
    • setActive

      public void setActive(Boolean active)
      Whether the margin can be applied to invoices, invoice items, or invoice line items. Defaults to true.
    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setId

      public void setId(String id)
      Unique identifier for the object.
    • setLivemode

      public void setLivemode(Boolean livemode)
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • setName

      public void setName(String name)
      Name of the margin that's displayed on, for example, invoices.
    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to margin.

    • setPercentOff

      public void setPercentOff(BigDecimal percentOff)
      Percent that will be taken off the subtotal before tax (after all other discounts and promotions) of any invoice to which the margin is applied.
    • setUpdated

      public void setUpdated(Long updated)
      Time at which the object was last updated. Measured in seconds since the Unix epoch.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the object.
      Specified by:
      getId in interface HasId
    • getMetadata

      public Map<String,String> getMetadata()
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
      Specified by:
      getMetadata in interface MetadataStore<Margin>