Package com.stripe.param
Class CouponCreateParams.Builder
- java.lang.Object
-
- com.stripe.param.CouponCreateParams.Builder
-
- Enclosing class:
- CouponCreateParams
public static class CouponCreateParams.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CouponCreateParams.Builder
addAllExpand(java.util.List<java.lang.String> elements)
Add all elements to `expand` list.CouponCreateParams.Builder
addExpand(java.lang.String element)
Add an element to `expand` list.CouponCreateParams
build()
Finalize and obtain parameter instance from this builder.CouponCreateParams.Builder
putAllExtraParam(java.util.Map<java.lang.String,java.lang.Object> map)
Add all map key/value pairs to `extraParams` map.CouponCreateParams.Builder
putAllMetadata(java.util.Map<java.lang.String,java.lang.String> map)
Add all map key/value pairs to `metadata` map.CouponCreateParams.Builder
putExtraParam(java.lang.String key, java.lang.Object value)
Add a key/value pair to `extraParams` map.CouponCreateParams.Builder
putMetadata(java.lang.String key, java.lang.String value)
Add a key/value pair to `metadata` map.CouponCreateParams.Builder
setAmountOff(java.lang.Long amountOff)
A positive integer representing the amount to subtract from an invoice total (required ifpercent_off
is not passed).CouponCreateParams.Builder
setAppliesTo(CouponCreateParams.AppliesTo appliesTo)
A hash containing directions for what this Coupon will apply discounts to.CouponCreateParams.Builder
setCurrency(java.lang.String currency)
Three-letter ISO code for the currency of theamount_off
parameter (required ifamount_off
is passed).CouponCreateParams.Builder
setDuration(CouponCreateParams.Duration duration)
Specifies how long the discount will be in effect.CouponCreateParams.Builder
setDurationInMonths(java.lang.Long durationInMonths)
Required only ifduration
isrepeating
, in which case it must be a positive integer that specifies the number of months the discount will be in effect.CouponCreateParams.Builder
setId(java.lang.String id)
Unique string of your choice that will be used to identify this coupon when applying it to a customer.CouponCreateParams.Builder
setMaxRedemptions(java.lang.Long maxRedemptions)
A positive integer specifying the number of times the coupon can be redeemed before it's no longer valid.CouponCreateParams.Builder
setMetadata(EmptyParam metadata)
Set of key-value pairs that you can attach to an object.CouponCreateParams.Builder
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Set of key-value pairs that you can attach to an object.CouponCreateParams.Builder
setName(java.lang.String name)
Name of the coupon displayed to customers on, for instance invoices, or receipts.CouponCreateParams.Builder
setPercentOff(java.math.BigDecimal percentOff)
A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required ifamount_off
is not passed).CouponCreateParams.Builder
setRedeemBy(java.lang.Long redeemBy)
Unix timestamp specifying the last time at which the coupon can be redeemed.
-
-
-
Method Detail
-
build
public CouponCreateParams build()
Finalize and obtain parameter instance from this builder.
-
setAmountOff
public CouponCreateParams.Builder setAmountOff(java.lang.Long amountOff)
A positive integer representing the amount to subtract from an invoice total (required ifpercent_off
is not passed).
-
setAppliesTo
public CouponCreateParams.Builder setAppliesTo(CouponCreateParams.AppliesTo appliesTo)
A hash containing directions for what this Coupon will apply discounts to.
-
setCurrency
public CouponCreateParams.Builder setCurrency(java.lang.String currency)
Three-letter ISO code for the currency of theamount_off
parameter (required ifamount_off
is passed).
-
setDuration
public CouponCreateParams.Builder setDuration(CouponCreateParams.Duration duration)
Specifies how long the discount will be in effect. Can beforever
,once
, orrepeating
.
-
setDurationInMonths
public CouponCreateParams.Builder setDurationInMonths(java.lang.Long durationInMonths)
Required only ifduration
isrepeating
, in which case it must be a positive integer that specifies the number of months the discount will be in effect.
-
addExpand
public CouponCreateParams.Builder addExpand(java.lang.String element)
Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeCouponCreateParams.expand
for the field documentation.
-
addAllExpand
public CouponCreateParams.Builder addAllExpand(java.util.List<java.lang.String> elements)
Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeCouponCreateParams.expand
for the field documentation.
-
putExtraParam
public CouponCreateParams.Builder putExtraParam(java.lang.String key, java.lang.Object value)
Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. SeeCouponCreateParams.extraParams
for the field documentation.
-
putAllExtraParam
public CouponCreateParams.Builder putAllExtraParam(java.util.Map<java.lang.String,java.lang.Object> map)
Add all map key/value pairs to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. SeeCouponCreateParams.extraParams
for the field documentation.
-
setId
public CouponCreateParams.Builder setId(java.lang.String id)
Unique string of your choice that will be used to identify this coupon when applying it to a customer. If you don't want to specify a particular code, you can leave the ID blank and we'll generate a random code for you.
-
setMaxRedemptions
public CouponCreateParams.Builder setMaxRedemptions(java.lang.Long maxRedemptions)
A positive integer specifying the number of times the coupon can be redeemed before it's no longer valid. For example, you might have a 50% off coupon that the first 20 readers of your blog can use.
-
putMetadata
public CouponCreateParams.Builder putMetadata(java.lang.String key, java.lang.String value)
Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. SeeCouponCreateParams.metadata
for the field documentation.
-
putAllMetadata
public CouponCreateParams.Builder putAllMetadata(java.util.Map<java.lang.String,java.lang.String> map)
Add all map key/value pairs to `metadata` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. SeeCouponCreateParams.metadata
for the field documentation.
-
setMetadata
public CouponCreateParams.Builder setMetadata(EmptyParam 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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value tometadata
.
-
setMetadata
public CouponCreateParams.Builder 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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value tometadata
.
-
setName
public CouponCreateParams.Builder setName(java.lang.String name)
Name of the coupon displayed to customers on, for instance invoices, or receipts. By default theid
is shown ifname
is not set.
-
setPercentOff
public CouponCreateParams.Builder setPercentOff(java.math.BigDecimal percentOff)
A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required ifamount_off
is not passed).
-
setRedeemBy
public CouponCreateParams.Builder setRedeemBy(java.lang.Long redeemBy)
Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer be applied to new customers.
-
-