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 class
Coupon.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 boolean
canEqual(java.lang.Object other)
static Coupon
create(CouponCreateParams params)
You can create coupons easily via the coupon management page of the Stripe dashboard.static Coupon
create(CouponCreateParams params, RequestOptions options)
You can create coupons easily via the coupon management page of the Stripe dashboard.static Coupon
create(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 Coupon
create(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.Coupon
delete()
You can delete coupons via the coupon management page of the Stripe dashboard.Coupon
delete(RequestOptions options)
You can delete coupons via the coupon management page of the Stripe dashboard.Coupon
delete(java.util.Map<java.lang.String,java.lang.Object> params)
You can delete coupons via the coupon management page of the Stripe dashboard.Coupon
delete(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.boolean
equals(java.lang.Object o)
java.lang.Long
getAmountOff()
Amount (in thecurrency
specified) that will be taken off the subtotal of any invoices for this customer.Coupon.AppliesTo
getAppliesTo()
java.lang.Long
getCreated()
Time at which the object was created.java.lang.String
getCurrency()
Ifamount_off
has been set, the three-letter ISO code for the currency of the amount to take off.java.lang.Boolean
getDeleted()
Always true for a deleted object.java.lang.String
getDuration()
One offorever
,once
, andrepeating
.java.lang.Long
getDurationInMonths()
Ifduration
isrepeating
, the number of months the coupon applies.java.lang.String
getId()
Unique identifier for the object.java.lang.Boolean
getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.java.lang.Long
getMaxRedemptions()
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.String
getName()
Name of the coupon displayed to customers on for instance invoices or receipts.java.lang.String
getObject()
String representing the object's type.java.math.BigDecimal
getPercentOff()
Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon.java.lang.Long
getRedeemBy()
Date after which the coupon can no longer be redeemed.java.lang.Long
getTimesRedeemed()
Number of times this coupon has been applied to a customer.java.lang.Boolean
getValid()
Taking account of the above properties, whether this coupon can still be applied to a customer.int
hashCode()
static CouponCollection
list(CouponListParams params)
Returns a list of your coupons.static CouponCollection
list(CouponListParams params, RequestOptions options)
Returns a list of your coupons.static CouponCollection
list(java.util.Map<java.lang.String,java.lang.Object> params)
Returns a list of your coupons.static CouponCollection
list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Returns a list of your coupons.static Coupon
retrieve(java.lang.String coupon)
Retrieves the coupon with the given ID.static Coupon
retrieve(java.lang.String coupon, RequestOptions options)
Retrieves the coupon with the given ID.static Coupon
retrieve(java.lang.String coupon, CouponRetrieveParams params, RequestOptions options)
Retrieves the coupon with the given ID.static Coupon
retrieve(java.lang.String coupon, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Retrieves the coupon with the given ID.void
setAmountOff(java.lang.Long amountOff)
Amount (in thecurrency
specified) that will be taken off the subtotal of any invoices for this customer.void
setAppliesTo(Coupon.AppliesTo appliesTo)
void
setCreated(java.lang.Long created)
Time at which the object was created.void
setCurrency(java.lang.String currency)
Ifamount_off
has been set, the three-letter ISO code for the currency of the amount to take off.void
setDeleted(java.lang.Boolean deleted)
Always true for a deleted object.void
setDuration(java.lang.String duration)
One offorever
,once
, andrepeating
.void
setDurationInMonths(java.lang.Long durationInMonths)
Ifduration
isrepeating
, the number of months the coupon applies.void
setId(java.lang.String id)
Unique identifier for the object.void
setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.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.void
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Set of key-value pairs that you can attach to an object.void
setName(java.lang.String name)
Name of the coupon displayed to customers on for instance invoices or receipts.void
setObject(java.lang.String object)
String representing the object's type.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.void
setRedeemBy(java.lang.Long redeemBy)
Date after which the coupon can no longer be redeemed.void
setTimesRedeemed(java.lang.Long timesRedeemed)
Number of times this coupon has been applied to a customer.void
setValid(java.lang.Boolean valid)
Taking account of the above properties, whether this coupon can still be applied to a customer.Coupon
update(CouponUpdateParams params)
Updates the metadata of a coupon.Coupon
update(CouponUpdateParams params, RequestOptions options)
Updates the metadata of a coupon.Coupon
update(java.util.Map<java.lang.String,java.lang.Object> params)
Updates the metadata of a coupon.Coupon
update(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, requestSearchResult, requestSearchResult, requestStream, requestStream, 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_off
or anamount_off
andcurrency
. 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_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 anamount_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 anamount_off
andcurrency
. 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_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 anamount_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 anamount_off
andcurrency
. 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_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 anamount_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 anamount_off
andcurrency
. 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_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 anamount_off
of 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:
update
in 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:
update
in 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 thecurrency
specified) 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_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 offorever
,once
, andrepeating
. Describes how long a customer who applies this coupon will get the discount.
-
getDurationInMonths
public java.lang.Long getDurationInMonths()
Ifduration
isrepeating
, the number of months the coupon applies. Null if couponduration
isforever
oronce
.
-
getLivemode
public java.lang.Boolean getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
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 thecurrency
specified) 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_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 offorever
,once
, andrepeating
. Describes how long a customer who applies this coupon will get the discount.
-
setDurationInMonths
public void setDurationInMonths(java.lang.Long durationInMonths)
Ifduration
isrepeating
, the number of months the coupon applies. Null if couponduration
isforever
oronce
.
-
setId
public void setId(java.lang.String id)
Unique identifier for the object.
-
setLivemode
public void setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
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 classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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:
getMetadata
in interfaceMetadataStore<Coupon>
-
-