Class CouponCreateParams.Builder

  • Enclosing class:
    CouponCreateParams

    public static class CouponCreateParams.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder()
    • 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 if percent_off is not passed).
      • setDurationInMonths

        public CouponCreateParams.Builder setDurationInMonths​(java.lang.Long durationInMonths)
        Required only if duration is repeating, 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. See CouponCreateParams.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. See CouponCreateParams.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. See CouponCreateParams.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. See CouponCreateParams.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. See CouponCreateParams.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. See CouponCreateParams.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 to metadata.
      • 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 to metadata.
      • setName

        public CouponCreateParams.Builder setName​(java.lang.String name)
        Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the id is shown if name 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 if amount_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.