public class Coupon extends ApiResource implements HasId, MetadataStore<Coupon>
ApiResource.RequestMethod
CHARSET, GSON
PRETTY_PRINT_GSON
Constructor and Description |
---|
Coupon() |
Modifier and Type | Method and 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(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.
|
Coupon |
delete(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 the
currency specified) that will be taken off the subtotal of any invoices
for this customer. |
java.lang.Long |
getCreated()
Time at which the object was created.
|
java.lang.String |
getCurrency()
If
amount_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 of
forever , once , and repeating . |
java.lang.Long |
getDurationInMonths()
If
duration is repeating , the number of months the coupon applies. |
java.lang.String |
getId()
Unique identifier for the object.
|
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. |
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,
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.
|
static Coupon |
retrieve(java.lang.String coupon,
RequestOptions options)
Retrieves the coupon with the given ID.
|
void |
setAmountOff(java.lang.Long amountOff)
Amount (in the
currency specified) that will be taken off the subtotal of any invoices
for this customer. |
void |
setCreated(java.lang.Long created)
Time at which the object was created.
|
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. |
void |
setDeleted(java.lang.Boolean deleted)
Always true for a deleted object.
|
void |
setDuration(java.lang.String duration)
One of
forever , once , and repeating . |
void |
setDurationInMonths(java.lang.Long durationInMonths)
If
duration is repeating , 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 value
true if the object exists in live mode or the value false 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.
|
checkNullTypedParams, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeId
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
public static CouponCollection list(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
StripeException
public static CouponCollection list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
StripeException
public static CouponCollection list(CouponListParams params) throws StripeException
StripeException
public static CouponCollection list(CouponListParams params, RequestOptions options) throws StripeException
StripeException
public static Coupon create(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
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.
StripeException
public static Coupon create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
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.
StripeException
public static Coupon create(CouponCreateParams params) throws StripeException
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.
StripeException
public static Coupon create(CouponCreateParams params, RequestOptions options) throws StripeException
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.
StripeException
public static Coupon retrieve(java.lang.String coupon) throws StripeException
StripeException
public static Coupon retrieve(java.lang.String coupon, RequestOptions options) throws StripeException
StripeException
public static Coupon retrieve(java.lang.String coupon, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
StripeException
public static Coupon retrieve(java.lang.String coupon, CouponRetrieveParams params, RequestOptions options) throws StripeException
StripeException
public Coupon update(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
update
in interface MetadataStore<Coupon>
StripeException
public Coupon update(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
update
in interface MetadataStore<Coupon>
StripeException
public Coupon update(CouponUpdateParams params) throws StripeException
StripeException
public Coupon update(CouponUpdateParams params, RequestOptions options) throws StripeException
StripeException
public Coupon delete() throws StripeException
StripeException
public Coupon delete(RequestOptions options) throws StripeException
StripeException
public Coupon delete(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
StripeException
public Coupon delete(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
StripeException
public java.lang.Long getAmountOff()
currency
specified) that will be taken off the subtotal of any invoices
for this customer.public java.lang.Long getCreated()
public java.lang.String getCurrency()
amount_off
has been set, the three-letter ISO code for the currency of the amount to take
off.public java.lang.Boolean getDeleted()
public java.lang.String getDuration()
forever
, once
, and repeating
. Describes how long a customer who
applies this coupon will get the discount.public java.lang.Long getDurationInMonths()
duration
is repeating
, the number of months the coupon applies. Null if
coupon duration
is forever
or once
.public java.lang.Boolean getLivemode()
true
if the object exists in live mode or the value false
if the
object exists in test mode.public java.lang.Long getMaxRedemptions()
public java.lang.String getName()
public java.lang.String getObject()
Equal to coupon
.
public java.math.BigDecimal getPercentOff()
public java.lang.Long getRedeemBy()
public java.lang.Long getTimesRedeemed()
public java.lang.Boolean getValid()
public void setAmountOff(java.lang.Long amountOff)
currency
specified) that will be taken off the subtotal of any invoices
for this customer.public void setCreated(java.lang.Long created)
public void setCurrency(java.lang.String currency)
amount_off
has been set, the three-letter ISO code for the currency of the amount to take
off.public void setDeleted(java.lang.Boolean deleted)
public void setDuration(java.lang.String duration)
forever
, once
, and repeating
. Describes how long a customer who
applies this coupon will get the discount.public void setDurationInMonths(java.lang.Long durationInMonths)
duration
is repeating
, the number of months the coupon applies. Null if
coupon duration
is forever
or once
.public void setId(java.lang.String id)
public void setLivemode(java.lang.Boolean livemode)
true
if the object exists in live mode or the value false
if the
object exists in test mode.public void setMaxRedemptions(java.lang.Long maxRedemptions)
public void setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
public void setName(java.lang.String name)
public void setObject(java.lang.String object)
Equal to coupon
.
public void setPercentOff(java.math.BigDecimal percentOff)
public void setRedeemBy(java.lang.Long redeemBy)
public void setTimesRedeemed(java.lang.Long timesRedeemed)
public void setValid(java.lang.Boolean valid)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
protected boolean canEqual(java.lang.Object other)
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getId()
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
getMetadata
in interface MetadataStore<Coupon>