Class Coupon
- java.lang.Object
-
- com.stripe.model.StripeObject
-
- com.stripe.net.ApiResource
-
- com.stripe.model.Coupon
-
- All Implemented Interfaces:
HasId,MetadataStore<Coupon>,StripeObjectInterface
public class Coupon extends ApiResource implements HasId, MetadataStore<Coupon>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCoupon.AppliesTo-
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
-
Field Summary
-
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON
-
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
-
Constructor Summary
Constructors Constructor Description Coupon()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(java.lang.Object other)static Couponcreate(CouponCreateParams params)You can create coupons easily via the coupon management page of the Stripe dashboard.static Couponcreate(CouponCreateParams params, RequestOptions options)You can create coupons easily via the coupon management page of the Stripe dashboard.static Couponcreate(java.util.Map<java.lang.String,java.lang.Object> params)You can create coupons easily via the coupon management page of the Stripe dashboard.static Couponcreate(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)You can create coupons easily via the coupon management page of the Stripe dashboard.Coupondelete()You can delete coupons via the coupon management page of the Stripe dashboard.Coupondelete(RequestOptions options)You can delete coupons via the coupon management page of the Stripe dashboard.Coupondelete(java.util.Map<java.lang.String,java.lang.Object> params)You can delete coupons via the coupon management page of the Stripe dashboard.Coupondelete(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)You can delete coupons via the coupon management page of the Stripe dashboard.booleanequals(java.lang.Object o)java.lang.LonggetAmountOff()Amount (in thecurrencyspecified) that will be taken off the subtotal of any invoices for this customer.Coupon.AppliesTogetAppliesTo()java.lang.LonggetCreated()Time at which the object was created.java.lang.StringgetCurrency()Ifamount_offhas been set, the three-letter ISO code for the currency of the amount to take off.java.lang.BooleangetDeleted()Always true for a deleted object.java.lang.StringgetDuration()One offorever,once, andrepeating.java.lang.LonggetDurationInMonths()Ifdurationisrepeating, the number of months the coupon applies.java.lang.StringgetId()Unique identifier for the object.java.lang.BooleangetLivemode()Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.java.lang.LonggetMaxRedemptions()Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.java.util.Map<java.lang.String,java.lang.String>getMetadata()Set of key-value pairs that you can attach to an object.java.lang.StringgetName()Name of the coupon displayed to customers on for instance invoices or receipts.java.lang.StringgetObject()String representing the object's type.java.math.BigDecimalgetPercentOff()Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon.java.lang.LonggetRedeemBy()Date after which the coupon can no longer be redeemed.java.lang.LonggetTimesRedeemed()Number of times this coupon has been applied to a customer.java.lang.BooleangetValid()Taking account of the above properties, whether this coupon can still be applied to a customer.inthashCode()static CouponCollectionlist(CouponListParams params)Returns a list of your coupons.static CouponCollectionlist(CouponListParams params, RequestOptions options)Returns a list of your coupons.static CouponCollectionlist(java.util.Map<java.lang.String,java.lang.Object> params)Returns a list of your coupons.static CouponCollectionlist(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Returns a list of your coupons.static Couponretrieve(java.lang.String coupon)Retrieves the coupon with the given ID.static Couponretrieve(java.lang.String coupon, RequestOptions options)Retrieves the coupon with the given ID.static Couponretrieve(java.lang.String coupon, CouponRetrieveParams params, RequestOptions options)Retrieves the coupon with the given ID.static Couponretrieve(java.lang.String coupon, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Retrieves the coupon with the given ID.voidsetAmountOff(java.lang.Long amountOff)Amount (in thecurrencyspecified) that will be taken off the subtotal of any invoices for this customer.voidsetAppliesTo(Coupon.AppliesTo appliesTo)voidsetCreated(java.lang.Long created)Time at which the object was created.voidsetCurrency(java.lang.String currency)Ifamount_offhas been set, the three-letter ISO code for the currency of the amount to take off.voidsetDeleted(java.lang.Boolean deleted)Always true for a deleted object.voidsetDuration(java.lang.String duration)One offorever,once, andrepeating.voidsetDurationInMonths(java.lang.Long durationInMonths)Ifdurationisrepeating, the number of months the coupon applies.voidsetId(java.lang.String id)Unique identifier for the object.voidsetLivemode(java.lang.Boolean livemode)Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidsetMaxRedemptions(java.lang.Long maxRedemptions)Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.voidsetMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)Set of key-value pairs that you can attach to an object.voidsetName(java.lang.String name)Name of the coupon displayed to customers on for instance invoices or receipts.voidsetObject(java.lang.String object)String representing the object's type.voidsetPercentOff(java.math.BigDecimal percentOff)Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon.voidsetRedeemBy(java.lang.Long redeemBy)Date after which the coupon can no longer be redeemed.voidsetTimesRedeemed(java.lang.Long timesRedeemed)Number of times this coupon has been applied to a customer.voidsetValid(java.lang.Boolean valid)Taking account of the above properties, whether this coupon can still be applied to a customer.Couponupdate(CouponUpdateParams params)Updates the metadata of a coupon.Couponupdate(CouponUpdateParams params, RequestOptions options)Updates the metadata of a coupon.Couponupdate(java.util.Map<java.lang.String,java.lang.Object> params)Updates the metadata of a coupon.Couponupdate(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Updates the metadata of a coupon.-
Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeId
-
Methods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
-
-
-
Method Detail
-
list
public static CouponCollection list(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Returns a list of your coupons.- Throws:
StripeException
-
list
public static CouponCollection list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Returns a list of your coupons.- Throws:
StripeException
-
list
public static CouponCollection list(CouponListParams params) throws StripeException
Returns a list of your coupons.- Throws:
StripeException
-
list
public static CouponCollection list(CouponListParams params, RequestOptions options) throws StripeException
Returns a list of your coupons.- Throws:
StripeException
-
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_offor anamount_offandcurrency. If you set anamount_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 anamount_offof 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with anamount_offof 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_offor anamount_offandcurrency. If you set anamount_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 anamount_offof 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with anamount_offof 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_offor anamount_offandcurrency. If you set anamount_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 anamount_offof 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with anamount_offof 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_offor anamount_offandcurrency. If you set anamount_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 anamount_offof 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with anamount_offof 200 is applied to it.- Throws:
StripeException
-
retrieve
public static Coupon retrieve(java.lang.String coupon) throws StripeException
Retrieves the coupon with the given ID.- Throws:
StripeException
-
retrieve
public static Coupon retrieve(java.lang.String coupon, RequestOptions options) throws StripeException
Retrieves the coupon with the given ID.- Throws:
StripeException
-
retrieve
public static Coupon retrieve(java.lang.String coupon, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Retrieves the coupon with the given ID.- Throws:
StripeException
-
retrieve
public static Coupon retrieve(java.lang.String coupon, CouponRetrieveParams params, RequestOptions options) throws StripeException
Retrieves the coupon with the given ID.- 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:
updatein interfaceMetadataStore<Coupon>- Throws:
StripeException
-
update
public Coupon update(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.- Specified by:
updatein interfaceMetadataStore<Coupon>- Throws:
StripeException
-
update
public Coupon update(CouponUpdateParams params) throws StripeException
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.- Throws:
StripeException
-
update
public Coupon update(CouponUpdateParams params, RequestOptions options) throws StripeException
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.- 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 thecurrencyspecified) that will be taken off the subtotal of any invoices for this customer.
-
getAppliesTo
public Coupon.AppliesTo getAppliesTo()
-
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()
Ifamount_offhas 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 offorever,once, andrepeating. Describes how long a customer who applies this coupon will get the discount.
-
getDurationInMonths
public java.lang.Long getDurationInMonths()
Ifdurationisrepeating, the number of months the coupon applies. Null if coupondurationisforeveroronce.
-
getLivemode
public java.lang.Boolean getLivemode()
Has the valuetrueif the object exists in live mode or the valuefalseif 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 thecurrencyspecified) that will be taken off the subtotal of any invoices for this customer.
-
setAppliesTo
public void setAppliesTo(Coupon.AppliesTo appliesTo)
-
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)
Ifamount_offhas 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 offorever,once, andrepeating. Describes how long a customer who applies this coupon will get the discount.
-
setDurationInMonths
public void setDurationInMonths(java.lang.Long durationInMonths)
Ifdurationisrepeating, the number of months the coupon applies. Null if coupondurationisforeveroronce.
-
setId
public void setId(java.lang.String id)
Unique identifier for the object.
-
setLivemode
public void setLivemode(java.lang.Boolean livemode)
Has the valuetrueif the object exists in live mode or the valuefalseif 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:
equalsin classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getId
public java.lang.String getId()
Unique identifier for the object.
-
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:
getMetadatain interfaceMetadataStore<Coupon>
-
-