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 a coupon. It can be used to create multiple codes
for a single coupon.
-
Nested Class Summary
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 PromotionCode
create
(PromotionCodeCreateParams params) A promotion code points to a coupon.static PromotionCode
create
(PromotionCodeCreateParams params, RequestOptions options) A promotion code points to a coupon.static PromotionCode
A promotion code points to a coupon.static PromotionCode
create
(Map<String, Object> params, RequestOptions options) A promotion code points to a coupon.boolean
Whether 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 expandablecustomer
object.Get expandedcustomer
.Date at which the promotion code can no longer be redeemed.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 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.int
hashCode()
static PromotionCodeCollection
list
(PromotionCodeListParams params) Returns a list of your promotion codes.static PromotionCodeCollection
list
(PromotionCodeListParams params, RequestOptions options) Returns a list of your promotion codes.static PromotionCodeCollection
Returns a list of your promotion codes.static PromotionCodeCollection
list
(Map<String, Object> params, RequestOptions options) Returns a list of your promotion codes.static PromotionCode
Retrieves the promotion code with the given ID.static PromotionCode
retrieve
(String promotionCode, RequestOptions options) Retrieves the promotion code with the given ID.static PromotionCode
retrieve
(String promotionCode, PromotionCodeRetrieveParams params, RequestOptions options) Retrieves the promotion code with the given ID.static PromotionCode
Retrieves the promotion code with the given ID.void
Whether the promotion code is currently active.void
The customer-facing code.void
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.void
setCreated
(Long created) Time at which the object was created.void
setCustomer
(String id) void
setCustomerObject
(Customer expandableObject) void
setExpiresAt
(Long expiresAt) Date at which the promotion code can no longer be redeemed.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 promotion code can be redeemed.void
setMetadata
(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.void
String representing the object's type.void
setResponseGetter
(StripeResponseGetter responseGetter) Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work).void
setRestrictions
(PromotionCode.Restrictions restrictions) void
setTimesRedeemed
(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, 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
-
PromotionCode
public PromotionCode()
-
-
Method Details
-
getCustomer
Get ID of expandablecustomer
object. -
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-facingcode
use 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-facingcode
use 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-facingcode
use 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-facingcode
use 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:
update
in 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:
update
in 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:
setResponseGetter
in interfaceStripeActiveObject
- Overrides:
setResponseGetter
in classApiResource
- Parameters:
responseGetter
- theStripeResponseGetter
instance 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. -
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 valuetrue
if the object exists in live mode or the valuefalse
if 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 valuetrue
if the object exists in live mode or the valuefalse
if 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:
getMetadata
in interfaceMetadataStore<PromotionCode>
-