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>,StripeActiveObject,StripeObjectInterface
A Promotion Code represents a customer-redeemable code for an underlying promotion. You can
create multiple codes for a single promotion.
If you enable promotion codes in your customer portal configuration, then customers can redeem a code themselves when updating a subscription in the portal. Customers can also view the currently active promotion codes and coupons on each of their subscriptions in the portal.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFor more details about Promotion, please refer to the API Reference.static classFor more details about Restrictions, please refer to the API Reference.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_GSONFields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanstatic PromotionCodecreate(PromotionCodeCreateParams params) A promotion code points to an underlying promotion.static PromotionCodecreate(PromotionCodeCreateParams params, RequestOptions options) A promotion code points to an underlying promotion.static PromotionCodeA promotion code points to an underlying promotion.static PromotionCodecreate(Map<String, Object> params, RequestOptions options) A promotion code points to an underlying promotion.booleanWhether the promotion code is currently active.getCode()The customer-facing code.Time at which the object was created.Get ID of expandablecustomerobject.The account that this promotion code can be used by.Get expandedcustomer.Date at which the promotion code can no longer be redeemed.getId()Unique identifier for the object.Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.Maximum number of times this promotion code can be redeemed.Set of key-value pairs that you can attach to an object.String representing the object's type.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 PromotionCodeCollectionReturns a list of your promotion codes.static PromotionCodeCollectionlist(Map<String, Object> params, RequestOptions options) Returns a list of your promotion codes.static PromotionCodeRetrieves the promotion code with the given ID.static PromotionCoderetrieve(String promotionCode, RequestOptions options) Retrieves the promotion code with the given ID.static PromotionCoderetrieve(String promotionCode, PromotionCodeRetrieveParams params, RequestOptions options) Retrieves the promotion code with the given ID.static PromotionCodeRetrieves the promotion code with the given ID.voidWhether the promotion code is currently active.voidThe customer-facing code.voidsetCreated(Long created) Time at which the object was created.voidsetCustomer(String id) voidsetCustomerAccount(String customerAccount) The account that this promotion code can be used by.voidsetCustomerObject(Customer expandableObject) voidsetExpiresAt(Long expiresAt) Date at which the promotion code can no longer be redeemed.voidUnique identifier for the object.voidsetLivemode(Boolean livemode) Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidsetMaxRedemptions(Long maxRedemptions) Maximum number of times this promotion code can be redeemed.voidsetMetadata(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.voidString representing the object's type.voidsetPromotion(PromotionCode.Promotion promotion) voidsetResponseGetter(StripeResponseGetter responseGetter) Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work).voidsetRestrictions(PromotionCode.Restrictions restrictions) voidsetTimesRedeemed(Long timesRedeemed) Number of times this promotion code has been used.update(PromotionCodeUpdateParams params) Updates the specified promotion code by setting the values of the parameters passed.update(PromotionCodeUpdateParams params, RequestOptions options) Updates the specified promotion code by setting the values of the parameters passed.Updates the specified promotion code by setting the values of the parameters passed.update(Map<String, 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, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setGlobalResponseGetter, urlEncode, urlEncodeIdMethods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
PromotionCode
public PromotionCode()
-
-
Method Details
-
getCustomer
Get ID of expandablecustomerobject. -
setCustomer
-
getCustomerObject
Get expandedcustomer. -
setCustomerObject
-
create
A promotion code points to an underlying promotion. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
public static PromotionCode create(Map<String, Object> params, RequestOptions options) throws StripeExceptionA promotion code points to an underlying promotion. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
A promotion code points to an underlying promotion. 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 an underlying promotion. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
list
Returns a list of your promotion codes.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionReturns a list of your promotion codes.- Throws:
StripeException
-
list
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
-
retrieve
Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facingcodeuse list with the desiredcode.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(String promotionCode, RequestOptions options) throws StripeException Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facingcodeuse list with the desiredcode.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(String promotionCode, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facingcodeuse list with the desiredcode.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(String promotionCode, PromotionCodeRetrieveParams params, RequestOptions options) throws StripeException Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facingcodeuse list with the desiredcode.- Throws:
StripeException
-
update
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(Map<String, Object> params, RequestOptions options) throws StripeExceptionUpdates 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
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
-
setResponseGetter
Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work).- Specified by:
setResponseGetterin interfaceStripeActiveObject- Overrides:
setResponseGetterin classApiResource- Parameters:
responseGetter- theStripeResponseGetterinstance to use for making further requests.
-
getActive
Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid. -
getCode
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9). -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getCustomerAccount
The account that this promotion code can be used by. -
getExpiresAt
Date at which the promotion code can no longer be redeemed. -
getLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
getMaxRedemptions
Maximum number of times this promotion code can be redeemed. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
promotion_code. -
getPromotion
-
getRestrictions
-
getTimesRedeemed
Number of times this promotion code has been used. -
setActive
Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid. -
setCode
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9). -
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setCustomerAccount
The account that this promotion code can be used by. -
setExpiresAt
Date at which the promotion code can no longer be redeemed. -
setId
Unique identifier for the object. -
setLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
setMaxRedemptions
Maximum number of times this promotion code can be redeemed. -
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. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
promotion_code. -
setPromotion
-
setRestrictions
-
setTimesRedeemed
Number of times this promotion code has been used. -
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:
getMetadatain interfaceMetadataStore<PromotionCode>
-