Class Coupon
- All Implemented Interfaces:
HasId
,MetadataStore<Coupon>
,StripeActiveObject
,StripeObjectInterface
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON, INTERNAL_GSON
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
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
You can create coupons easily via the coupon management page of the Stripe dashboard.static Coupon
create
(Map<String, Object> params, RequestOptions options) You can create coupons easily via the coupon management page of the Stripe dashboard.delete()
You can delete coupons via the coupon management page of the Stripe dashboard.delete
(RequestOptions options) You can delete coupons via the coupon management page of the Stripe dashboard.You can delete coupons via the coupon management page of the Stripe dashboard.delete
(Map<String, Object> params, RequestOptions options) You can delete coupons via the coupon management page of the Stripe dashboard.boolean
Amount (in thecurrency
specified) that will be taken off the subtotal of any invoices for this customer.Time at which the object was created.Ifamount_off
has been set, the three-letter ISO code for the currency of the amount to take off.Coupons defined in each available currency option.Always true for a deleted object.One offorever
,once
, andrepeating
.Ifduration
isrepeating
, the number of months the coupon applies.getId()
Unique identifier for the object.Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.Set of key-value pairs that you can attach to an object.getName()
Name of the coupon displayed to customers on for instance invoices or receipts.String representing the object's type.Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon.Date after which the coupon can no longer be redeemed.Number of times this coupon has been applied to a customer.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
Returns a list of your coupons.static CouponCollection
list
(Map<String, Object> params, RequestOptions options) Returns a list of your coupons.static Coupon
Retrieves the coupon with the given ID.static Coupon
retrieve
(String coupon, RequestOptions options) Retrieves the coupon with the given ID.static Coupon
retrieve
(String coupon, CouponRetrieveParams params, RequestOptions options) Retrieves the coupon with the given ID.static Coupon
Retrieves the coupon with the given ID.void
setAmountOff
(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
(Long created) Time at which the object was created.void
setCurrency
(String currency) Ifamount_off
has been set, the three-letter ISO code for the currency of the amount to take off.void
setCurrencyOptions
(Map<String, Coupon.CurrencyOption> currencyOptions) Coupons defined in each available currency option.void
setDeleted
(Boolean deleted) Always true for a deleted object.void
setDuration
(String duration) One offorever
,once
, andrepeating
.void
setDurationInMonths
(Long durationInMonths) Ifduration
isrepeating
, the number of months the coupon applies.void
Unique identifier for the object.void
setLivemode
(Boolean livemode) Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
setMaxRedemptions
(Long maxRedemptions) Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.void
setMetadata
(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.void
Name of the coupon displayed to customers on for instance invoices or receipts.void
String representing the object's type.void
setPercentOff
(BigDecimal percentOff) Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon.void
setRedeemBy
(Long redeemBy) Date after which the coupon can no longer be redeemed.void
setResponseGetter
(StripeResponseGetter responseGetter) Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.void
setTimesRedeemed
(Long timesRedeemed) Number of times this coupon has been applied to a customer.void
Taking account of the above properties, whether this coupon can still be applied to a customer.update
(CouponUpdateParams params) Updates the metadata of a coupon.update
(CouponUpdateParams params, RequestOptions options) Updates the metadata of a coupon.Updates the metadata of a coupon.update
(Map<String, Object> params, RequestOptions options) Updates the metadata of a coupon.Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setStripeResponseGetter, urlEncode, urlEncodeId
Methods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
Coupon
public Coupon()
-
-
Method Details
-
create
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(Map<String, Object> params, RequestOptions options) throws StripeExceptionYou 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
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
-
delete
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
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
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
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
-
list
Returns a list of your coupons.- Throws:
StripeException
-
list
public static CouponCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionReturns a list of your coupons.- Throws:
StripeException
-
list
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
-
retrieve
Retrieves the coupon with the given ID.- Throws:
StripeException
-
retrieve
Retrieves the coupon with the given ID.- Throws:
StripeException
-
retrieve
public static Coupon retrieve(String coupon, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves the coupon with the given ID.- Throws:
StripeException
-
retrieve
public static Coupon retrieve(String coupon, CouponRetrieveParams params, RequestOptions options) throws StripeException Retrieves the coupon with the given ID.- Throws:
StripeException
-
update
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
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
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.- Throws:
StripeException
-
update
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.- Throws:
StripeException
-
setResponseGetter
Description copied from interface:StripeActiveObject
Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.- Specified by:
setResponseGetter
in interfaceStripeActiveObject
- Overrides:
setResponseGetter
in classApiResource
- Parameters:
responseGetter
- theStripeResponseGetter
instance to use for making further requests.
-
getAmountOff
Amount (in thecurrency
specified) that will be taken off the subtotal of any invoices for this customer. -
getAppliesTo
-
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getCurrency
Ifamount_off
has been set, the three-letter ISO code for the currency of the amount to take off. -
getCurrencyOptions
Coupons defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency. -
getDeleted
Always true for a deleted object. -
getDuration
One offorever
,once
, andrepeating
. Describes how long a customer who applies this coupon will get the discount. -
getDurationInMonths
Ifduration
isrepeating
, the number of months the coupon applies. Null if couponduration
isforever
oronce
. -
getLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
getMaxRedemptions
Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. -
getName
Name of the coupon displayed to customers on for instance invoices or receipts. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
coupon
. -
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 $ (or local equivalent)100 invoice $ (or local equivalent)50 instead. -
getRedeemBy
Date after which the coupon can no longer be redeemed. -
getTimesRedeemed
Number of times this coupon has been applied to a customer. -
getValid
Taking account of the above properties, whether this coupon can still be applied to a customer. -
setAmountOff
Amount (in thecurrency
specified) that will be taken off the subtotal of any invoices for this customer. -
setAppliesTo
-
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setCurrency
Ifamount_off
has been set, the three-letter ISO code for the currency of the amount to take off. -
setCurrencyOptions
Coupons defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency. -
setDeleted
Always true for a deleted object. -
setDuration
One offorever
,once
, andrepeating
. Describes how long a customer who applies this coupon will get the discount. -
setDurationInMonths
Ifduration
isrepeating
, the number of months the coupon applies. Null if couponduration
isforever
oronce
. -
setId
Unique identifier for the object. -
setLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
setMaxRedemptions
Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. -
setMetadata
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
Name of the coupon displayed to customers on for instance invoices or receipts. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
coupon
. -
setPercentOff
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 $ (or local equivalent)100 invoice $ (or local equivalent)50 instead. -
setRedeemBy
Date after which the coupon can no longer be redeemed. -
setTimesRedeemed
Number of times this coupon has been applied to a customer. -
setValid
Taking account of the above properties, whether this coupon can still be applied to a customer. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object. -
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>
-