Package com.stripe.model
Class PromotionCode
- java.lang.Object
-
- com.stripe.model.StripeObject
-
- com.stripe.net.ApiResource
-
- com.stripe.model.PromotionCode
-
- All Implemented Interfaces:
HasId,MetadataStore<PromotionCode>,StripeObjectInterface
public class PromotionCode extends ApiResource implements HasId, MetadataStore<PromotionCode>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPromotionCode.Restrictions-
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 PromotionCode()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(java.lang.Object other)static PromotionCodecreate(PromotionCodeCreateParams params)A promotion code points to a coupon.static PromotionCodecreate(PromotionCodeCreateParams params, RequestOptions options)A promotion code points to a coupon.static PromotionCodecreate(java.util.Map<java.lang.String,java.lang.Object> params)A promotion code points to a coupon.static PromotionCodecreate(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)A promotion code points to a coupon.booleanequals(java.lang.Object o)java.lang.BooleangetActive()Whether the promotion code is currently active.java.lang.StringgetCode()The customer-facing code.CoupongetCoupon()A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.java.lang.LonggetCreated()Time at which the object was created.java.lang.StringgetCustomer()Get ID of expandablecustomerobject.CustomergetCustomerObject()Get expandedcustomer.java.lang.LonggetExpiresAt()Date at which the promotion code can no longer be redeemed.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 promotion code can be redeemed.java.util.Map<java.lang.String,java.lang.String>getMetadata()Set of key-value pairs that you can attach to an object.java.lang.StringgetObject()String representing the object's type.PromotionCode.RestrictionsgetRestrictions()java.lang.LonggetTimesRedeemed()Number of times this promotion code has been used.inthashCode()static PromotionCodeCollectionlist(PromotionCodeListParams params)Returns a list of your promotion codes.static PromotionCodeCollectionlist(PromotionCodeListParams params, RequestOptions options)Returns a list of your promotion codes.static PromotionCodeCollectionlist(java.util.Map<java.lang.String,java.lang.Object> params)Returns a list of your promotion codes.static PromotionCodeCollectionlist(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Returns a list of your promotion codes.static PromotionCoderetrieve(java.lang.String promotionCode)Retrieves the promotion code with the given ID.static PromotionCoderetrieve(java.lang.String promotionCode, RequestOptions options)Retrieves the promotion code with the given ID.static PromotionCoderetrieve(java.lang.String promotionCode, PromotionCodeRetrieveParams params, RequestOptions options)Retrieves the promotion code with the given ID.static PromotionCoderetrieve(java.lang.String promotionCode, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Retrieves the promotion code with the given ID.voidsetActive(java.lang.Boolean active)Whether the promotion code is currently active.voidsetCode(java.lang.String code)The customer-facing code.voidsetCoupon(Coupon coupon)A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.voidsetCreated(java.lang.Long created)Time at which the object was created.voidsetCustomer(java.lang.String id)voidsetCustomerObject(Customer expandableObject)voidsetExpiresAt(java.lang.Long expiresAt)Date at which the promotion code can no longer be redeemed.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 promotion code can be redeemed.voidsetMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)Set of key-value pairs that you can attach to an object.voidsetObject(java.lang.String object)String representing the object's type.voidsetRestrictions(PromotionCode.Restrictions restrictions)voidsetTimesRedeemed(java.lang.Long timesRedeemed)Number of times this promotion code has been used.PromotionCodeupdate(PromotionCodeUpdateParams params)Updates the specified promotion code by setting the values of the parameters passed.PromotionCodeupdate(PromotionCodeUpdateParams params, RequestOptions options)Updates the specified promotion code by setting the values of the parameters passed.PromotionCodeupdate(java.util.Map<java.lang.String,java.lang.Object> params)Updates the specified promotion code by setting the values of the parameters passed.PromotionCodeupdate(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Updates the specified promotion code by setting the values of the parameters passed.-
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
-
getCustomer
public java.lang.String getCustomer()
Get ID of expandablecustomerobject.
-
setCustomer
public void setCustomer(java.lang.String id)
-
getCustomerObject
public Customer getCustomerObject()
Get expandedcustomer.
-
setCustomerObject
public void setCustomerObject(Customer expandableObject)
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode, RequestOptions options) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode, PromotionCodeRetrieveParams params, RequestOptions options) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
create
public static PromotionCode create(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
public static PromotionCode create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
public static PromotionCode create(PromotionCodeCreateParams params) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
public static PromotionCode create(PromotionCodeCreateParams params, RequestOptions options) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
update
public PromotionCode update(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Specified by:
updatein interfaceMetadataStore<PromotionCode>- Throws:
StripeException
-
update
public PromotionCode update(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Specified by:
updatein interfaceMetadataStore<PromotionCode>- Throws:
StripeException
-
update
public PromotionCode update(PromotionCodeUpdateParams params) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Throws:
StripeException
-
update
public PromotionCode update(PromotionCodeUpdateParams params, RequestOptions options) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(PromotionCodeListParams params) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(PromotionCodeListParams params, RequestOptions options) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
getActive
public java.lang.Boolean getActive()
Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.
-
getCode
public java.lang.String getCode()
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
-
getCoupon
public Coupon getCoupon()
-
getCreated
public java.lang.Long getCreated()
Time at which the object was created. Measured in seconds since the Unix epoch.
-
getExpiresAt
public java.lang.Long getExpiresAt()
Date at which the promotion code can no longer be redeemed.
-
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 promotion code can be redeemed.
-
getObject
public java.lang.String getObject()
String representing the object's type. Objects of the same type share the same value.Equal to
promotion_code.
-
getRestrictions
public PromotionCode.Restrictions getRestrictions()
-
getTimesRedeemed
public java.lang.Long getTimesRedeemed()
Number of times this promotion code has been used.
-
setActive
public void setActive(java.lang.Boolean active)
Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.
-
setCode
public void setCode(java.lang.String code)
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
-
setCoupon
public void setCoupon(Coupon coupon)
-
setCreated
public void setCreated(java.lang.Long created)
Time at which the object was created. Measured in seconds since the Unix epoch.
-
setExpiresAt
public void setExpiresAt(java.lang.Long expiresAt)
Date at which the promotion code can no longer be redeemed.
-
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 promotion code can be redeemed.
-
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.
-
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
promotion_code.
-
setRestrictions
public void setRestrictions(PromotionCode.Restrictions restrictions)
-
setTimesRedeemed
public void setTimesRedeemed(java.lang.Long timesRedeemed)
Number of times this promotion code has been used.
-
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<PromotionCode>
-
-