Class Discount

All Implemented Interfaces:
HasId, StripeObjectInterface

public class Discount extends StripeObject implements HasId
A discount represents the actual application of a coupon or promotion code. It contains information about when the discount began, when it will end, and what it is applied to.

Related guide: Applying Discounts to Subscriptions.

  • Constructor Details

    • Discount

      public Discount()
  • Method Details

    • getCustomer

      public String getCustomer()
      Get ID of expandable customer object.
    • setCustomer

      public void setCustomer(String id)
    • getCustomerObject

      public Customer getCustomerObject()
      Get expanded customer.
    • setCustomerObject

      public void setCustomerObject(Customer expandableObject)
    • getPromotionCode

      public String getPromotionCode()
      Get ID of expandable promotionCode object.
    • setPromotionCode

      public void setPromotionCode(String id)
    • getPromotionCodeObject

      public PromotionCode getPromotionCodeObject()
      Get expanded promotionCode.
    • setPromotionCodeObject

      public void setPromotionCodeObject(PromotionCode expandableObject)
    • getCheckoutSession

      public String getCheckoutSession()
      The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.
    • getCoupon

      public Coupon getCoupon()
      A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to subscriptions, invoices, checkout sessions, quotes, and more. Coupons do not work with conventional one-off charges or payment intents.
    • getDeleted

      public Boolean getDeleted()
      Always true for a deleted object.
    • getEnd

      public Long getEnd()
      If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null.
    • getInvoice

      public String getInvoice()
      The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.
    • getInvoiceItem

      public String getInvoiceItem()
      The invoice item id (or invoice line item id for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
    • getObject

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

      Equal to discount.

    • getStart

      public Long getStart()
      Date that the coupon was applied.
    • getSubscription

      public String getSubscription()
      The subscription that this coupon is applied to, if it is applied to a particular subscription.
    • setCheckoutSession

      public void setCheckoutSession(String checkoutSession)
      The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.
    • setCoupon

      public void setCoupon(Coupon coupon)
      A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to subscriptions, invoices, checkout sessions, quotes, and more. Coupons do not work with conventional one-off charges or payment intents.
    • setDeleted

      public void setDeleted(Boolean deleted)
      Always true for a deleted object.
    • setEnd

      public void setEnd(Long end)
      If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null.
    • setId

      public void setId(String id)
      The ID of the discount object. Discounts cannot be fetched by ID. Use expand[]=discounts in API calls to expand discount IDs in an array.
    • setInvoice

      public void setInvoice(String invoice)
      The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.
    • setInvoiceItem

      public void setInvoiceItem(String invoiceItem)
      The invoice item id (or invoice line item id for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
    • setObject

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

      Equal to discount.

    • setStart

      public void setStart(Long start)
      Date that the coupon was applied.
    • setSubscription

      public void setSubscription(String subscription)
      The subscription that this coupon is applied to, if it is applied to a particular subscription.
    • 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()
      The ID of the discount object. Discounts cannot be fetched by ID. Use expand[]=discounts in API calls to expand discount IDs in an array.
      Specified by:
      getId in interface HasId