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
A Promotion Code represents a customer-redeemable code for a coupon. It can be used to create multiple codes
for a single coupon.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod -
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, 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 a coupon.static PromotionCodecreate(PromotionCodeCreateParams params, RequestOptions options) A promotion code points to a coupon.static PromotionCodeA promotion code points to a coupon.static PromotionCodecreate(Map<String, Object> params, RequestOptions options) A promotion code points to a coupon.booleanWhether the promotion code is currently active.getCode()The customer-facing code.A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.Time at which the object was created.Get ID of expandablecustomerobject.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.voidA coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.voidsetCreated(Long created) Time at which the object was created.voidsetCustomer(String id) 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.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, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, requestSearchResult, requestSearchResult, requestStream, requestStream, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeIdMethods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
Constructor Details
-
PromotionCode
public PromotionCode()
-
-
Method Details
-
getCustomer
Get ID of expandablecustomerobject. -
setCustomer
-
getCustomerObject
Get expandedcustomer. -
setCustomerObject
-
create
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(Map<String, Object> params, RequestOptions options) throws StripeExceptionA promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
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
-
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
-
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. -
getCoupon
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to subscriptions, invoices, checkout sessions, quotes, and more. Coupons do not work with conventional one-off charges or payment intents. -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
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. -
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. -
setCoupon
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to subscriptions, invoices, checkout sessions, quotes, and more. Coupons do not work with conventional one-off charges or payment intents. -
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
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. -
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>
-