Class Coupon

    • Constructor Detail

      • Coupon

        public Coupon()
    • Method Detail

      • create

        public static Coupon create​(java.util.Map<java.lang.String,​java.lang.Object> params)
                             throws StripeException
        You can create coupons easily via the coupon management page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

        A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.

        Throws:
        StripeException
      • create

        public static Coupon create​(java.util.Map<java.lang.String,​java.lang.Object> params,
                                    RequestOptions options)
                             throws StripeException
        You can create coupons easily via the coupon management page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

        A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.

        Throws:
        StripeException
      • create

        public static Coupon create​(CouponCreateParams params)
                             throws StripeException
        You can create coupons easily via the coupon management page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

        A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.

        Throws:
        StripeException
      • create

        public static Coupon create​(CouponCreateParams params,
                                    RequestOptions options)
                             throws StripeException
        You can create coupons easily via the coupon management page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.

        A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.

        Throws:
        StripeException
      • update

        public Coupon update​(java.util.Map<java.lang.String,​java.lang.Object> params)
                      throws StripeException
        Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
        Specified by:
        update in interface MetadataStore<Coupon>
        Throws:
        StripeException
      • delete

        public Coupon delete()
                      throws StripeException
        You can delete coupons via the coupon management page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. You can also delete coupons via the API.
        Throws:
        StripeException
      • delete

        public Coupon delete​(RequestOptions options)
                      throws StripeException
        You can delete coupons via the coupon management page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. You can also delete coupons via the API.
        Throws:
        StripeException
      • delete

        public Coupon delete​(java.util.Map<java.lang.String,​java.lang.Object> params)
                      throws StripeException
        You can delete coupons via the coupon management page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. You can also delete coupons via the API.
        Throws:
        StripeException
      • delete

        public Coupon delete​(java.util.Map<java.lang.String,​java.lang.Object> params,
                             RequestOptions options)
                      throws StripeException
        You can delete coupons via the coupon management page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. You can also delete coupons via the API.
        Throws:
        StripeException
      • getAmountOff

        public java.lang.Long getAmountOff()
        Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.
      • getCreated

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

        public java.lang.String getCurrency()
        If amount_off has been set, the three-letter ISO code for the currency of the amount to take off.
      • getDeleted

        public java.lang.Boolean getDeleted()
        Always true for a deleted object.
      • getDuration

        public java.lang.String getDuration()
        One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount.
      • getDurationInMonths

        public java.lang.Long getDurationInMonths()
        If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
      • getLivemode

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

        public java.lang.Long getMaxRedemptions()
        Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
      • getName

        public java.lang.String getName()
        Name of the coupon displayed to customers on for instance invoices or receipts.
      • getObject

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

        Equal to coupon.

      • getPercentOff

        public java.math.BigDecimal getPercentOff()
        Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead.
      • getRedeemBy

        public java.lang.Long getRedeemBy()
        Date after which the coupon can no longer be redeemed.
      • getTimesRedeemed

        public java.lang.Long getTimesRedeemed()
        Number of times this coupon has been applied to a customer.
      • getValid

        public java.lang.Boolean getValid()
        Taking account of the above properties, whether this coupon can still be applied to a customer.
      • setAmountOff

        public void setAmountOff​(java.lang.Long amountOff)
        Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.
      • setCreated

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

        public void setCurrency​(java.lang.String currency)
        If amount_off has been set, the three-letter ISO code for the currency of the amount to take off.
      • setDeleted

        public void setDeleted​(java.lang.Boolean deleted)
        Always true for a deleted object.
      • setDuration

        public void setDuration​(java.lang.String duration)
        One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount.
      • setDurationInMonths

        public void setDurationInMonths​(java.lang.Long durationInMonths)
        If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
      • setId

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

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

        public void setMaxRedemptions​(java.lang.Long maxRedemptions)
        Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
      • setMetadata

        public void setMetadata​(java.util.Map<java.lang.String,​java.lang.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​(java.lang.String name)
        Name of the coupon displayed to customers on for instance invoices or receipts.
      • setObject

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

        Equal to coupon.

      • setPercentOff

        public void setPercentOff​(java.math.BigDecimal percentOff)
        Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead.
      • setRedeemBy

        public void setRedeemBy​(java.lang.Long redeemBy)
        Date after which the coupon can no longer be redeemed.
      • setTimesRedeemed

        public void setTimesRedeemed​(java.lang.Long timesRedeemed)
        Number of times this coupon has been applied to a customer.
      • setValid

        public void setValid​(java.lang.Boolean valid)
        Taking account of the above properties, whether this coupon can still be applied to a customer.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

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

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

        public java.util.Map<java.lang.String,​java.lang.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<Coupon>