@@ -38,7 +38,8 @@ public class Alert extends ApiResource implements HasId {
3838 /**
3939 * Defines the type of the alert.
4040 *
41- * <p>One of {@code credit_balance_threshold}, or {@code usage_threshold}.
41+ * <p>One of {@code credit_balance_threshold}, {@code spend_threshold}, or {@code
42+ * usage_threshold}.
4243 */
4344 @ SerializedName ("alert_type" )
4445 String alertType ;
@@ -67,6 +68,10 @@ public class Alert extends ApiResource implements HasId {
6768 @ SerializedName ("object" )
6869 String object ;
6970
71+ /** Encapsulates the alert's configuration to monitor spend on pricing plan subscriptions. */
72+ @ SerializedName ("spend_threshold" )
73+ SpendThreshold spendThreshold ;
74+
7075 /**
7176 * Status of the alert. This can be active, inactive or archived.
7277 *
@@ -483,6 +488,164 @@ public static class Monetary extends StripeObject {
483488 }
484489 }
485490
491+ /**
492+ * The spend threshold alert configuration enables setting up alerts for when a customer's spend
493+ * exceeds a threshold within a billing period.
494+ */
495+ @ Getter
496+ @ Setter
497+ @ EqualsAndHashCode (callSuper = false )
498+ public static class SpendThreshold extends StripeObject {
499+ /**
500+ * Defines the period over which spend is aggregated.
501+ *
502+ * <p>Equal to {@code billing}.
503+ */
504+ @ SerializedName ("aggregation_period" )
505+ String aggregationPeriod ;
506+
507+ /** Filters to scope the spend calculation. */
508+ @ SerializedName ("filters" )
509+ Filters filters ;
510+
511+ /**
512+ * Defines the granularity of spend aggregation.
513+ *
514+ * <p>Equal to {@code pricing_plan_subscription}.
515+ */
516+ @ SerializedName ("group_by" )
517+ String groupBy ;
518+
519+ /** The threshold value configuration for a spend threshold alert. */
520+ @ SerializedName ("gte" )
521+ Gte gte ;
522+
523+ /** Filters to scope the spend calculation for a spend threshold alert. */
524+ @ Getter
525+ @ Setter
526+ @ EqualsAndHashCode (callSuper = false )
527+ public static class Filters extends StripeObject {
528+ /** Filter by billable item IDs. */
529+ @ SerializedName ("billable_items" )
530+ List <String > billableItems ;
531+
532+ /** Filter by billing cadence ID. */
533+ @ SerializedName ("billing_cadence" )
534+ String billingCadence ;
535+
536+ /** Filter by pricing plan ID. */
537+ @ SerializedName ("pricing_plan" )
538+ String pricingPlan ;
539+
540+ /** Filter by pricing plan subscription ID. */
541+ @ SerializedName ("pricing_plan_subscription" )
542+ String pricingPlanSubscription ;
543+ }
544+
545+ /** The threshold value configuration for a spend threshold alert. */
546+ @ Getter
547+ @ Setter
548+ @ EqualsAndHashCode (callSuper = false )
549+ public static class Gte extends StripeObject {
550+ /** The monetary amount. Present when type is {@code amount}. */
551+ @ SerializedName ("amount" )
552+ Amount amount ;
553+
554+ /** The custom pricing unit amount. Present when type is {@code custom_pricing_unit}. */
555+ @ SerializedName ("custom_pricing_unit" )
556+ CustomPricingUnit customPricingUnit ;
557+
558+ /**
559+ * The type of the threshold amount.
560+ *
561+ * <p>One of {@code amount}, or {@code custom_pricing_unit}.
562+ */
563+ @ SerializedName ("type" )
564+ String type ;
565+
566+ /**
567+ * For more details about Amount, please refer to the <a
568+ * href="https://docs.stripe.com/api">API Reference.</a>
569+ */
570+ @ Getter
571+ @ Setter
572+ @ EqualsAndHashCode (callSuper = false )
573+ public static class Amount extends StripeObject {
574+ /**
575+ * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
576+ * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
577+ * currency</a>.
578+ */
579+ @ SerializedName ("currency" )
580+ String currency ;
581+
582+ /** A positive integer representing the amount. */
583+ @ SerializedName ("value" )
584+ Long value ;
585+ }
586+
587+ /**
588+ * For more details about CustomPricingUnit, please refer to the <a
589+ * href="https://docs.stripe.com/api">API Reference.</a>
590+ */
591+ @ Getter
592+ @ Setter
593+ @ EqualsAndHashCode (callSuper = false )
594+ public static class CustomPricingUnit extends StripeObject implements HasId {
595+ /** The custom pricing unit object. */
596+ @ SerializedName ("custom_pricing_unit_details" )
597+ CustomPricingUnitDetails customPricingUnitDetails ;
598+
599+ /** Unique identifier for the object. */
600+ @ Getter (onMethod_ = {@ Override })
601+ @ SerializedName ("id" )
602+ String id ;
603+
604+ /** A positive decimal string representing the amount. */
605+ @ SerializedName ("value" )
606+ BigDecimal value ;
607+
608+ /**
609+ * For more details about CustomPricingUnitDetails, please refer to the <a
610+ * href="https://docs.stripe.com/api">API Reference.</a>
611+ */
612+ @ Getter
613+ @ Setter
614+ @ EqualsAndHashCode (callSuper = false )
615+ public static class CustomPricingUnitDetails extends StripeObject implements HasId {
616+ /** Time at which the object was created. Measured in seconds since the Unix epoch. */
617+ @ SerializedName ("created" )
618+ Long created ;
619+
620+ /** The name of the custom pricing unit. */
621+ @ SerializedName ("display_name" )
622+ String displayName ;
623+
624+ /** Unique identifier for the object. */
625+ @ Getter (onMethod_ = {@ Override })
626+ @ SerializedName ("id" )
627+ String id ;
628+
629+ /** A lookup key for the custom pricing unit. */
630+ @ SerializedName ("lookup_key" )
631+ String lookupKey ;
632+
633+ /**
634+ * Set of <a href="https://docs.stripe.com/api/metadata">key-value pairs</a> that you can
635+ * attach to an object. This can be useful for storing additional information about the
636+ * object in a structured format.
637+ */
638+ @ SerializedName ("metadata" )
639+ Map <String , String > metadata ;
640+
641+ /** The status of the custom pricing unit. */
642+ @ SerializedName ("status" )
643+ String status ;
644+ }
645+ }
646+ }
647+ }
648+
486649 /**
487650 * The usage threshold alert configuration enables setting up alerts for when a certain usage
488651 * threshold on a specific meter is crossed.
@@ -578,6 +741,7 @@ public void setCustomerObject(Customer expandableObject) {
578741 public void setResponseGetter (StripeResponseGetter responseGetter ) {
579742 super .setResponseGetter (responseGetter );
580743 trySetResponseGetter (creditBalanceThreshold , responseGetter );
744+ trySetResponseGetter (spendThreshold , responseGetter );
581745 trySetResponseGetter (usageThreshold , responseGetter );
582746 }
583747}
0 commit comments