@openmeter/client 1.0.0-beta.236 → 1.0.0-beta.237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -19
- package/dist/funcs/customers.d.ts +29 -1
- package/dist/funcs/customers.js +96 -2
- package/dist/funcs/features.js +1 -1
- package/dist/funcs/notifications.d.ts +15 -15
- package/dist/funcs/notifications.js +73 -73
- package/dist/index.d.ts +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/customers.d.ts +22 -4
- package/dist/models/operations/features.d.ts +1 -1
- package/dist/models/operations/notifications.d.ts +33 -33
- package/dist/models/schemas.d.ts +89474 -41311
- package/dist/models/schemas.js +4425 -618
- package/dist/models/types.d.ts +2486 -373
- package/dist/sdk/customers.d.ts +15 -1
- package/dist/sdk/customers.js +17 -1
- package/dist/sdk/internal.d.ts +39 -12
- package/dist/sdk/internal.js +60 -23
- package/dist/sdk/notifications.d.ts +7 -7
- package/dist/sdk/notifications.js +13 -13
- package/package.json +2 -2
package/dist/models/types.d.ts
CHANGED
|
@@ -258,6 +258,11 @@ export interface ChargeFlatFeeDiscounts {
|
|
|
258
258
|
/** Percentage discount applied to the price (0–100). */
|
|
259
259
|
percentage?: number;
|
|
260
260
|
}
|
|
261
|
+
/** External identifiers for an invoice line item assigned by third-party systems. */
|
|
262
|
+
export interface InvoiceLineExternalReferences {
|
|
263
|
+
/** The ID assigned by the external invoicing app. */
|
|
264
|
+
invoicingId?: string;
|
|
265
|
+
}
|
|
261
266
|
/** Remove a rate card from a phase. */
|
|
262
267
|
export interface SubscriptionEditRemoveItem {
|
|
263
268
|
/** Discriminator for the remove-item operation. */
|
|
@@ -337,11 +342,6 @@ export interface WorkflowCollectionAlignmentSubscription {
|
|
|
337
342
|
/** The type of alignment. */
|
|
338
343
|
type: 'subscription';
|
|
339
344
|
}
|
|
340
|
-
/** External identifiers for an invoice line item assigned by third-party systems. */
|
|
341
|
-
export interface InvoiceLineExternalReferences {
|
|
342
|
-
/** The ID assigned by the external invoicing app. */
|
|
343
|
-
invoicingId?: string;
|
|
344
|
-
}
|
|
345
345
|
/**
|
|
346
346
|
* Invoice-level invoicing settings.
|
|
347
347
|
*
|
|
@@ -441,6 +441,255 @@ export interface NotificationEventDeliveryAttemptResponse {
|
|
|
441
441
|
/** The URL the event was delivered to. Only set for webhook channels. */
|
|
442
442
|
url?: string;
|
|
443
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* Set of key-value pairs. Metadata can be used to store additional information
|
|
446
|
+
* about a resource.
|
|
447
|
+
*/
|
|
448
|
+
export type NotificationEventV1Metadata = Record<string, string>;
|
|
449
|
+
/** Set of key-value pairs managed by the system. Cannot be modified by user. */
|
|
450
|
+
export type NotificationEventV1Annotations = Record<string, unknown>;
|
|
451
|
+
/** A period with a start and end time. */
|
|
452
|
+
export interface NotificationEventV1Period {
|
|
453
|
+
/** Period start time. */
|
|
454
|
+
from: Date;
|
|
455
|
+
/** Period end time. */
|
|
456
|
+
to: Date;
|
|
457
|
+
}
|
|
458
|
+
/** A filter for a string field. */
|
|
459
|
+
export interface NotificationEventV1FilterString {
|
|
460
|
+
/** The field must be equal to the provided value. */
|
|
461
|
+
$eq?: string | null;
|
|
462
|
+
/** The field must not be equal to the provided value. */
|
|
463
|
+
$ne?: string | null;
|
|
464
|
+
/** The field must be in the provided list of values. */
|
|
465
|
+
$in?: string[] | null;
|
|
466
|
+
/** The field must not be in the provided list of values. */
|
|
467
|
+
$nin?: string[] | null;
|
|
468
|
+
/** The field must match the provided value. */
|
|
469
|
+
$like?: string | null;
|
|
470
|
+
/** The field must not match the provided value. */
|
|
471
|
+
$nlike?: string | null;
|
|
472
|
+
/** The field must match the provided value, ignoring case. */
|
|
473
|
+
$ilike?: string | null;
|
|
474
|
+
/** The field must not match the provided value, ignoring case. */
|
|
475
|
+
$nilike?: string | null;
|
|
476
|
+
/** The field must be greater than the provided value. */
|
|
477
|
+
$gt?: string | null;
|
|
478
|
+
/** The field must be greater than or equal to the provided value. */
|
|
479
|
+
$gte?: string | null;
|
|
480
|
+
/** The field must be less than the provided value. */
|
|
481
|
+
$lt?: string | null;
|
|
482
|
+
/** The field must be less than or equal to the provided value. */
|
|
483
|
+
$lte?: string | null;
|
|
484
|
+
/** Provide a list of filters to be combined with a logical AND. */
|
|
485
|
+
$and?: NotificationEventV1FilterString[] | null;
|
|
486
|
+
/** Provide a list of filters to be combined with a logical OR. */
|
|
487
|
+
$or?: NotificationEventV1FilterString[] | null;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* A subject is a unique identifier for a usage attribution by its key. Subjects
|
|
491
|
+
* only exist in the concept of metering. Subjects are optional to create and work
|
|
492
|
+
* as an enrichment for the subject key like displayName, metadata, etc. Subjects
|
|
493
|
+
* are useful when you are reporting usage events with your own database ID but
|
|
494
|
+
* want to enrich the subject with a human-readable name or metadata. For most use
|
|
495
|
+
* cases, a subject is equivalent to a customer.
|
|
496
|
+
*
|
|
497
|
+
* ⚠️ **Deprecated**: Subjects as managable entities are being depracated, use
|
|
498
|
+
* customers with subject key usage attribution instead.
|
|
499
|
+
*/
|
|
500
|
+
export interface NotificationEventV1Subject {
|
|
501
|
+
/** Timestamp of when the resource was created. */
|
|
502
|
+
createdAt: Date;
|
|
503
|
+
/** Timestamp of when the resource was last updated. */
|
|
504
|
+
updatedAt: Date;
|
|
505
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
506
|
+
deletedAt?: Date;
|
|
507
|
+
/** A unique identifier for the subject. */
|
|
508
|
+
id: string;
|
|
509
|
+
/**
|
|
510
|
+
* A unique, human-readable identifier for the subject. This is typically a
|
|
511
|
+
* database ID or a customer key.
|
|
512
|
+
*/
|
|
513
|
+
key: string;
|
|
514
|
+
/** A human-readable display name for the subject. */
|
|
515
|
+
displayName?: string | null;
|
|
516
|
+
/** Metadata for the subject. */
|
|
517
|
+
metadata?: Record<string, unknown> | null;
|
|
518
|
+
/** The start of the current period for the subject. */
|
|
519
|
+
currentPeriodStart?: Date;
|
|
520
|
+
/** The end of the current period for the subject. */
|
|
521
|
+
currentPeriodEnd?: Date;
|
|
522
|
+
/** The Stripe customer ID for the subject. */
|
|
523
|
+
stripeCustomerId?: string | null;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Entitlements are the core of OpenMeter access management. They define access to
|
|
527
|
+
* features for subjects. Entitlements can be metered, boolean, or static.
|
|
528
|
+
*/
|
|
529
|
+
export interface NotificationEventV1EntitlementValue {
|
|
530
|
+
/**
|
|
531
|
+
* Whether the subject has access to the feature. Shared accross all entitlement
|
|
532
|
+
* types.
|
|
533
|
+
*/
|
|
534
|
+
hasAccess: boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Only available for metered entitlements. Metered entitlements are built around a
|
|
537
|
+
* balance calculation where feature usage is deducted from the issued grants.
|
|
538
|
+
* Balance represents the remaining balance of the entitlement, it's value never
|
|
539
|
+
* turns negative.
|
|
540
|
+
*/
|
|
541
|
+
balance?: number;
|
|
542
|
+
/**
|
|
543
|
+
* Only available for metered entitlements. Returns the total feature usage in the
|
|
544
|
+
* current period.
|
|
545
|
+
*/
|
|
546
|
+
usage?: number;
|
|
547
|
+
/**
|
|
548
|
+
* Only available for metered entitlements. Overage represents the usage that
|
|
549
|
+
* wasn't covered by grants, e.g. if the subject had a total feature usage of 100
|
|
550
|
+
* in the period but they were only granted 80, there would be 20 overage.
|
|
551
|
+
*/
|
|
552
|
+
overage?: number;
|
|
553
|
+
/**
|
|
554
|
+
* Only available for metered entitlements. The summed amount of all grant active
|
|
555
|
+
* at query time PLUS the used amount of since inactive grants.
|
|
556
|
+
*/
|
|
557
|
+
totalAvailableGrantAmount?: number;
|
|
558
|
+
/**
|
|
559
|
+
* Only available for static entitlements. The JSON parsable config of the
|
|
560
|
+
* entitlement.
|
|
561
|
+
*/
|
|
562
|
+
config?: string;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Mapping to attribute metered usage to the customer. One customer can have zero
|
|
566
|
+
* or more subjects, but one subject can only belong to one customer.
|
|
567
|
+
*/
|
|
568
|
+
export interface NotificationEventV1CustomerUsageAttribution {
|
|
569
|
+
/**
|
|
570
|
+
* The subjects that are attributed to the customer. Can be empty when no subjects
|
|
571
|
+
* are associated with the customer.
|
|
572
|
+
*/
|
|
573
|
+
subjectKeys: string[] | null;
|
|
574
|
+
}
|
|
575
|
+
/** Alignment configuration for a plan or subscription. */
|
|
576
|
+
export interface NotificationEventV1Alignment {
|
|
577
|
+
/**
|
|
578
|
+
* Whether all Billable items and RateCards must align. Alignment means the Price's
|
|
579
|
+
* BillingCadence must align for both duration and anchor time.
|
|
580
|
+
*/
|
|
581
|
+
billablesMustAlign?: boolean;
|
|
582
|
+
}
|
|
583
|
+
/** References an exact plan. */
|
|
584
|
+
export interface NotificationEventV1PlanReference {
|
|
585
|
+
/** The plan ID. */
|
|
586
|
+
id: string;
|
|
587
|
+
/** The plan key. */
|
|
588
|
+
key: string;
|
|
589
|
+
/** The plan version. */
|
|
590
|
+
version: number;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* InvoiceAvailableActionInvoiceDetails represents the details of the invoice
|
|
594
|
+
* action for non-gathering invoices.
|
|
595
|
+
*/
|
|
596
|
+
export interface NotificationEventV1InvoiceAvailableActionDetails {
|
|
597
|
+
/**
|
|
598
|
+
* The state the invoice will reach if the action is activated and all intermediate
|
|
599
|
+
* steps are successful.
|
|
600
|
+
*
|
|
601
|
+
* For example advancing a draft_created invoice will result in a
|
|
602
|
+
* draft_manual_approval_needed invoice.
|
|
603
|
+
*/
|
|
604
|
+
resultingState: string;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* InvoiceAvailableActionInvoiceDetails represents the details of the invoice
|
|
608
|
+
* action for gathering invoices.
|
|
609
|
+
*/
|
|
610
|
+
export type NotificationEventV1InvoiceAvailableActionInvoiceDetails = Record<string, never>;
|
|
611
|
+
/**
|
|
612
|
+
* BillingWorkflowCollectionAlignmentSubscription specifies the alignment for
|
|
613
|
+
* collecting the pending line items into an invoice.
|
|
614
|
+
*/
|
|
615
|
+
export interface NotificationEventV1BillingWorkflowCollectionAlignmentSubscription {
|
|
616
|
+
/** The type of alignment. */
|
|
617
|
+
type: 'subscription';
|
|
618
|
+
}
|
|
619
|
+
/** The tax config for Stripe. */
|
|
620
|
+
export interface NotificationEventV1StripeTaxConfig {
|
|
621
|
+
/**
|
|
622
|
+
* Product tax code.
|
|
623
|
+
*
|
|
624
|
+
* See: https://docs.stripe.com/tax/tax-codes
|
|
625
|
+
*/
|
|
626
|
+
code: string;
|
|
627
|
+
}
|
|
628
|
+
/** Custom invoicing tax config. */
|
|
629
|
+
export interface NotificationEventV1CustomInvoicingTaxConfig {
|
|
630
|
+
/**
|
|
631
|
+
* Tax code.
|
|
632
|
+
*
|
|
633
|
+
* The tax code should be interpreted by the custom invoicing provider.
|
|
634
|
+
*/
|
|
635
|
+
code: string;
|
|
636
|
+
}
|
|
637
|
+
/** BillingWorkflowTaxSettings represents the tax settings for a billing workflow */
|
|
638
|
+
export interface NotificationEventV1BillingWorkflowTaxSettings {
|
|
639
|
+
/**
|
|
640
|
+
* Enable automatic tax calculation when tax is supported by the app. For example,
|
|
641
|
+
* with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.
|
|
642
|
+
*/
|
|
643
|
+
enabled?: boolean;
|
|
644
|
+
/**
|
|
645
|
+
* Enforce tax calculation when tax is supported by the app. When enabled,
|
|
646
|
+
* OpenMeter will not allow to create an invoice without tax calculation.
|
|
647
|
+
* Enforcement is different per apps, for example, Stripe app requires customer to
|
|
648
|
+
* have a tax location when starting a paid subscription.
|
|
649
|
+
*/
|
|
650
|
+
enforced?: boolean;
|
|
651
|
+
}
|
|
652
|
+
/** The reason for the discount is a maximum spend. */
|
|
653
|
+
export interface NotificationEventV1DiscountReasonMaximumSpend {
|
|
654
|
+
/** type. */
|
|
655
|
+
type: 'maximum_spend';
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* InvoiceLineAppExternalIds contains the external IDs of the invoice in other apps
|
|
659
|
+
* such as Stripe.
|
|
660
|
+
*/
|
|
661
|
+
export interface NotificationEventV1InvoiceLineAppExternalIds {
|
|
662
|
+
/** The external ID of the invoice in the invoicing app if available. */
|
|
663
|
+
invoicing?: string;
|
|
664
|
+
/** The external ID of the invoice in the tax app if available. */
|
|
665
|
+
tax?: string;
|
|
666
|
+
}
|
|
667
|
+
/** IDResource is a resouce with an ID. */
|
|
668
|
+
export interface NotificationEventV1IdResource {
|
|
669
|
+
/** A unique identifier for the resource. */
|
|
670
|
+
id: string;
|
|
671
|
+
}
|
|
672
|
+
/** PaymentTermInstant defines the terms for payment on receipt of invoice. */
|
|
673
|
+
export interface NotificationEventV1PaymentTermInstant {
|
|
674
|
+
/** Type of terms to be applied. */
|
|
675
|
+
type: 'instant';
|
|
676
|
+
/** Text detail of the chosen payment terms. */
|
|
677
|
+
detail?: string;
|
|
678
|
+
/** Description of the conditions for payment. */
|
|
679
|
+
notes?: string;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* InvoiceAppExternalIds contains the external IDs of the invoice in other apps
|
|
683
|
+
* such as Stripe.
|
|
684
|
+
*/
|
|
685
|
+
export interface NotificationEventV1InvoiceAppExternalIds {
|
|
686
|
+
/** The external ID of the invoice in the invoicing app if available. */
|
|
687
|
+
invoicing?: string;
|
|
688
|
+
/** The external ID of the invoice in the tax app if available. */
|
|
689
|
+
tax?: string;
|
|
690
|
+
/** The external ID of the invoice in the payment app if available. */
|
|
691
|
+
payment?: string;
|
|
692
|
+
}
|
|
444
693
|
/**
|
|
445
694
|
* A query filter for an integer attribute. Operators are mutually exclusive, only
|
|
446
695
|
* one operator is allowed at a time.
|
|
@@ -506,6 +755,16 @@ export interface PagePaginationQuery {
|
|
|
506
755
|
* list of objects.
|
|
507
756
|
*/
|
|
508
757
|
export type PublicLabels = Record<string, string>;
|
|
758
|
+
/**
|
|
759
|
+
* Rule configuration of `v1.billing.invoice.created`. Invoice Rules have no
|
|
760
|
+
* type-specific settings.
|
|
761
|
+
*/
|
|
762
|
+
export type InvoiceCreatedV1RuleConfig = Record<string, never>;
|
|
763
|
+
/**
|
|
764
|
+
* Rule configuration of `v1.billing.invoice.updated`. Invoice Rules have no
|
|
765
|
+
* type-specific settings.
|
|
766
|
+
*/
|
|
767
|
+
export type InvoiceUpdatedV1RuleConfig = Record<string, never>;
|
|
509
768
|
/**
|
|
510
769
|
* The system account access token is meant for automations and integrations that
|
|
511
770
|
* are not directly associated with a human identity.
|
|
@@ -983,6 +1242,10 @@ export interface CreateChargeCostBasisPinned {
|
|
|
983
1242
|
export interface CreateResourceReference {
|
|
984
1243
|
id: string;
|
|
985
1244
|
}
|
|
1245
|
+
/** CurrencyCustom reference. */
|
|
1246
|
+
export interface CurrencyCustomReference {
|
|
1247
|
+
id: string;
|
|
1248
|
+
}
|
|
986
1249
|
/** Cost basis pinned to a specific cost basis resource of the custom currency. */
|
|
987
1250
|
export interface ChargeCostBasisPinned {
|
|
988
1251
|
/** Discriminator selecting the cost basis mode. */
|
|
@@ -1005,10 +1268,6 @@ export interface CreditGrantInvoiceReference {
|
|
|
1005
1268
|
id: string;
|
|
1006
1269
|
};
|
|
1007
1270
|
}
|
|
1008
|
-
/** CurrencyCustom reference. */
|
|
1009
|
-
export interface CurrencyCustomReference {
|
|
1010
|
-
id: string;
|
|
1011
|
-
}
|
|
1012
1271
|
/** A cost basis pinned to a custom-currency pair for the subscription. */
|
|
1013
1272
|
export interface SubscriptionCostBasisPin {
|
|
1014
1273
|
/** The managed custom currency ID. */
|
|
@@ -1049,15 +1308,15 @@ export interface AppReference {
|
|
|
1049
1308
|
export interface ChargeRealizationInvoiceReference {
|
|
1050
1309
|
id: string;
|
|
1051
1310
|
}
|
|
1052
|
-
/** Addon reference. */
|
|
1053
|
-
export interface AddonReference {
|
|
1054
|
-
id: string;
|
|
1055
|
-
}
|
|
1056
1311
|
/** Reference to a charge associated with an invoice line. */
|
|
1057
1312
|
export interface ChargeReference {
|
|
1058
1313
|
/** Unique identifier for the charge. */
|
|
1059
1314
|
id: string;
|
|
1060
1315
|
}
|
|
1316
|
+
/** Addon reference. */
|
|
1317
|
+
export interface AddonReference {
|
|
1318
|
+
id: string;
|
|
1319
|
+
}
|
|
1061
1320
|
/** TaxCode reference. */
|
|
1062
1321
|
export interface UpdateResourceReference {
|
|
1063
1322
|
id: string;
|
|
@@ -1066,29 +1325,6 @@ export interface UpdateResourceReference {
|
|
|
1066
1325
|
export interface NotificationChannelReference {
|
|
1067
1326
|
id: string;
|
|
1068
1327
|
}
|
|
1069
|
-
/** A reference to the feature of an entitlement notification event. */
|
|
1070
|
-
export interface NotificationEventFeatureReference {
|
|
1071
|
-
/** The unique identifier of the feature. */
|
|
1072
|
-
id: string;
|
|
1073
|
-
/** The immutable key of the feature. */
|
|
1074
|
-
key: string;
|
|
1075
|
-
}
|
|
1076
|
-
/** A reference to the invoice of an invoice notification event. */
|
|
1077
|
-
export interface NotificationEventInvoiceReference {
|
|
1078
|
-
/** The unique identifier of the invoice. */
|
|
1079
|
-
id: string;
|
|
1080
|
-
/** The human-readable invoice number. */
|
|
1081
|
-
number: string;
|
|
1082
|
-
}
|
|
1083
|
-
/** Request body for resending a notification event. */
|
|
1084
|
-
export interface ResendBillingNotificationEventRequest {
|
|
1085
|
-
/**
|
|
1086
|
-
* The channels to resend the event to. When omitted or empty, the event is resent
|
|
1087
|
-
* to every enabled channel of the rule. Channels not targeted by the rule or
|
|
1088
|
-
* disabled are rejected.
|
|
1089
|
-
*/
|
|
1090
|
-
channels?: string[];
|
|
1091
|
-
}
|
|
1092
1328
|
/** Customer reference. */
|
|
1093
1329
|
export interface BillingCustomerReference {
|
|
1094
1330
|
/** The ID of the customer. */
|
|
@@ -1281,6 +1517,16 @@ export interface ChargeResolvedCostBasis {
|
|
|
1281
1517
|
/** When the rate was resolved. */
|
|
1282
1518
|
resolvedAt: Date;
|
|
1283
1519
|
}
|
|
1520
|
+
/** Options for manually collecting a customer's pending lines into invoices. */
|
|
1521
|
+
export interface InvoiceCustomerChargesInput {
|
|
1522
|
+
/** Collection cutoff. Defaults to the current time and cannot be in the future. */
|
|
1523
|
+
asOf?: Date;
|
|
1524
|
+
/**
|
|
1525
|
+
* Override the customer's progressive billing setting for this collection. When
|
|
1526
|
+
* enabled, eligible usage-based lines can be collected for a partial period.
|
|
1527
|
+
*/
|
|
1528
|
+
progressiveBillingOverride?: boolean;
|
|
1529
|
+
}
|
|
1284
1530
|
/** A subscription add-on event. */
|
|
1285
1531
|
export interface SubscriptionAddonTimelineSegment {
|
|
1286
1532
|
/** An ISO-8601 timestamp representation of the cadence start of the resource. */
|
|
@@ -2031,15 +2277,6 @@ export interface CreditGrantPlanFilter {
|
|
|
2031
2277
|
/** Omission matches all versions, including future versions. */
|
|
2032
2278
|
version?: VersionFilter;
|
|
2033
2279
|
}
|
|
2034
|
-
/** Filter options for listing credit grants. */
|
|
2035
|
-
export interface ListCreditGrantsParamsFilter {
|
|
2036
|
-
/** Filter credit grants by status. */
|
|
2037
|
-
status?: 'pending' | 'active' | 'expired' | 'voided';
|
|
2038
|
-
/** Filter credit grants by currency. */
|
|
2039
|
-
currency?: string;
|
|
2040
|
-
/** Filter credit grants by key. */
|
|
2041
|
-
key?: StringFieldFilter;
|
|
2042
|
-
}
|
|
2043
2280
|
/** A validation issue found while processing a billing resource. */
|
|
2044
2281
|
export interface ValidationIssue {
|
|
2045
2282
|
/** Machine-readable error code. */
|
|
@@ -2175,6 +2412,43 @@ export interface ChargeRealizationPayment {
|
|
|
2175
2412
|
/** The settlement status of the payment. */
|
|
2176
2413
|
status: 'authorized' | 'settled';
|
|
2177
2414
|
}
|
|
2415
|
+
/** A monetary amount discount applied to an invoice line item. */
|
|
2416
|
+
export interface InvoiceLineAmountDiscount {
|
|
2417
|
+
/** Unique identifier for the discount. */
|
|
2418
|
+
id: string;
|
|
2419
|
+
/** The reason this discount was applied. */
|
|
2420
|
+
reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
|
|
2421
|
+
/** Optional human-readable description of the discount. */
|
|
2422
|
+
description?: string;
|
|
2423
|
+
/** External identifiers for this discount. */
|
|
2424
|
+
externalReferences?: InvoiceLineExternalReferences;
|
|
2425
|
+
/** The monetary amount deducted. */
|
|
2426
|
+
amount: string;
|
|
2427
|
+
}
|
|
2428
|
+
/** A usage quantity discount applied to an invoice line item. */
|
|
2429
|
+
export interface InvoiceLineUsageDiscount {
|
|
2430
|
+
/** Unique identifier for the discount. */
|
|
2431
|
+
id: string;
|
|
2432
|
+
/** The reason this discount was applied. */
|
|
2433
|
+
reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
|
|
2434
|
+
/** Optional human-readable description of the discount. */
|
|
2435
|
+
description?: string;
|
|
2436
|
+
/** External identifiers for this discount. */
|
|
2437
|
+
externalReferences?: InvoiceLineExternalReferences;
|
|
2438
|
+
/** The usage quantity deducted (in billing units). */
|
|
2439
|
+
quantity: string;
|
|
2440
|
+
}
|
|
2441
|
+
/** Base fields shared by all invoice line item discounts. */
|
|
2442
|
+
export interface InvoiceLineBaseDiscount {
|
|
2443
|
+
/** Unique identifier for the discount. */
|
|
2444
|
+
id: string;
|
|
2445
|
+
/** The reason this discount was applied. */
|
|
2446
|
+
reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
|
|
2447
|
+
/** Optional human-readable description of the discount. */
|
|
2448
|
+
description?: string;
|
|
2449
|
+
/** External identifiers for this discount. */
|
|
2450
|
+
externalReferences?: InvoiceLineExternalReferences;
|
|
2451
|
+
}
|
|
2178
2452
|
/** Remove a phase from the subscription. */
|
|
2179
2453
|
export interface SubscriptionEditRemovePhase {
|
|
2180
2454
|
/** Discriminator for the remove-phase operation. */
|
|
@@ -2299,43 +2573,11 @@ export interface WorkflowInvoicingSettings {
|
|
|
2299
2573
|
progressiveBilling: boolean;
|
|
2300
2574
|
/** Controls how subscription-ending shortened service periods are billed. */
|
|
2301
2575
|
subscriptionEndProrationMode: 'bill_full_period' | 'bill_actual_period';
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
/** The reason this discount was applied. */
|
|
2308
|
-
reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
|
|
2309
|
-
/** Optional human-readable description of the discount. */
|
|
2310
|
-
description?: string;
|
|
2311
|
-
/** External identifiers for this discount. */
|
|
2312
|
-
externalReferences?: InvoiceLineExternalReferences;
|
|
2313
|
-
/** The monetary amount deducted. */
|
|
2314
|
-
amount: string;
|
|
2315
|
-
}
|
|
2316
|
-
/** A usage quantity discount applied to an invoice line item. */
|
|
2317
|
-
export interface InvoiceLineUsageDiscount {
|
|
2318
|
-
/** Unique identifier for the discount. */
|
|
2319
|
-
id: string;
|
|
2320
|
-
/** The reason this discount was applied. */
|
|
2321
|
-
reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
|
|
2322
|
-
/** Optional human-readable description of the discount. */
|
|
2323
|
-
description?: string;
|
|
2324
|
-
/** External identifiers for this discount. */
|
|
2325
|
-
externalReferences?: InvoiceLineExternalReferences;
|
|
2326
|
-
/** The usage quantity deducted (in billing units). */
|
|
2327
|
-
quantity: string;
|
|
2328
|
-
}
|
|
2329
|
-
/** Base fields shared by all invoice line item discounts. */
|
|
2330
|
-
export interface InvoiceLineBaseDiscount {
|
|
2331
|
-
/** Unique identifier for the discount. */
|
|
2332
|
-
id: string;
|
|
2333
|
-
/** The reason this discount was applied. */
|
|
2334
|
-
reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
|
|
2335
|
-
/** Optional human-readable description of the discount. */
|
|
2336
|
-
description?: string;
|
|
2337
|
-
/** External identifiers for this discount. */
|
|
2338
|
-
externalReferences?: InvoiceLineExternalReferences;
|
|
2576
|
+
/**
|
|
2577
|
+
* Controls whether empty invoices are created in the invoicing app. An invoice is
|
|
2578
|
+
* empty when it has no line items or its total is zero.
|
|
2579
|
+
*/
|
|
2580
|
+
emptyInvoiceMode: 'create' | 'omit';
|
|
2339
2581
|
}
|
|
2340
2582
|
/** Filter options for listing currencies. */
|
|
2341
2583
|
export interface ListCurrenciesParamsFilter {
|
|
@@ -2516,10 +2758,420 @@ export interface NotificationEventDeliveryAttempt {
|
|
|
2516
2758
|
/** When the attempt was made. */
|
|
2517
2759
|
timestamp: Date;
|
|
2518
2760
|
}
|
|
2519
|
-
/**
|
|
2520
|
-
export interface
|
|
2761
|
+
/** A fixed per-unit cost amount. */
|
|
2762
|
+
export interface NotificationEventV1FeatureManualUnitCost {
|
|
2763
|
+
/** type. */
|
|
2764
|
+
type: 'manual';
|
|
2765
|
+
/** Fixed per-unit cost amount in USD. */
|
|
2766
|
+
amount: string;
|
|
2767
|
+
}
|
|
2768
|
+
/** Resolved per-token pricing from the LLM cost database. */
|
|
2769
|
+
export interface NotificationEventV1FeatureLlmUnitCostPricing {
|
|
2770
|
+
/** Cost per input token in USD. */
|
|
2771
|
+
inputPerToken: string;
|
|
2772
|
+
/** Cost per output token in USD. */
|
|
2773
|
+
outputPerToken: string;
|
|
2774
|
+
/** Cost per cache read token in USD. */
|
|
2775
|
+
cacheReadPerToken?: string;
|
|
2776
|
+
/** Cost per reasoning token in USD. */
|
|
2777
|
+
reasoningPerToken?: string;
|
|
2778
|
+
/** Cost per cache write token in USD. */
|
|
2779
|
+
cacheWritePerToken?: string;
|
|
2780
|
+
}
|
|
2781
|
+
/** Totals contains the summaries of all calculations for the invoice. */
|
|
2782
|
+
export interface NotificationEventV1InvoiceTotals {
|
|
2783
|
+
/** The total value of the line before taxes, discounts and commitments. */
|
|
2784
|
+
amount: string;
|
|
2785
|
+
/** The amount of value of the line that are due to additional charges. */
|
|
2786
|
+
chargesTotal: string;
|
|
2787
|
+
/** The amount of value of the line that are due to discounts. */
|
|
2788
|
+
discountsTotal: string;
|
|
2789
|
+
/** The amount of value of the line that are due to credits. */
|
|
2790
|
+
creditsTotal: string;
|
|
2791
|
+
/** The total amount of taxes that are included in the line. */
|
|
2792
|
+
taxesInclusiveTotal: string;
|
|
2793
|
+
/** The total amount of taxes that are added on top of amount from the line. */
|
|
2794
|
+
taxesExclusiveTotal: string;
|
|
2795
|
+
/** The total amount of taxes for this line. */
|
|
2796
|
+
taxesTotal: string;
|
|
2797
|
+
/** The total amount value of the line after taxes, discounts and commitments. */
|
|
2798
|
+
total: string;
|
|
2799
|
+
}
|
|
2800
|
+
/** The reason for the discount is a ratecard usage. */
|
|
2801
|
+
export interface NotificationEventV1DiscountReasonRatecardUsage {
|
|
2802
|
+
/** type. */
|
|
2803
|
+
type: 'ratecard_usage';
|
|
2521
2804
|
/**
|
|
2522
|
-
*
|
|
2805
|
+
* The quantity of the usage discount.
|
|
2806
|
+
*
|
|
2807
|
+
* Must be positive.
|
|
2808
|
+
*/
|
|
2809
|
+
quantity: string;
|
|
2810
|
+
/**
|
|
2811
|
+
* Correlation ID for the discount.
|
|
2812
|
+
*
|
|
2813
|
+
* This is used to link discounts across different invoices (progressive billing
|
|
2814
|
+
* use case).
|
|
2815
|
+
*
|
|
2816
|
+
* If not provided, the invoicing engine will auto-generate one. When editing an
|
|
2817
|
+
* invoice line, please make sure to keep the same correlation ID of the discount
|
|
2818
|
+
* or in progressive billing setups the discount amounts might be incorrect.
|
|
2819
|
+
*/
|
|
2820
|
+
correlationId?: string;
|
|
2821
|
+
}
|
|
2822
|
+
/**
|
|
2823
|
+
* InvoiceLineCreditAllocation represents a credit amount allocated to the line
|
|
2824
|
+
* before taxes are applied.
|
|
2825
|
+
*/
|
|
2826
|
+
export interface NotificationEventV1InvoiceLineCreditAllocation {
|
|
2827
|
+
/** Amount allocated from credits. */
|
|
2828
|
+
amount: string;
|
|
2829
|
+
/** Text description as to why the credit was allocated. */
|
|
2830
|
+
description?: string;
|
|
2831
|
+
}
|
|
2832
|
+
/** Unit price with spend commitments. */
|
|
2833
|
+
export interface NotificationEventV1UnitPriceWithCommitments {
|
|
2834
|
+
/** The type of the price. */
|
|
2835
|
+
type: 'unit';
|
|
2836
|
+
/** The amount of the unit price. */
|
|
2837
|
+
amount: string;
|
|
2838
|
+
/** The customer is committed to spend at least the amount. */
|
|
2839
|
+
minimumAmount?: string;
|
|
2840
|
+
/** The customer is limited to spend at most the amount. */
|
|
2841
|
+
maximumAmount?: string;
|
|
2842
|
+
}
|
|
2843
|
+
/** Flat price. */
|
|
2844
|
+
export interface NotificationEventV1FlatPrice {
|
|
2845
|
+
/** The type of the price. */
|
|
2846
|
+
type: 'flat';
|
|
2847
|
+
/** The amount of the flat price. */
|
|
2848
|
+
amount: string;
|
|
2849
|
+
}
|
|
2850
|
+
/** Unit price. */
|
|
2851
|
+
export interface NotificationEventV1UnitPrice {
|
|
2852
|
+
/** The type of the price. */
|
|
2853
|
+
type: 'unit';
|
|
2854
|
+
/** The amount of the unit price. */
|
|
2855
|
+
amount: string;
|
|
2856
|
+
}
|
|
2857
|
+
/** Dynamic price with spend commitments. */
|
|
2858
|
+
export interface NotificationEventV1DynamicPriceWithCommitments {
|
|
2859
|
+
/** The type of the price. */
|
|
2860
|
+
type: 'dynamic';
|
|
2861
|
+
/**
|
|
2862
|
+
* The multiplier to apply to the base price to get the dynamic price.
|
|
2863
|
+
*
|
|
2864
|
+
* Examples:
|
|
2865
|
+
*
|
|
2866
|
+
* - 0.0: the price is zero
|
|
2867
|
+
* - 0.5: the price is 50% of the base price
|
|
2868
|
+
* - 1.0: the price is the same as the base price
|
|
2869
|
+
* - 1.5: the price is 150% of the base price
|
|
2870
|
+
*/
|
|
2871
|
+
multiplier?: string;
|
|
2872
|
+
/** The customer is committed to spend at least the amount. */
|
|
2873
|
+
minimumAmount?: string;
|
|
2874
|
+
/** The customer is limited to spend at most the amount. */
|
|
2875
|
+
maximumAmount?: string;
|
|
2876
|
+
}
|
|
2877
|
+
/** Package price with spend commitments. */
|
|
2878
|
+
export interface NotificationEventV1PackagePriceWithCommitments {
|
|
2879
|
+
/** The type of the price. */
|
|
2880
|
+
type: 'package';
|
|
2881
|
+
/** The price of one package. */
|
|
2882
|
+
amount: string;
|
|
2883
|
+
/** The quantity per package. */
|
|
2884
|
+
quantityPerPackage: string;
|
|
2885
|
+
/** The customer is committed to spend at least the amount. */
|
|
2886
|
+
minimumAmount?: string;
|
|
2887
|
+
/** The customer is limited to spend at most the amount. */
|
|
2888
|
+
maximumAmount?: string;
|
|
2889
|
+
}
|
|
2890
|
+
/** A usage discount. */
|
|
2891
|
+
export interface NotificationEventV1BillingDiscountUsage {
|
|
2892
|
+
/**
|
|
2893
|
+
* The quantity of the usage discount.
|
|
2894
|
+
*
|
|
2895
|
+
* Must be positive.
|
|
2896
|
+
*/
|
|
2897
|
+
quantity: string;
|
|
2898
|
+
/**
|
|
2899
|
+
* Correlation ID for the discount.
|
|
2900
|
+
*
|
|
2901
|
+
* This is used to link discounts across different invoices (progressive billing
|
|
2902
|
+
* use case).
|
|
2903
|
+
*
|
|
2904
|
+
* If not provided, the invoicing engine will auto-generate one. When editing an
|
|
2905
|
+
* invoice line, please make sure to keep the same correlation ID of the discount
|
|
2906
|
+
* or in progressive billing setups the discount amounts might be incorrect.
|
|
2907
|
+
*/
|
|
2908
|
+
correlationId?: string;
|
|
2909
|
+
}
|
|
2910
|
+
/** A cost basis pinned to a custom-currency pair for the subscription. */
|
|
2911
|
+
export interface NotificationEventV1SubscriptionCostBasisPin {
|
|
2912
|
+
/** The managed custom currency ID. */
|
|
2913
|
+
customCurrencyId: string;
|
|
2914
|
+
/** The fiat currency in which the subscription is invoiced. */
|
|
2915
|
+
invoiceCurrency: string;
|
|
2916
|
+
/** The pinned cost basis resource ID. */
|
|
2917
|
+
costBasisId: string;
|
|
2918
|
+
}
|
|
2919
|
+
/** Address */
|
|
2920
|
+
export interface NotificationEventV1Address {
|
|
2921
|
+
/**
|
|
2922
|
+
* Country code in [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html)
|
|
2923
|
+
* alpha-2 format.
|
|
2924
|
+
*/
|
|
2925
|
+
country?: string;
|
|
2926
|
+
/** Postal code. */
|
|
2927
|
+
postalCode?: string;
|
|
2928
|
+
/** State or province. */
|
|
2929
|
+
state?: string;
|
|
2930
|
+
/** City. */
|
|
2931
|
+
city?: string;
|
|
2932
|
+
/** First line of the address. */
|
|
2933
|
+
line1?: string;
|
|
2934
|
+
/** Second line of the address. */
|
|
2935
|
+
line2?: string;
|
|
2936
|
+
/** Phone number. */
|
|
2937
|
+
phoneNumber?: string;
|
|
2938
|
+
}
|
|
2939
|
+
/** Configuration for pro-rating behavior. */
|
|
2940
|
+
export interface NotificationEventV1ProRatingConfig {
|
|
2941
|
+
/** Whether pro-rating is enabled for this plan. */
|
|
2942
|
+
enabled: boolean;
|
|
2943
|
+
/** How to handle pro-rating for billing period changes. */
|
|
2944
|
+
mode: 'prorate_prices';
|
|
2945
|
+
}
|
|
2946
|
+
/** Threshold value with multiple supported types. */
|
|
2947
|
+
export interface NotificationEventV1RuleBalanceThresholdValue {
|
|
2948
|
+
/** Value of the threshold. */
|
|
2949
|
+
value: number;
|
|
2950
|
+
/** Type of the threshold. */
|
|
2951
|
+
type: 'PERCENT' | 'NUMBER' | 'balance_value' | 'usage_percentage' | 'usage_value';
|
|
2952
|
+
}
|
|
2953
|
+
/**
|
|
2954
|
+
* Identity stores the details required to identify an entity for tax purposes in a
|
|
2955
|
+
* specific country.
|
|
2956
|
+
*/
|
|
2957
|
+
export interface NotificationEventV1BillingPartyTaxIdentity {
|
|
2958
|
+
/** Normalized tax code shown on the original identity document. */
|
|
2959
|
+
code?: string;
|
|
2960
|
+
}
|
|
2961
|
+
/** Reference to an invoice. */
|
|
2962
|
+
export interface NotificationEventV1InvoiceReference {
|
|
2963
|
+
/** The ID of the invoice. */
|
|
2964
|
+
id: string;
|
|
2965
|
+
/** The number of the invoice. */
|
|
2966
|
+
number?: string;
|
|
2967
|
+
}
|
|
2968
|
+
/**
|
|
2969
|
+
* InvoiceDocumentRef is used to describe a reference to an existing document
|
|
2970
|
+
* (invoice).
|
|
2971
|
+
*
|
|
2972
|
+
* The v1 schema describes credit note references with issued_at, number and url,
|
|
2973
|
+
* but the v1 API only ever sends the generic fields below.
|
|
2974
|
+
*/
|
|
2975
|
+
export interface NotificationEventV1InvoiceDocumentRef {
|
|
2976
|
+
/** Type of the document referenced. */
|
|
2977
|
+
type: 'credit_note_original_invoice';
|
|
2978
|
+
/** Human readable description on why this reference is here or needs to be used. */
|
|
2979
|
+
reason?: string;
|
|
2980
|
+
/** Additional details about the document. */
|
|
2981
|
+
description?: string;
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* Omitted fields: period: Tax period in which the referred document had an effect
|
|
2985
|
+
* required by some tax regimes and formats. stamps: Seals of approval from other
|
|
2986
|
+
* organisations that may need to be listed. ext: Extensions for additional codes
|
|
2987
|
+
* that may be required.
|
|
2988
|
+
*/
|
|
2989
|
+
export interface NotificationEventV1InvoiceGenericDocumentRef {
|
|
2990
|
+
/** Type of the document referenced. */
|
|
2991
|
+
type: 'credit_note_original_invoice';
|
|
2992
|
+
/** Human readable description on why this reference is here or needs to be used. */
|
|
2993
|
+
reason?: string;
|
|
2994
|
+
/** Additional details about the document. */
|
|
2995
|
+
description?: string;
|
|
2996
|
+
}
|
|
2997
|
+
/**
|
|
2998
|
+
* InvoiceAvailableActions represents the actions that can be performed on the
|
|
2999
|
+
* invoice.
|
|
3000
|
+
*/
|
|
3001
|
+
export interface NotificationEventV1InvoiceAvailableActions {
|
|
3002
|
+
/** Advance the invoice to the next status. */
|
|
3003
|
+
advance?: NotificationEventV1InvoiceAvailableActionDetails;
|
|
3004
|
+
/** Approve an invoice that requires manual approval. */
|
|
3005
|
+
approve?: NotificationEventV1InvoiceAvailableActionDetails;
|
|
3006
|
+
/** Delete the invoice (only non-issued invoices can be deleted). */
|
|
3007
|
+
delete?: NotificationEventV1InvoiceAvailableActionDetails;
|
|
3008
|
+
/** Retry an invoice issuing step that failed. */
|
|
3009
|
+
retry?: NotificationEventV1InvoiceAvailableActionDetails;
|
|
3010
|
+
/** Snapshot quantities for usage based line items. */
|
|
3011
|
+
snapshotQuantities?: NotificationEventV1InvoiceAvailableActionDetails;
|
|
3012
|
+
/** Void an already issued invoice. */
|
|
3013
|
+
void?: NotificationEventV1InvoiceAvailableActionDetails;
|
|
3014
|
+
/** Invoice a gathering invoice */
|
|
3015
|
+
invoice?: NotificationEventV1InvoiceAvailableActionInvoiceDetails;
|
|
3016
|
+
}
|
|
3017
|
+
/**
|
|
3018
|
+
* App capability.
|
|
3019
|
+
*
|
|
3020
|
+
* Capabilities only exist in config so they don't extend the Resource model.
|
|
3021
|
+
*/
|
|
3022
|
+
export interface NotificationEventV1AppCapability {
|
|
3023
|
+
/** The capability type. */
|
|
3024
|
+
type: 'reportUsage' | 'reportEvents' | 'calculateTax' | 'invoiceCustomers' | 'collectPayments';
|
|
3025
|
+
/** Key */
|
|
3026
|
+
key: string;
|
|
3027
|
+
/** The capability name. */
|
|
3028
|
+
name: string;
|
|
3029
|
+
/** The capability description. */
|
|
3030
|
+
description: string;
|
|
3031
|
+
}
|
|
3032
|
+
/** Set of provider specific tax configs. */
|
|
3033
|
+
export interface NotificationEventV1TaxConfig {
|
|
3034
|
+
/**
|
|
3035
|
+
* Tax behavior.
|
|
3036
|
+
*
|
|
3037
|
+
* If not specified the billing profile is used to determine the tax behavior. If
|
|
3038
|
+
* not specified in the billing profile, the provider's default behavior is used.
|
|
3039
|
+
*/
|
|
3040
|
+
behavior?: 'inclusive' | 'exclusive';
|
|
3041
|
+
/** Stripe tax config. */
|
|
3042
|
+
stripe?: NotificationEventV1StripeTaxConfig;
|
|
3043
|
+
/** Custom invoicing tax config. */
|
|
3044
|
+
customInvoicing?: NotificationEventV1CustomInvoicingTaxConfig;
|
|
3045
|
+
/**
|
|
3046
|
+
* Tax code reference.
|
|
3047
|
+
*
|
|
3048
|
+
* When both `taxCodeId` and `stripe.code` are provided, `taxCodeId` takes
|
|
3049
|
+
* precedence: the referenced tax code entity is used and `stripe.code` is ignored.
|
|
3050
|
+
*/
|
|
3051
|
+
taxCodeId?: string;
|
|
3052
|
+
}
|
|
3053
|
+
/**
|
|
3054
|
+
* BillingWorkflowPaymentSettings represents the payment settings for a billing
|
|
3055
|
+
* workflow
|
|
3056
|
+
*/
|
|
3057
|
+
export interface NotificationEventV1BillingWorkflowPaymentSettings {
|
|
3058
|
+
/** The payment method for the invoice. */
|
|
3059
|
+
collectionMethod?: 'charge_automatically' | 'send_invoice';
|
|
3060
|
+
}
|
|
3061
|
+
/** The reason for the discount is a ratecard percentage. */
|
|
3062
|
+
export interface NotificationEventV1DiscountReasonRatecardPercentage {
|
|
3063
|
+
/** type. */
|
|
3064
|
+
type: 'ratecard_percentage';
|
|
3065
|
+
/** The percentage of the discount. */
|
|
3066
|
+
percentage: number;
|
|
3067
|
+
/**
|
|
3068
|
+
* Correlation ID for the discount.
|
|
3069
|
+
*
|
|
3070
|
+
* This is used to link discounts across different invoices (progressive billing
|
|
3071
|
+
* use case).
|
|
3072
|
+
*
|
|
3073
|
+
* If not provided, the invoicing engine will auto-generate one. When editing an
|
|
3074
|
+
* invoice line, please make sure to keep the same correlation ID of the discount
|
|
3075
|
+
* or in progressive billing setups the discount amounts might be incorrect.
|
|
3076
|
+
*/
|
|
3077
|
+
correlationId?: string;
|
|
3078
|
+
}
|
|
3079
|
+
/** A percentage discount. */
|
|
3080
|
+
export interface NotificationEventV1BillingDiscountPercentage {
|
|
3081
|
+
/** The percentage of the discount. */
|
|
3082
|
+
percentage: number;
|
|
3083
|
+
/**
|
|
3084
|
+
* Correlation ID for the discount.
|
|
3085
|
+
*
|
|
3086
|
+
* This is used to link discounts across different invoices (progressive billing
|
|
3087
|
+
* use case).
|
|
3088
|
+
*
|
|
3089
|
+
* If not provided, the invoicing engine will auto-generate one. When editing an
|
|
3090
|
+
* invoice line, please make sure to keep the same correlation ID of the discount
|
|
3091
|
+
* or in progressive billing setups the discount amounts might be incorrect.
|
|
3092
|
+
*/
|
|
3093
|
+
correlationId?: string;
|
|
3094
|
+
}
|
|
3095
|
+
/** PaymentDueDate contains an amount that should be paid by the given date. */
|
|
3096
|
+
export interface NotificationEventV1PaymentDueDate {
|
|
3097
|
+
/** When the payment is due. */
|
|
3098
|
+
dueAt: Date;
|
|
3099
|
+
/** Other details to take into account for the due date. */
|
|
3100
|
+
notes?: string;
|
|
3101
|
+
/** How much needs to be paid by the date. */
|
|
3102
|
+
amount: string;
|
|
3103
|
+
/** Percentage of the total that should be paid by the date. */
|
|
3104
|
+
percent?: number;
|
|
3105
|
+
/** If different from the parent document's base currency. */
|
|
3106
|
+
currency?: string;
|
|
3107
|
+
}
|
|
3108
|
+
/**
|
|
3109
|
+
* InvoiceLineSubscriptionReference contains the references to the subscription
|
|
3110
|
+
* that this line is related to.
|
|
3111
|
+
*/
|
|
3112
|
+
export interface NotificationEventV1InvoiceLineSubscriptionReference {
|
|
3113
|
+
/** The subscription. */
|
|
3114
|
+
subscription: NotificationEventV1IdResource;
|
|
3115
|
+
/** The phase of the subscription. */
|
|
3116
|
+
phase: NotificationEventV1IdResource;
|
|
3117
|
+
/** The item this line is related to. */
|
|
3118
|
+
item: NotificationEventV1IdResource;
|
|
3119
|
+
/**
|
|
3120
|
+
* The billing period of the subscription. In case the subscription item's billing
|
|
3121
|
+
* period is different from the subscription's billing period, this field will
|
|
3122
|
+
* contain the billing period of the subscription itself.
|
|
3123
|
+
*
|
|
3124
|
+
* For example, in case of:
|
|
3125
|
+
*
|
|
3126
|
+
* - A monthly billed subscription anchored to 2025-01-01
|
|
3127
|
+
* - A subscription item billed daily
|
|
3128
|
+
*
|
|
3129
|
+
* An example line would have the period of 2025-01-02 to 2025-01-03 as the item is
|
|
3130
|
+
* billed daily, but the subscription's billing period will be 2025-01-01 to
|
|
3131
|
+
* 2025-01-31.
|
|
3132
|
+
*/
|
|
3133
|
+
billingPeriod: NotificationEventV1Period;
|
|
3134
|
+
}
|
|
3135
|
+
/** Flat price with payment term. */
|
|
3136
|
+
export interface NotificationEventV1FlatPriceWithPaymentTerm {
|
|
3137
|
+
/** The type of the price. */
|
|
3138
|
+
type: 'flat';
|
|
3139
|
+
/** The amount of the flat price. */
|
|
3140
|
+
amount: string;
|
|
3141
|
+
/** The payment term of the flat price. Defaults to in advance. */
|
|
3142
|
+
paymentTerm?: 'in_advance' | 'in_arrears';
|
|
3143
|
+
}
|
|
3144
|
+
/**
|
|
3145
|
+
* ValidationIssue captures any validation issues related to the invoice.
|
|
3146
|
+
*
|
|
3147
|
+
* Issues with severity "critical" will prevent the invoice from being issued.
|
|
3148
|
+
*/
|
|
3149
|
+
export interface NotificationEventV1ValidationIssue {
|
|
3150
|
+
/** Timestamp of when the resource was created. */
|
|
3151
|
+
createdAt: Date;
|
|
3152
|
+
/** Timestamp of when the resource was last updated. */
|
|
3153
|
+
updatedAt: Date;
|
|
3154
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
3155
|
+
deletedAt?: Date;
|
|
3156
|
+
/** ID of the charge or discount. */
|
|
3157
|
+
id: string;
|
|
3158
|
+
/** The severity of the issue. */
|
|
3159
|
+
severity: 'critical' | 'warning';
|
|
3160
|
+
/** The field that the issue is related to, if available in JSON path format. */
|
|
3161
|
+
field?: string;
|
|
3162
|
+
/** Machine indentifiable code for the issue, if available. */
|
|
3163
|
+
code?: string;
|
|
3164
|
+
/** Component reporting the issue. */
|
|
3165
|
+
component: string;
|
|
3166
|
+
/** A human-readable description of the issue. */
|
|
3167
|
+
message: string;
|
|
3168
|
+
/** Additional context for the issue. */
|
|
3169
|
+
metadata?: NotificationEventV1Metadata;
|
|
3170
|
+
}
|
|
3171
|
+
/** App customer data. */
|
|
3172
|
+
export interface AppCustomerData {
|
|
3173
|
+
/**
|
|
3174
|
+
* Used if the customer has a linked Stripe app.
|
|
2523
3175
|
*
|
|
2524
3176
|
* Set to `null` to remove the Stripe data of the customer; omit to leave it
|
|
2525
3177
|
* unchanged.
|
|
@@ -2573,6 +3225,22 @@ export interface CreditAdjustment {
|
|
|
2573
3225
|
description?: string;
|
|
2574
3226
|
labels?: Labels;
|
|
2575
3227
|
}
|
|
3228
|
+
/** Filter options for listing credit grants. */
|
|
3229
|
+
export interface ListCreditGrantsParamsFilter {
|
|
3230
|
+
/** Filter credit grants by status. */
|
|
3231
|
+
status?: 'pending' | 'active' | 'expired' | 'voided';
|
|
3232
|
+
/** Filter credit grants by fiat or custom currency code. */
|
|
3233
|
+
currency?: BillingCurrencyCode;
|
|
3234
|
+
/** Filter credit grants by key. */
|
|
3235
|
+
key?: StringFieldFilter;
|
|
3236
|
+
/**
|
|
3237
|
+
* Select grants spendable on any requested feature, including grants without
|
|
3238
|
+
* feature restrictions. Keys are case-sensitive. Supports `eq` (or shorthand) and
|
|
3239
|
+
* `oeq` with comma-separated keys. Omit to include all features; use
|
|
3240
|
+
* `exists=false` for grants without feature restrictions.
|
|
3241
|
+
*/
|
|
3242
|
+
featureKey?: StringFieldFilter;
|
|
3243
|
+
}
|
|
2576
3244
|
/** CreditAdjustment create request. */
|
|
2577
3245
|
export interface CreateCreditAdjustmentRequest {
|
|
2578
3246
|
/**
|
|
@@ -2596,7 +3264,7 @@ export interface CreateCreditAdjustmentRequest {
|
|
|
2596
3264
|
/** Filter options for listing credit transactions. */
|
|
2597
3265
|
export interface ListCreditTransactionsParamsFilter {
|
|
2598
3266
|
/** Filter credit transactions by type. */
|
|
2599
|
-
type?: 'funded' | 'consumed' | 'expired' | 'voided';
|
|
3267
|
+
type?: 'funded' | 'consumed' | 'correction' | 'expired' | 'voided';
|
|
2600
3268
|
/**
|
|
2601
3269
|
* Filter credit transactions by currency code. Custom-currency rows retain their
|
|
2602
3270
|
* managed currency identifier.
|
|
@@ -2894,6 +3562,47 @@ export interface ListPlanAddonsParamsFilter {
|
|
|
2894
3562
|
addonName?: StringFieldFilter;
|
|
2895
3563
|
planCurrency?: StringFieldFilter;
|
|
2896
3564
|
}
|
|
3565
|
+
/** CustomerBillingProfile upsert request. */
|
|
3566
|
+
export interface UpsertCustomerBillingProfileRequest {
|
|
3567
|
+
/**
|
|
3568
|
+
* The billing profile explicitly selected for the customer.
|
|
3569
|
+
*
|
|
3570
|
+
* Unpinned customers use the current namespace default. Selecting the current
|
|
3571
|
+
* default explicitly pins the customer to that profile.
|
|
3572
|
+
*/
|
|
3573
|
+
billingProfile?: ProfileReference | null;
|
|
3574
|
+
}
|
|
3575
|
+
/** Customer billing profile selection. */
|
|
3576
|
+
export interface CustomerProfile {
|
|
3577
|
+
/**
|
|
3578
|
+
* The billing profile explicitly selected for the customer.
|
|
3579
|
+
*
|
|
3580
|
+
* Unpinned customers use the current namespace default. Selecting the current
|
|
3581
|
+
* default explicitly pins the customer to that profile.
|
|
3582
|
+
*/
|
|
3583
|
+
billingProfile?: ProfileReference | null;
|
|
3584
|
+
/**
|
|
3585
|
+
* The effective billing profile for the customer. Uses the explicitly selected
|
|
3586
|
+
* billing profile when pinned, otherwise the current default billing profile.
|
|
3587
|
+
*/
|
|
3588
|
+
effectiveBillingProfile: ProfileReference;
|
|
3589
|
+
}
|
|
3590
|
+
/** The feature filter shared by the entitlement Rule configurations. */
|
|
3591
|
+
export interface EntitlementFeaturesRuleConfig {
|
|
3592
|
+
/**
|
|
3593
|
+
* The features the rule applies to. When omitted, the rule applies to every
|
|
3594
|
+
* feature.
|
|
3595
|
+
*/
|
|
3596
|
+
features?: FeatureReference[];
|
|
3597
|
+
}
|
|
3598
|
+
/** Rule configuration of `v1.entitlement.usage_period.reset`. */
|
|
3599
|
+
export interface EntitlementUsagePeriodResetV1RuleConfig {
|
|
3600
|
+
/**
|
|
3601
|
+
* The features the rule applies to. When omitted, the rule applies to every
|
|
3602
|
+
* feature.
|
|
3603
|
+
*/
|
|
3604
|
+
features?: FeatureReference[];
|
|
3605
|
+
}
|
|
2897
3606
|
/**
|
|
2898
3607
|
* Tax configuration for a billable resource.
|
|
2899
3608
|
*
|
|
@@ -2914,6 +3623,84 @@ export interface CreateTaxCodeConfig {
|
|
|
2914
3623
|
/** Tax code applied to the invoice line item. */
|
|
2915
3624
|
code?: CreateResourceReference;
|
|
2916
3625
|
}
|
|
3626
|
+
/** The credit balance by currency. */
|
|
3627
|
+
export interface CreditBalance {
|
|
3628
|
+
currency: BillingCurrencyCode;
|
|
3629
|
+
/** Managed currency reference. Present only for custom currencies. */
|
|
3630
|
+
customCurrency?: CurrencyCustomReference;
|
|
3631
|
+
/**
|
|
3632
|
+
* Spendable balance after applying currently live, unbooked charge impacts. Can be
|
|
3633
|
+
* negative when usage exceeds available credit.
|
|
3634
|
+
*
|
|
3635
|
+
* Always zero for historical balance queries using the `timestamp` parameter
|
|
3636
|
+
* because live charge impacts cannot be reconstructed historically.
|
|
3637
|
+
*/
|
|
3638
|
+
live: string;
|
|
3639
|
+
/**
|
|
3640
|
+
* Credits that have been booked on the ledger as of the balance timestamp,
|
|
3641
|
+
* including credit-only advance debt. Can be negative.
|
|
3642
|
+
*/
|
|
3643
|
+
booked: string;
|
|
3644
|
+
/** Deprecated alias for `booked`. Always returns the same value. */
|
|
3645
|
+
settled: string;
|
|
3646
|
+
/**
|
|
3647
|
+
* Spendable credit at the balance timestamp, including any credit-only advance
|
|
3648
|
+
* debt. Preserves credit already committed to later usage. Future grants cannot be
|
|
3649
|
+
* spent early; scheduled expiry reduces availability when it takes effect. Can be
|
|
3650
|
+
* negative when advance debt exceeds spendable credit.
|
|
3651
|
+
*/
|
|
3652
|
+
spendable: string;
|
|
3653
|
+
/**
|
|
3654
|
+
* Credits that have been granted but are not yet written to the ledger, or are
|
|
3655
|
+
* written to the ledger with a future booked time.
|
|
3656
|
+
*/
|
|
3657
|
+
pending: string;
|
|
3658
|
+
}
|
|
3659
|
+
/**
|
|
3660
|
+
* A credit transaction represents a single credit movement on the customer's
|
|
3661
|
+
* balance.
|
|
3662
|
+
*
|
|
3663
|
+
* Credit transactions are immutable.
|
|
3664
|
+
*/
|
|
3665
|
+
export interface CreditTransaction {
|
|
3666
|
+
id: string;
|
|
3667
|
+
/**
|
|
3668
|
+
* Display name of the resource.
|
|
3669
|
+
*
|
|
3670
|
+
* Between 1 and 256 characters.
|
|
3671
|
+
*/
|
|
3672
|
+
name: string;
|
|
3673
|
+
/**
|
|
3674
|
+
* Optional description of the resource.
|
|
3675
|
+
*
|
|
3676
|
+
* Maximum 1024 characters.
|
|
3677
|
+
*/
|
|
3678
|
+
description?: string;
|
|
3679
|
+
labels?: Labels;
|
|
3680
|
+
/** An ISO-8601 timestamp representation of entity creation date. */
|
|
3681
|
+
createdAt: Date;
|
|
3682
|
+
/** The date and time the transaction was booked. */
|
|
3683
|
+
bookedAt: Date;
|
|
3684
|
+
/** The type of credit transaction. */
|
|
3685
|
+
type: 'funded' | 'consumed' | 'correction' | 'expired' | 'voided';
|
|
3686
|
+
/** Currency of the balance affected by the transaction. */
|
|
3687
|
+
currency: BillingCurrencyCode;
|
|
3688
|
+
/** Managed currency reference. Present only for custom currencies. */
|
|
3689
|
+
customCurrency?: CurrencyCustomReference;
|
|
3690
|
+
/**
|
|
3691
|
+
* Signed amount of the credit movement. Positive values add balance, negative
|
|
3692
|
+
* values reduce balance.
|
|
3693
|
+
*/
|
|
3694
|
+
amount: string;
|
|
3695
|
+
/**
|
|
3696
|
+
* The booked credit balance before and after the transaction, including
|
|
3697
|
+
* credit-only advance debt.
|
|
3698
|
+
*/
|
|
3699
|
+
availableBalance: {
|
|
3700
|
+
before: string;
|
|
3701
|
+
after: string;
|
|
3702
|
+
};
|
|
3703
|
+
}
|
|
2917
3704
|
/**
|
|
2918
3705
|
* Tax configuration for a billable resource.
|
|
2919
3706
|
*
|
|
@@ -2981,68 +3768,6 @@ export interface UpdateOrganizationDefaultTaxCodesRequest {
|
|
|
2981
3768
|
/** Default tax code for credit grants. */
|
|
2982
3769
|
creditGrantTaxCode?: TaxCodeReference;
|
|
2983
3770
|
}
|
|
2984
|
-
/** The credit balance by currency. */
|
|
2985
|
-
export interface CreditBalance {
|
|
2986
|
-
currency: BillingCurrencyCode;
|
|
2987
|
-
/** Managed currency reference. Present only for custom currencies. */
|
|
2988
|
-
customCurrency?: CurrencyCustomReference;
|
|
2989
|
-
/**
|
|
2990
|
-
* Credits available after applying currently live charge impacts.
|
|
2991
|
-
*
|
|
2992
|
-
* Always zero for historical balance queries using the `timestamp` parameter
|
|
2993
|
-
* because live charge impacts cannot be reconstructed historically.
|
|
2994
|
-
*/
|
|
2995
|
-
live: string;
|
|
2996
|
-
/** Credits that have been booked on the ledger as of the balance timestamp. */
|
|
2997
|
-
settled: string;
|
|
2998
|
-
/**
|
|
2999
|
-
* Credits that have been granted but are not yet written to the ledger, or are
|
|
3000
|
-
* written to the ledger with a future booked time.
|
|
3001
|
-
*/
|
|
3002
|
-
pending: string;
|
|
3003
|
-
}
|
|
3004
|
-
/**
|
|
3005
|
-
* A credit transaction represents a single credit movement on the customer's
|
|
3006
|
-
* balance.
|
|
3007
|
-
*
|
|
3008
|
-
* Credit transactions are immutable.
|
|
3009
|
-
*/
|
|
3010
|
-
export interface CreditTransaction {
|
|
3011
|
-
id: string;
|
|
3012
|
-
/**
|
|
3013
|
-
* Display name of the resource.
|
|
3014
|
-
*
|
|
3015
|
-
* Between 1 and 256 characters.
|
|
3016
|
-
*/
|
|
3017
|
-
name: string;
|
|
3018
|
-
/**
|
|
3019
|
-
* Optional description of the resource.
|
|
3020
|
-
*
|
|
3021
|
-
* Maximum 1024 characters.
|
|
3022
|
-
*/
|
|
3023
|
-
description?: string;
|
|
3024
|
-
labels?: Labels;
|
|
3025
|
-
/** An ISO-8601 timestamp representation of entity creation date. */
|
|
3026
|
-
createdAt: Date;
|
|
3027
|
-
/** The date and time the transaction was booked. */
|
|
3028
|
-
bookedAt: Date;
|
|
3029
|
-
/** The type of credit transaction. */
|
|
3030
|
-
type: 'funded' | 'consumed' | 'expired' | 'voided';
|
|
3031
|
-
/** Currency of the balance affected by the transaction. */
|
|
3032
|
-
currency: BillingCurrencyCode;
|
|
3033
|
-
/** Managed currency reference. Present only for custom currencies. */
|
|
3034
|
-
customCurrency?: CurrencyCustomReference;
|
|
3035
|
-
/**
|
|
3036
|
-
* Signed amount of the credit movement. Positive values add balance, negative
|
|
3037
|
-
* values reduce balance.
|
|
3038
|
-
*/
|
|
3039
|
-
amount: string;
|
|
3040
|
-
/** The available balance before and after the transaction. */
|
|
3041
|
-
availableBalance: {
|
|
3042
|
-
before: string;
|
|
3043
|
-
after: string;
|
|
3044
|
-
};
|
|
3045
|
-
}
|
|
3046
3771
|
/**
|
|
3047
3772
|
* BillingInvoiceWorkflowAppsReferences represents the references (id) to the apps
|
|
3048
3773
|
* used by a billing profile
|
|
@@ -3299,18 +4024,14 @@ export interface NotificationRuleInvoiceUpdatedRequest {
|
|
|
3299
4024
|
*/
|
|
3300
4025
|
channels: NotificationChannelReference[];
|
|
3301
4026
|
}
|
|
3302
|
-
/**
|
|
3303
|
-
export interface
|
|
3304
|
-
/**
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
/** The status of the invoice at the time the event was generated. */
|
|
3311
|
-
status: string;
|
|
3312
|
-
/** The invoice total, including taxes, at the time the event was generated. */
|
|
3313
|
-
total: string;
|
|
4027
|
+
/** Request body for resending a notification event. */
|
|
4028
|
+
export interface ResendBillingNotificationEventRequest {
|
|
4029
|
+
/**
|
|
4030
|
+
* The channels to resend the event to. When omitted or empty, the event is resent
|
|
4031
|
+
* to every enabled channel of the rule. Channels not targeted by the rule or
|
|
4032
|
+
* disabled are rejected.
|
|
4033
|
+
*/
|
|
4034
|
+
channels?: NotificationChannelReference[];
|
|
3314
4035
|
}
|
|
3315
4036
|
/** Filter options for listing ingested events. */
|
|
3316
4037
|
export interface ListEventsParamsFilter {
|
|
@@ -4217,6 +4938,13 @@ export interface InvoiceWorkflow {
|
|
|
4217
4938
|
/** Payment settings for this invoice. */
|
|
4218
4939
|
payment?: WorkflowPaymentSettings;
|
|
4219
4940
|
}
|
|
4941
|
+
/** Discounts applied to an invoice line item. */
|
|
4942
|
+
export interface InvoiceLineDiscounts {
|
|
4943
|
+
/** Monetary amount discounts (e.g. from maximum spend commitments). */
|
|
4944
|
+
amount?: InvoiceLineAmountDiscount[];
|
|
4945
|
+
/** Usage quantity discounts (e.g. free tier usage allowances). */
|
|
4946
|
+
usage?: InvoiceLineUsageDiscount[];
|
|
4947
|
+
}
|
|
4220
4948
|
/** Request for canceling a subscription. */
|
|
4221
4949
|
export interface SubscriptionCancel {
|
|
4222
4950
|
/** If not provided the subscription is canceled immediately. */
|
|
@@ -4356,13 +5084,6 @@ export interface AppCatalogItem {
|
|
|
4356
5084
|
/** Available install methods of the app. */
|
|
4357
5085
|
installMethods: ('with_oauth2' | 'with_api_key' | 'no_credentials_required')[];
|
|
4358
5086
|
}
|
|
4359
|
-
/** Discounts applied to an invoice line item. */
|
|
4360
|
-
export interface InvoiceLineDiscounts {
|
|
4361
|
-
/** Monetary amount discounts (e.g. from maximum spend commitments). */
|
|
4362
|
-
amount?: InvoiceLineAmountDiscount[];
|
|
4363
|
-
/** Usage quantity discounts (e.g. free tier usage allowances). */
|
|
4364
|
-
usage?: InvoiceLineUsageDiscount[];
|
|
4365
|
-
}
|
|
4366
5087
|
/**
|
|
4367
5088
|
* Invoice-level snapshot of the workflow configuration.
|
|
4368
5089
|
*
|
|
@@ -4462,6 +5183,16 @@ export interface NotificationRuleBalanceThresholdRequest {
|
|
|
4462
5183
|
*/
|
|
4463
5184
|
features?: FeatureReference[];
|
|
4464
5185
|
}
|
|
5186
|
+
/** Rule configuration of `v1.entitlement.balance_threshold.triggered`. */
|
|
5187
|
+
export interface EntitlementBalanceThresholdTriggeredV1RuleConfig {
|
|
5188
|
+
/** The thresholds that generate an event when crossed. */
|
|
5189
|
+
thresholds: NotificationBalanceThreshold[];
|
|
5190
|
+
/**
|
|
5191
|
+
* The features the rule applies to. When omitted, the rule applies to every
|
|
5192
|
+
* feature.
|
|
5193
|
+
*/
|
|
5194
|
+
features?: FeatureReference[];
|
|
5195
|
+
}
|
|
4465
5196
|
/**
|
|
4466
5197
|
* The delivery status of a notification event for one channel of the generating
|
|
4467
5198
|
* rule.
|
|
@@ -4483,25 +5214,312 @@ export interface NotificationEventDeliveryStatus {
|
|
|
4483
5214
|
/** The delivery attempts made so far, most recent first. */
|
|
4484
5215
|
attempts: NotificationEventDeliveryAttempt[];
|
|
4485
5216
|
}
|
|
5217
|
+
/** Recurring period with an interval and an anchor. */
|
|
5218
|
+
export interface NotificationEventV1RecurringPeriod {
|
|
5219
|
+
/**
|
|
5220
|
+
* The unit of time for the interval. Heuristically maps ISO duraitons to enum
|
|
5221
|
+
* values or returns the ISO duration.
|
|
5222
|
+
*/
|
|
5223
|
+
interval: NotificationEventV1RecurringPeriodInterval;
|
|
5224
|
+
/** A date-time anchor to base the recurring period on. */
|
|
5225
|
+
anchor: Date;
|
|
5226
|
+
/** The unit of time for the interval in ISO8601 format. */
|
|
5227
|
+
intervalIso: string;
|
|
5228
|
+
}
|
|
5229
|
+
/** Recurring period with an interval and an anchor. */
|
|
5230
|
+
export interface NotificationEventV1RecurringPeriodV2 {
|
|
5231
|
+
/**
|
|
5232
|
+
* The unit of time for the interval. Heuristically maps ISO duraitons to enum
|
|
5233
|
+
* values or returns the ISO duration.
|
|
5234
|
+
*/
|
|
5235
|
+
interval: NotificationEventV1RecurringPeriodInterval;
|
|
5236
|
+
/** A date-time anchor to base the recurring period on. */
|
|
5237
|
+
anchor: Date;
|
|
5238
|
+
}
|
|
5239
|
+
/**
|
|
5240
|
+
* LLM cost lookup configuration. Maps meter group-by dimensions to LLM cost
|
|
5241
|
+
* database fields.
|
|
5242
|
+
*/
|
|
5243
|
+
export interface NotificationEventV1FeatureLlmUnitCost {
|
|
5244
|
+
/** type. */
|
|
5245
|
+
type: 'llm';
|
|
5246
|
+
/**
|
|
5247
|
+
* Meter group-by property that holds the LLM provider. Use this when the meter has
|
|
5248
|
+
* a group-by dimension for provider. Mutually exclusive with `provider`.
|
|
5249
|
+
*/
|
|
5250
|
+
providerProperty?: string;
|
|
5251
|
+
/**
|
|
5252
|
+
* Static LLM provider value (e.g., "openai", "anthropic"). Use this when the
|
|
5253
|
+
* feature tracks a single provider. Mutually exclusive with `providerProperty`.
|
|
5254
|
+
*/
|
|
5255
|
+
provider?: string;
|
|
5256
|
+
/**
|
|
5257
|
+
* Meter group-by property that holds the model ID. Use this when the meter has a
|
|
5258
|
+
* group-by dimension for model. Mutually exclusive with `model`.
|
|
5259
|
+
*/
|
|
5260
|
+
modelProperty?: string;
|
|
5261
|
+
/**
|
|
5262
|
+
* Static model ID value (e.g., "gpt-4", "claude-3-5-sonnet"). Use this when the
|
|
5263
|
+
* feature tracks a single model. Mutually exclusive with `modelProperty`.
|
|
5264
|
+
*/
|
|
5265
|
+
model?: string;
|
|
5266
|
+
/**
|
|
5267
|
+
* Meter group-by property that holds the token type. Use this when the meter has a
|
|
5268
|
+
* group-by dimension for token type. Mutually exclusive with `tokenType`.
|
|
5269
|
+
*/
|
|
5270
|
+
tokenTypeProperty?: string;
|
|
5271
|
+
/**
|
|
5272
|
+
* Static token type value. Use this when the feature tracks a single token type
|
|
5273
|
+
* (e.g., only input tokens). Expected values: input, output, cache_read,
|
|
5274
|
+
* reasoning, cache_write, request, response. `request` is an alias for `input`,
|
|
5275
|
+
* `response` is an alias for `output`. Mutually exclusive with
|
|
5276
|
+
* `tokenTypeProperty`.
|
|
5277
|
+
*/
|
|
5278
|
+
tokenType?: string;
|
|
5279
|
+
/**
|
|
5280
|
+
* Resolved per-token pricing from the LLM cost database. Only populated in
|
|
5281
|
+
* responses when the feature's meter group-by filters specify exact provider and
|
|
5282
|
+
* model values.
|
|
5283
|
+
*/
|
|
5284
|
+
pricing?: NotificationEventV1FeatureLlmUnitCostPricing;
|
|
5285
|
+
}
|
|
5286
|
+
/** A price tier. At least one price component is required in each tier. */
|
|
5287
|
+
export interface NotificationEventV1PriceTier {
|
|
5288
|
+
/**
|
|
5289
|
+
* Up to and including to this quantity will be contained in the tier. If null, the
|
|
5290
|
+
* tier is open-ended.
|
|
5291
|
+
*/
|
|
5292
|
+
upToAmount?: string;
|
|
5293
|
+
/** The flat price component of the tier. */
|
|
5294
|
+
flatPrice: NotificationEventV1FlatPrice | null;
|
|
5295
|
+
/** The unit price component of the tier. */
|
|
5296
|
+
unitPrice: NotificationEventV1UnitPrice | null;
|
|
5297
|
+
}
|
|
5298
|
+
/** Subscription is an exact subscription instance. */
|
|
5299
|
+
export interface NotificationEventV1Subscription {
|
|
5300
|
+
/** A unique identifier for the resource. */
|
|
5301
|
+
id: string;
|
|
5302
|
+
/** Human-readable name for the resource. Between 1 and 256 characters. */
|
|
5303
|
+
name: string;
|
|
5304
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
5305
|
+
description?: string;
|
|
5306
|
+
/** Additional metadata for the resource. */
|
|
5307
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
5308
|
+
/** Timestamp of when the resource was created. */
|
|
5309
|
+
createdAt: Date;
|
|
5310
|
+
/** Timestamp of when the resource was last updated. */
|
|
5311
|
+
updatedAt: Date;
|
|
5312
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
5313
|
+
deletedAt?: Date;
|
|
5314
|
+
/** The cadence start of the resource. */
|
|
5315
|
+
activeFrom: Date;
|
|
5316
|
+
/** The cadence end of the resource. */
|
|
5317
|
+
activeTo?: Date;
|
|
5318
|
+
/** Set of key-value pairs managed by the system. Cannot be modified by user. */
|
|
5319
|
+
annotations?: NotificationEventV1Annotations;
|
|
5320
|
+
/** Alignment configuration for the plan. */
|
|
5321
|
+
alignment?: NotificationEventV1Alignment;
|
|
5322
|
+
/** The status of the subscription. */
|
|
5323
|
+
status: 'active' | 'inactive' | 'canceled' | 'scheduled';
|
|
5324
|
+
/** The customer ID of the subscription. */
|
|
5325
|
+
customerId: string;
|
|
5326
|
+
/** The plan of the subscription. */
|
|
5327
|
+
plan?: NotificationEventV1PlanReference;
|
|
5328
|
+
/** The fiat currency in which the subscription is invoiced. */
|
|
5329
|
+
currency: string;
|
|
5330
|
+
/**
|
|
5331
|
+
* Controls whether custom-currency cost bases are resolved dynamically or pinned
|
|
5332
|
+
* when their currency pair is introduced to the subscription.
|
|
5333
|
+
*/
|
|
5334
|
+
costBasisMode: 'dynamic' | 'pinned';
|
|
5335
|
+
/** Cost bases pinned to custom-currency pairs for this subscription. */
|
|
5336
|
+
costBasisPins: NotificationEventV1SubscriptionCostBasisPin[];
|
|
5337
|
+
/**
|
|
5338
|
+
* The billing cadence for the subscriptions. Defines how often customers are
|
|
5339
|
+
* billed using ISO8601 duration format. Examples: "P1M" (monthly), "P3M"
|
|
5340
|
+
* (quarterly), "P1Y" (annually).
|
|
5341
|
+
*/
|
|
5342
|
+
billingCadence: string;
|
|
5343
|
+
/** The pro-rating configuration for the subscriptions. */
|
|
5344
|
+
proRatingConfig?: NotificationEventV1ProRatingConfig;
|
|
5345
|
+
/** The normalizedbilling anchor of the subscription. */
|
|
5346
|
+
billingAnchor: Date;
|
|
5347
|
+
/**
|
|
5348
|
+
* The settlement mode of the subscription.
|
|
5349
|
+
*
|
|
5350
|
+
* - credit_then_invoice: credits from the previous billing period are applied
|
|
5351
|
+
* first, then the remaining balance is invoiced.
|
|
5352
|
+
* - credit_only: only credits from the previous billing period are generated and
|
|
5353
|
+
* applied. No invoices are generated for the subscription. This is the default
|
|
5354
|
+
* and most common settlement mode.
|
|
5355
|
+
*/
|
|
5356
|
+
settlementMode: 'credit_then_invoice' | 'credit_only';
|
|
5357
|
+
}
|
|
5358
|
+
/** Party represents a person or business entity. */
|
|
5359
|
+
export interface NotificationEventV1BillingParty {
|
|
5360
|
+
/** Unique identifier for the party (if available) */
|
|
5361
|
+
id?: string;
|
|
5362
|
+
/** An optional unique key of the party (if available) */
|
|
5363
|
+
key?: string;
|
|
5364
|
+
/** Legal name or representation of the organization. */
|
|
5365
|
+
name?: string;
|
|
5366
|
+
/**
|
|
5367
|
+
* The entity's legal ID code used for tax purposes. They may have other numbers,
|
|
5368
|
+
* but we're only interested in those valid for tax purposes.
|
|
5369
|
+
*/
|
|
5370
|
+
taxId?: NotificationEventV1BillingPartyTaxIdentity;
|
|
5371
|
+
/** Regular post addresses for where information should be sent if needed. */
|
|
5372
|
+
addresses?: NotificationEventV1Address[];
|
|
5373
|
+
}
|
|
5374
|
+
/**
|
|
5375
|
+
* BillingInvoiceCustomerExtendedDetails is a collection of fields that are used to
|
|
5376
|
+
* extend the billing party details for invoices.
|
|
5377
|
+
*
|
|
5378
|
+
* These fields contain the OpenMeter specific details for the customer, that are
|
|
5379
|
+
* not strictly required for the invoice itself.
|
|
5380
|
+
*/
|
|
5381
|
+
export interface NotificationEventV1BillingInvoiceCustomerExtendedDetails {
|
|
5382
|
+
/** Unique identifier for the party (if available) */
|
|
5383
|
+
id?: string;
|
|
5384
|
+
/** An optional unique key of the party (if available) */
|
|
5385
|
+
key?: string;
|
|
5386
|
+
/** Legal name or representation of the organization. */
|
|
5387
|
+
name?: string;
|
|
5388
|
+
/**
|
|
5389
|
+
* The entity's legal ID code used for tax purposes. They may have other numbers,
|
|
5390
|
+
* but we're only interested in those valid for tax purposes.
|
|
5391
|
+
*/
|
|
5392
|
+
taxId?: NotificationEventV1BillingPartyTaxIdentity;
|
|
5393
|
+
/** Regular post addresses for where information should be sent if needed. */
|
|
5394
|
+
addresses?: NotificationEventV1Address[];
|
|
5395
|
+
/** Mapping to attribute metered usage to the customer */
|
|
5396
|
+
usageAttribution: NotificationEventV1CustomerUsageAttribution;
|
|
5397
|
+
}
|
|
5398
|
+
/**
|
|
5399
|
+
* InvoiceStatusDetails represents the details of the invoice status.
|
|
5400
|
+
*
|
|
5401
|
+
* API users are encouraged to rely on the immutable/failed/avaliableActions fields
|
|
5402
|
+
* to determine the next steps of the invoice instead of the extendedStatus field.
|
|
5403
|
+
*/
|
|
5404
|
+
export interface NotificationEventV1InvoiceStatusDetails {
|
|
5405
|
+
/** Is the invoice editable? */
|
|
5406
|
+
immutable: boolean;
|
|
5407
|
+
/** Is the invoice in a failed state? */
|
|
5408
|
+
failed: boolean;
|
|
5409
|
+
/** Extended status information for the invoice. */
|
|
5410
|
+
extendedStatus: string;
|
|
5411
|
+
/** The actions that can be performed on the invoice. */
|
|
5412
|
+
availableActions: NotificationEventV1InvoiceAvailableActions;
|
|
5413
|
+
}
|
|
5414
|
+
/**
|
|
5415
|
+
* A marketplace listing. Represent an available app in the app marketplace that
|
|
5416
|
+
* can be installed to the organization.
|
|
5417
|
+
*
|
|
5418
|
+
* Marketplace apps only exist in config so they don't extend the Resource model.
|
|
5419
|
+
*/
|
|
5420
|
+
export interface NotificationEventV1MarketplaceListing {
|
|
5421
|
+
/** The app's type */
|
|
5422
|
+
type: 'stripe' | 'sandbox' | 'custom_invoicing';
|
|
5423
|
+
/** The app's name. */
|
|
5424
|
+
name: string;
|
|
5425
|
+
/** The app's description. */
|
|
5426
|
+
description: string;
|
|
5427
|
+
/** The app's capabilities. */
|
|
5428
|
+
capabilities: NotificationEventV1AppCapability[];
|
|
5429
|
+
/**
|
|
5430
|
+
* Install methods.
|
|
5431
|
+
*
|
|
5432
|
+
* List of methods to install the app.
|
|
5433
|
+
*/
|
|
5434
|
+
installMethods: ('with_oauth2' | 'with_api_key' | 'no_credentials_required')[];
|
|
5435
|
+
}
|
|
5436
|
+
/**
|
|
5437
|
+
* BillingWorkflowInvoicingSettings represents the invoice settings for a billing
|
|
5438
|
+
* workflow
|
|
5439
|
+
*/
|
|
5440
|
+
export interface NotificationEventV1BillingWorkflowInvoicingSettings {
|
|
5441
|
+
/** Whether to automatically issue the invoice after the draftPeriod has passed. */
|
|
5442
|
+
autoAdvance?: boolean;
|
|
5443
|
+
/** The period for the invoice to be kept in draft status for manual reviews. */
|
|
5444
|
+
draftPeriod?: string;
|
|
5445
|
+
/**
|
|
5446
|
+
* The period after which the invoice is due. With some payment solutions it's only
|
|
5447
|
+
* applicable for manual collection method.
|
|
5448
|
+
*/
|
|
5449
|
+
dueAfter?: string;
|
|
5450
|
+
/** Should progressive billing be allowed for this workflow? */
|
|
5451
|
+
progressiveBilling?: boolean;
|
|
5452
|
+
/** Controls how subscription-ending shortened service periods are billed. */
|
|
5453
|
+
subscriptionEndProrationMode?: 'bill_full_period' | 'bill_actual_period';
|
|
5454
|
+
/**
|
|
5455
|
+
* Default tax configuration to apply to the invoices.
|
|
5456
|
+
*
|
|
5457
|
+
* Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax
|
|
5458
|
+
* config is deprecated and can no longer be added or changed: the organization
|
|
5459
|
+
* default tax code is used instead. Existing tax-code values may still be removed,
|
|
5460
|
+
* and `behavior` remains fully supported.
|
|
5461
|
+
*/
|
|
5462
|
+
defaultTaxConfig?: NotificationEventV1TaxConfig;
|
|
5463
|
+
}
|
|
5464
|
+
/** TaxConfig stores the configuration for a tax line relative to an invoice line. */
|
|
5465
|
+
export interface NotificationEventV1InvoiceLineTaxItem {
|
|
5466
|
+
/** Tax provider configuration. */
|
|
5467
|
+
config?: NotificationEventV1TaxConfig;
|
|
5468
|
+
/**
|
|
5469
|
+
* Percent defines the percentage set manually or determined from the rate key
|
|
5470
|
+
* (calculated if rate present). A nil percent implies that this tax combo is
|
|
5471
|
+
* **exempt** from tax.")
|
|
5472
|
+
*/
|
|
5473
|
+
percent?: number;
|
|
5474
|
+
/** Some countries require an additional surcharge (calculated if rate present). */
|
|
5475
|
+
surcharge?: string;
|
|
5476
|
+
/** Is the tax item inclusive or exclusive of the base amount. */
|
|
5477
|
+
behavior?: 'inclusive' | 'exclusive';
|
|
5478
|
+
}
|
|
5479
|
+
/** A discount by type. */
|
|
5480
|
+
export interface NotificationEventV1BillingDiscounts {
|
|
5481
|
+
/** The percentage discount. */
|
|
5482
|
+
percentage?: NotificationEventV1BillingDiscountPercentage;
|
|
5483
|
+
/** The usage discount. */
|
|
5484
|
+
usage?: NotificationEventV1BillingDiscountUsage;
|
|
5485
|
+
}
|
|
5486
|
+
/** PaymentTermDueDate defines the terms for payment on a specific date. */
|
|
5487
|
+
export interface NotificationEventV1PaymentTermDueDate {
|
|
5488
|
+
/** Type of terms to be applied. */
|
|
5489
|
+
type: 'due_date';
|
|
5490
|
+
/** Text detail of the chosen payment terms. */
|
|
5491
|
+
detail?: string;
|
|
5492
|
+
/** Description of the conditions for payment. */
|
|
5493
|
+
notes?: string;
|
|
5494
|
+
/** When the payment is due. */
|
|
5495
|
+
dueAt: NotificationEventV1PaymentDueDate[];
|
|
5496
|
+
}
|
|
4486
5497
|
/** Billing customer data. */
|
|
4487
5498
|
export interface CustomerData {
|
|
4488
5499
|
/**
|
|
4489
|
-
* The billing profile for the customer.
|
|
5500
|
+
* The billing profile explicitly selected for the customer.
|
|
4490
5501
|
*
|
|
4491
|
-
*
|
|
5502
|
+
* Unpinned customers use the current namespace default. Selecting the current
|
|
5503
|
+
* default explicitly pins the customer to that profile.
|
|
5504
|
+
*/
|
|
5505
|
+
billingProfile?: ProfileReference | null;
|
|
5506
|
+
/**
|
|
5507
|
+
* The effective billing profile for the customer. Uses the explicitly selected
|
|
5508
|
+
* billing profile when pinned, otherwise the current default billing profile.
|
|
4492
5509
|
*/
|
|
4493
|
-
|
|
5510
|
+
effectiveBillingProfile: ProfileReference;
|
|
4494
5511
|
/** App customer data. */
|
|
4495
5512
|
appData?: AppCustomerData;
|
|
4496
5513
|
}
|
|
4497
5514
|
/** CustomerBillingData upsert request. */
|
|
4498
5515
|
export interface UpsertCustomerBillingDataRequest {
|
|
4499
5516
|
/**
|
|
4500
|
-
* The billing profile for the customer.
|
|
5517
|
+
* The billing profile explicitly selected for the customer.
|
|
4501
5518
|
*
|
|
4502
|
-
*
|
|
5519
|
+
* Unpinned customers use the current namespace default. Selecting the current
|
|
5520
|
+
* default explicitly pins the customer to that profile.
|
|
4503
5521
|
*/
|
|
4504
|
-
billingProfile?: ProfileReference;
|
|
5522
|
+
billingProfile?: ProfileReference | null;
|
|
4505
5523
|
/** App customer data. */
|
|
4506
5524
|
appData?: AppCustomerData;
|
|
4507
5525
|
}
|
|
@@ -4550,37 +5568,6 @@ export interface ListCustomerEntitlementAccessResponseData {
|
|
|
4550
5568
|
/** The list of entitlement access results. */
|
|
4551
5569
|
data: EntitlementValueResult[];
|
|
4552
5570
|
}
|
|
4553
|
-
/** The entities and threshold a balance threshold event refers to. */
|
|
4554
|
-
export interface NotificationEventBalanceThresholdData {
|
|
4555
|
-
/** The identifier of the entitlement that triggered the event. */
|
|
4556
|
-
entitlementId: string;
|
|
4557
|
-
/** The feature the entitlement grants access to. */
|
|
4558
|
-
feature: NotificationEventFeatureReference;
|
|
4559
|
-
/** The key of the subject the entitlement belongs to. */
|
|
4560
|
-
subjectKey: string;
|
|
4561
|
-
/** The identifier of the customer the subject belongs to, if any. */
|
|
4562
|
-
customerId?: string;
|
|
4563
|
-
/** The entitlement value at the time the event was generated. */
|
|
4564
|
-
value: EntitlementValueResult;
|
|
4565
|
-
/** The threshold the balance crossed. */
|
|
4566
|
-
threshold: NotificationBalanceThreshold;
|
|
4567
|
-
}
|
|
4568
|
-
/**
|
|
4569
|
-
* The entitlement, feature, and subject an entitlement notification event refers
|
|
4570
|
-
* to.
|
|
4571
|
-
*/
|
|
4572
|
-
export interface NotificationEventEntitlementData {
|
|
4573
|
-
/** The identifier of the entitlement that triggered the event. */
|
|
4574
|
-
entitlementId: string;
|
|
4575
|
-
/** The feature the entitlement grants access to. */
|
|
4576
|
-
feature: NotificationEventFeatureReference;
|
|
4577
|
-
/** The key of the subject the entitlement belongs to. */
|
|
4578
|
-
subjectKey: string;
|
|
4579
|
-
/** The identifier of the customer the subject belongs to, if any. */
|
|
4580
|
-
customerId?: string;
|
|
4581
|
-
/** The entitlement value at the time the event was generated. */
|
|
4582
|
-
value: EntitlementValueResult;
|
|
4583
|
-
}
|
|
4584
5571
|
/**
|
|
4585
5572
|
* Graduated tiered price.
|
|
4586
5573
|
*
|
|
@@ -4686,6 +5673,18 @@ export interface CreateCreditGrantPurchase {
|
|
|
4686
5673
|
*/
|
|
4687
5674
|
availabilityPolicy: 'on_creation';
|
|
4688
5675
|
}
|
|
5676
|
+
/** The balances of the credits of a customer. */
|
|
5677
|
+
export interface CreditBalances {
|
|
5678
|
+
/** The timestamp of the balance retrieval. */
|
|
5679
|
+
retrievedAt: Date;
|
|
5680
|
+
/** The balances by currencies. */
|
|
5681
|
+
balances: CreditBalance[];
|
|
5682
|
+
}
|
|
5683
|
+
/** Cursor paginated response. */
|
|
5684
|
+
export interface CreditTransactionPaginatedResponse {
|
|
5685
|
+
data: CreditTransaction[];
|
|
5686
|
+
meta: CursorMeta;
|
|
5687
|
+
}
|
|
4689
5688
|
/** Purchase and payment terms of the grant. */
|
|
4690
5689
|
export interface CreditGrantPurchase {
|
|
4691
5690
|
/**
|
|
@@ -4801,45 +5800,11 @@ export interface WorkflowTaxSettings {
|
|
|
4801
5800
|
*/
|
|
4802
5801
|
defaultTaxConfig?: TaxConfig;
|
|
4803
5802
|
}
|
|
4804
|
-
/** The balances of the credits of a customer. */
|
|
4805
|
-
export interface CreditBalances {
|
|
4806
|
-
/** The timestamp of the balance retrieval. */
|
|
4807
|
-
retrievedAt: Date;
|
|
4808
|
-
/** The balances by currencies. */
|
|
4809
|
-
balances: CreditBalance[];
|
|
4810
|
-
}
|
|
4811
|
-
/** Cursor paginated response. */
|
|
4812
|
-
export interface CreditTransactionPaginatedResponse {
|
|
4813
|
-
data: CreditTransaction[];
|
|
4814
|
-
meta: CursorMeta;
|
|
4815
|
-
}
|
|
4816
5803
|
/** Page paginated response. */
|
|
4817
5804
|
export interface PlanAddonPagePaginatedResponse {
|
|
4818
5805
|
data: PlanAddon[];
|
|
4819
5806
|
meta: PaginatedMeta;
|
|
4820
5807
|
}
|
|
4821
|
-
/** An invoice created notification event payload. */
|
|
4822
|
-
export interface NotificationEventInvoiceCreatedPayload {
|
|
4823
|
-
/** The identifier of the event the payload belongs to. */
|
|
4824
|
-
id: string;
|
|
4825
|
-
/** The type of the event. */
|
|
4826
|
-
type: 'invoice.created';
|
|
4827
|
-
/** When the event was generated. */
|
|
4828
|
-
timestamp: Date;
|
|
4829
|
-
/** The invoice the event refers to. */
|
|
4830
|
-
data: NotificationEventInvoiceData;
|
|
4831
|
-
}
|
|
4832
|
-
/** An invoice updated notification event payload. */
|
|
4833
|
-
export interface NotificationEventInvoiceUpdatedPayload {
|
|
4834
|
-
/** The identifier of the event the payload belongs to. */
|
|
4835
|
-
id: string;
|
|
4836
|
-
/** The type of the event. */
|
|
4837
|
-
type: 'invoice.updated';
|
|
4838
|
-
/** When the event was generated. */
|
|
4839
|
-
timestamp: Date;
|
|
4840
|
-
/** The invoice the event refers to. */
|
|
4841
|
-
data: NotificationEventInvoiceData;
|
|
4842
|
-
}
|
|
4843
5808
|
/** Cursor paginated response. */
|
|
4844
5809
|
export interface IngestedEventPaginatedResponse {
|
|
4845
5810
|
data: IngestedEvent[];
|
|
@@ -5091,6 +6056,50 @@ export interface InvoiceWorkflowSettings {
|
|
|
5091
6056
|
*/
|
|
5092
6057
|
workflow: InvoiceWorkflow;
|
|
5093
6058
|
}
|
|
6059
|
+
/**
|
|
6060
|
+
* A detailed (child) sub-line belonging to a parent invoice line.
|
|
6061
|
+
*
|
|
6062
|
+
* Detailed lines represent the individual flat-fee components that make up a
|
|
6063
|
+
* usage-based parent line after quantity snapshotting.
|
|
6064
|
+
*/
|
|
6065
|
+
export interface InvoiceDetailedLine {
|
|
6066
|
+
id: string;
|
|
6067
|
+
/**
|
|
6068
|
+
* Display name of the resource.
|
|
6069
|
+
*
|
|
6070
|
+
* Between 1 and 256 characters.
|
|
6071
|
+
*/
|
|
6072
|
+
name: string;
|
|
6073
|
+
/**
|
|
6074
|
+
* Optional description of the resource.
|
|
6075
|
+
*
|
|
6076
|
+
* Maximum 1024 characters.
|
|
6077
|
+
*/
|
|
6078
|
+
description?: string;
|
|
6079
|
+
labels?: Labels;
|
|
6080
|
+
/** An ISO-8601 timestamp representation of entity creation date. */
|
|
6081
|
+
createdAt: Date;
|
|
6082
|
+
/** An ISO-8601 timestamp representation of entity last update date. */
|
|
6083
|
+
updatedAt: Date;
|
|
6084
|
+
/** An ISO-8601 timestamp representation of entity deletion date. */
|
|
6085
|
+
deletedAt?: Date;
|
|
6086
|
+
/** The service period covered by this detailed line. */
|
|
6087
|
+
servicePeriod: ClosedPeriod;
|
|
6088
|
+
/** Aggregated financial totals for the detailed line. */
|
|
6089
|
+
totals: Totals;
|
|
6090
|
+
/** The cost category of this detailed line. */
|
|
6091
|
+
category: 'regular' | 'commitment';
|
|
6092
|
+
/** Discounts applied to this detailed line. */
|
|
6093
|
+
discounts?: InvoiceLineDiscounts;
|
|
6094
|
+
/** Credit applied to this detailed line. */
|
|
6095
|
+
creditsApplied?: InvoiceLineCreditsApplied[];
|
|
6096
|
+
/** External identifiers for this detailed line. */
|
|
6097
|
+
externalReferences?: InvoiceLineExternalReferences;
|
|
6098
|
+
/** The quantity of the detailed line. */
|
|
6099
|
+
quantity: string;
|
|
6100
|
+
/** The unit price of the detailed line. */
|
|
6101
|
+
unitPrice: string;
|
|
6102
|
+
}
|
|
5094
6103
|
/** Page paginated response. */
|
|
5095
6104
|
export interface TaxCodePagePaginatedResponse {
|
|
5096
6105
|
data: TaxCode[];
|
|
@@ -5389,109 +6398,362 @@ export interface InstalledAppExternalInvoicing {
|
|
|
5389
6398
|
/** Default capabilities of the installed app. */
|
|
5390
6399
|
defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[];
|
|
5391
6400
|
}
|
|
6401
|
+
/** Snapshot of the billing workflow configuration captured at invoice creation. */
|
|
6402
|
+
export interface UpdateInvoiceWorkflowSettings {
|
|
6403
|
+
/**
|
|
6404
|
+
* The workflow configuration that was active when the invoice was created.
|
|
6405
|
+
*
|
|
6406
|
+
* Only the fields that are meaningful at the per-invoice level are included:
|
|
6407
|
+
* invoicing behaviour (auto-advance, draft period) and payment settings
|
|
6408
|
+
* (collection method, due date). Profile-wide settings such as collection
|
|
6409
|
+
* alignment, progressive billing, and tax policy are omitted.
|
|
6410
|
+
*/
|
|
6411
|
+
workflow: UpdateBillingInvoiceWorkflow;
|
|
6412
|
+
}
|
|
6413
|
+
/** Access evaluation result for a single resolved customer. */
|
|
6414
|
+
export interface EntitlementAccessQueryResult {
|
|
6415
|
+
/**
|
|
6416
|
+
* The list of identifiers from the request that resolved to this customer. Each
|
|
6417
|
+
* entry is either the customer `key` or one of its usage-attribution subject
|
|
6418
|
+
* `key`s.
|
|
6419
|
+
*
|
|
6420
|
+
* Duplicate or aliased identifiers that resolve to the same customer collapse to a
|
|
6421
|
+
* single result entry, with every requested identifier listed here.
|
|
6422
|
+
*/
|
|
6423
|
+
matched: string[];
|
|
6424
|
+
/** The customer the matched identifiers resolved to. */
|
|
6425
|
+
customer: Customer;
|
|
6426
|
+
/**
|
|
6427
|
+
* Map of features with their access status.
|
|
6428
|
+
*
|
|
6429
|
+
* Map keys are the feature keys requested in `feature.keys`, or every feature
|
|
6430
|
+
* `key` available in the organization when the feature filter was omitted.
|
|
6431
|
+
*/
|
|
6432
|
+
features: Record<string, EntitlementFeatureAccess>;
|
|
6433
|
+
/**
|
|
6434
|
+
* Timestamp of the most recent change to the customer's access state reflected in
|
|
6435
|
+
* this result.
|
|
6436
|
+
*/
|
|
6437
|
+
updatedAt: Date;
|
|
6438
|
+
}
|
|
5392
6439
|
/**
|
|
5393
|
-
*
|
|
5394
|
-
*
|
|
5395
|
-
*
|
|
5396
|
-
*
|
|
6440
|
+
* Metered entitlements are useful for many different use cases, from setting up
|
|
6441
|
+
* usage based access to implementing complex credit systems. Access is determined
|
|
6442
|
+
* based on feature usage using a balance calculation (the "usage allowance"
|
|
6443
|
+
* provided by the issued grants is "burnt down" by the usage).
|
|
5397
6444
|
*/
|
|
5398
|
-
export interface
|
|
6445
|
+
export interface NotificationEventV1EntitlementMetered {
|
|
6446
|
+
/** type. */
|
|
6447
|
+
type: 'metered';
|
|
6448
|
+
/**
|
|
6449
|
+
* If softLimit=true the subject can use the feature even if the entitlement is
|
|
6450
|
+
* exhausted, hasAccess will always be true.
|
|
6451
|
+
*/
|
|
6452
|
+
isSoftLimit?: boolean;
|
|
6453
|
+
/**
|
|
6454
|
+
* Deprecated, ignored by the backend. Please use isSoftLimit instead; this field
|
|
6455
|
+
* will be removed in the future.
|
|
6456
|
+
*/
|
|
6457
|
+
isUnlimited?: boolean;
|
|
6458
|
+
/**
|
|
6459
|
+
* You can grant usage automatically alongside the entitlement, the example
|
|
6460
|
+
* scenario would be creating a starting balance. If an amount is specified here, a
|
|
6461
|
+
* grant will be created alongside the entitlement with the specified amount. That
|
|
6462
|
+
* grant will have it's rollover settings configured in a way that after each reset
|
|
6463
|
+
* operation, the balance will return the original amount specified here. Manually
|
|
6464
|
+
* creating such a grant would mean having the "amount", "minRolloverAmount", and
|
|
6465
|
+
* "maxRolloverAmount" fields all be the same.
|
|
6466
|
+
*/
|
|
6467
|
+
issueAfterReset?: number;
|
|
6468
|
+
/** Defines the grant priority for the default grant. */
|
|
6469
|
+
issueAfterResetPriority?: number;
|
|
6470
|
+
/** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
|
|
6471
|
+
preserveOverageAtReset?: boolean;
|
|
6472
|
+
/** Timestamp of when the resource was created. */
|
|
6473
|
+
createdAt: Date;
|
|
6474
|
+
/** Timestamp of when the resource was last updated. */
|
|
6475
|
+
updatedAt: Date;
|
|
6476
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
6477
|
+
deletedAt?: Date;
|
|
6478
|
+
/** Additional metadata for the feature. */
|
|
6479
|
+
metadata?: NotificationEventV1Metadata;
|
|
6480
|
+
/** The cadence start of the resource. */
|
|
6481
|
+
activeFrom: Date;
|
|
6482
|
+
/** The cadence end of the resource. */
|
|
6483
|
+
activeTo?: Date;
|
|
6484
|
+
/** The annotations of the entitlement. */
|
|
6485
|
+
annotations?: NotificationEventV1Annotations;
|
|
6486
|
+
/** Readonly unique ULID identifier. */
|
|
5399
6487
|
id: string;
|
|
5400
6488
|
/**
|
|
5401
|
-
*
|
|
6489
|
+
* The identifier key unique to the subject. NOTE: Subjects are being deprecated,
|
|
6490
|
+
* please use the new customer APIs.
|
|
6491
|
+
*/
|
|
6492
|
+
subjectKey: string;
|
|
6493
|
+
/** The feature the subject is entitled to use. */
|
|
6494
|
+
featureKey: string;
|
|
6495
|
+
/** The feature the subject is entitled to use. */
|
|
6496
|
+
featureId: string;
|
|
6497
|
+
/** The time the last reset happened. */
|
|
6498
|
+
lastReset: Date;
|
|
6499
|
+
/** The current usage period. */
|
|
6500
|
+
currentUsagePeriod: NotificationEventV1Period;
|
|
6501
|
+
/**
|
|
6502
|
+
* The time from which usage is measured. If not specified on creation, defaults to
|
|
6503
|
+
* entitlement creation time.
|
|
6504
|
+
*/
|
|
6505
|
+
measureUsageFrom: Date;
|
|
6506
|
+
/** THe usage period of the entitlement. */
|
|
6507
|
+
usagePeriod: NotificationEventV1RecurringPeriod;
|
|
6508
|
+
}
|
|
6509
|
+
/**
|
|
6510
|
+
* BillingWorkflowCollectionAlignmentAnchored specifies the alignment for
|
|
6511
|
+
* collecting the pending line items into an invoice.
|
|
6512
|
+
*/
|
|
6513
|
+
export interface NotificationEventV1BillingWorkflowCollectionAlignmentAnchored {
|
|
6514
|
+
/** The type of alignment. */
|
|
6515
|
+
type: 'anchored';
|
|
6516
|
+
/** The recurring period for the alignment. */
|
|
6517
|
+
recurringPeriod: NotificationEventV1RecurringPeriodV2;
|
|
6518
|
+
}
|
|
6519
|
+
/** Tiered price with spend commitments. */
|
|
6520
|
+
export interface NotificationEventV1TieredPriceWithCommitments {
|
|
6521
|
+
/**
|
|
6522
|
+
* The type of the price.
|
|
5402
6523
|
*
|
|
5403
|
-
*
|
|
6524
|
+
* One of: flat, unit, or tiered.
|
|
6525
|
+
*/
|
|
6526
|
+
type: 'tiered';
|
|
6527
|
+
/**
|
|
6528
|
+
* Defines if the tiering mode is volume-based or graduated:
|
|
6529
|
+
*
|
|
6530
|
+
* - In `volume`-based tiering, the maximum quantity within a period determines the
|
|
6531
|
+
* per unit price.
|
|
6532
|
+
* - In `graduated` tiering, pricing can change as the quantity grows.
|
|
6533
|
+
*/
|
|
6534
|
+
mode: 'volume' | 'graduated';
|
|
6535
|
+
/**
|
|
6536
|
+
* The tiers of the tiered price. At least one price component is required in each
|
|
6537
|
+
* tier.
|
|
6538
|
+
*/
|
|
6539
|
+
tiers: NotificationEventV1PriceTier[];
|
|
6540
|
+
/** The customer is committed to spend at least the amount. */
|
|
6541
|
+
minimumAmount?: string;
|
|
6542
|
+
/** The customer is limited to spend at most the amount. */
|
|
6543
|
+
maximumAmount?: string;
|
|
6544
|
+
}
|
|
6545
|
+
/** A customer object. */
|
|
6546
|
+
export interface NotificationEventV1Customer {
|
|
6547
|
+
/** A unique identifier for the resource. */
|
|
6548
|
+
id: string;
|
|
6549
|
+
/** Human-readable name for the resource. Between 1 and 256 characters. */
|
|
6550
|
+
name: string;
|
|
6551
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
6552
|
+
description?: string;
|
|
6553
|
+
/** Additional metadata for the resource. */
|
|
6554
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
6555
|
+
/** Timestamp of when the resource was created. */
|
|
6556
|
+
createdAt: Date;
|
|
6557
|
+
/** Timestamp of when the resource was last updated. */
|
|
6558
|
+
updatedAt: Date;
|
|
6559
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
6560
|
+
deletedAt?: Date;
|
|
6561
|
+
/**
|
|
6562
|
+
* An optional unique key of the customer. Either key or
|
|
6563
|
+
* usageAttribution.subjectKeys must be provided. Useful to reference the customer
|
|
6564
|
+
* in external systems. For example, your database ID.
|
|
6565
|
+
*/
|
|
6566
|
+
key?: string;
|
|
6567
|
+
/**
|
|
6568
|
+
* Mapping to attribute metered usage to the customer Either key or
|
|
6569
|
+
* usageAttribution.subjectKeys must be provided.
|
|
5404
6570
|
*/
|
|
6571
|
+
usageAttribution?: NotificationEventV1CustomerUsageAttribution;
|
|
6572
|
+
/** The primary email address of the customer. */
|
|
6573
|
+
primaryEmail?: string;
|
|
6574
|
+
/** Currency of the customer. Used for billing, tax and invoicing. */
|
|
6575
|
+
currency?: string;
|
|
6576
|
+
/** The billing address of the customer. Used for tax and invoicing. */
|
|
6577
|
+
billingAddress?: NotificationEventV1Address;
|
|
6578
|
+
/** The ID of the Subscription if the customer has one. */
|
|
6579
|
+
currentSubscriptionId?: string;
|
|
6580
|
+
/** The subscriptions of the customer. Only with the `subscriptions` expand option. */
|
|
6581
|
+
subscriptions?: NotificationEventV1Subscription[];
|
|
6582
|
+
/** Set of key-value pairs managed by the system. Cannot be modified by user. */
|
|
6583
|
+
annotations?: NotificationEventV1Annotations;
|
|
6584
|
+
}
|
|
6585
|
+
/** A installed Stripe app object. */
|
|
6586
|
+
export interface NotificationEventV1StripeApp {
|
|
6587
|
+
/** A unique identifier for the resource. */
|
|
6588
|
+
id: string;
|
|
6589
|
+
/** Human-readable name for the resource. Between 1 and 256 characters. */
|
|
6590
|
+
name: string;
|
|
6591
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
6592
|
+
description?: string;
|
|
6593
|
+
/** Additional metadata for the resource. */
|
|
6594
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
6595
|
+
/** Timestamp of when the resource was created. */
|
|
6596
|
+
createdAt: Date;
|
|
6597
|
+
/** Timestamp of when the resource was last updated. */
|
|
6598
|
+
updatedAt: Date;
|
|
6599
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
6600
|
+
deletedAt?: Date;
|
|
6601
|
+
/** The marketplace listing that this installed app is based on. */
|
|
6602
|
+
listing: NotificationEventV1MarketplaceListing;
|
|
6603
|
+
/** Status of the app connection. */
|
|
6604
|
+
status: 'ready' | 'unauthorized';
|
|
6605
|
+
/** The app's type is Stripe. */
|
|
6606
|
+
type: 'stripe';
|
|
6607
|
+
/** The Stripe account ID. */
|
|
6608
|
+
stripeAccountId: string;
|
|
6609
|
+
/** Livemode, true if the app is in production mode. */
|
|
6610
|
+
livemode: boolean;
|
|
6611
|
+
/** The masked API key. Only shows the first 8 and last 3 characters. */
|
|
6612
|
+
maskedApiKey: string;
|
|
6613
|
+
}
|
|
6614
|
+
/**
|
|
6615
|
+
* Sandbox app can be used for testing OpenMeter features.
|
|
6616
|
+
*
|
|
6617
|
+
* The app is not creating anything in external systems, thus it is safe to use for
|
|
6618
|
+
* verifying OpenMeter features.
|
|
6619
|
+
*/
|
|
6620
|
+
export interface NotificationEventV1SandboxApp {
|
|
6621
|
+
/** A unique identifier for the resource. */
|
|
6622
|
+
id: string;
|
|
6623
|
+
/** Human-readable name for the resource. Between 1 and 256 characters. */
|
|
6624
|
+
name: string;
|
|
6625
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
6626
|
+
description?: string;
|
|
6627
|
+
/** Additional metadata for the resource. */
|
|
6628
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
6629
|
+
/** Timestamp of when the resource was created. */
|
|
6630
|
+
createdAt: Date;
|
|
6631
|
+
/** Timestamp of when the resource was last updated. */
|
|
6632
|
+
updatedAt: Date;
|
|
6633
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
6634
|
+
deletedAt?: Date;
|
|
6635
|
+
/** The marketplace listing that this installed app is based on. */
|
|
6636
|
+
listing: NotificationEventV1MarketplaceListing;
|
|
6637
|
+
/** Status of the app connection. */
|
|
6638
|
+
status: 'ready' | 'unauthorized';
|
|
6639
|
+
/** The app's type is Sandbox. */
|
|
6640
|
+
type: 'sandbox';
|
|
6641
|
+
}
|
|
6642
|
+
/**
|
|
6643
|
+
* Custom Invoicing app can be used for interface with any invoicing or payment
|
|
6644
|
+
* system.
|
|
6645
|
+
*
|
|
6646
|
+
* This app provides ways to manipulate invoices and payments, however the
|
|
6647
|
+
* integration must rely on Notifications API to get notified about invoice
|
|
6648
|
+
* changes.
|
|
6649
|
+
*/
|
|
6650
|
+
export interface NotificationEventV1CustomInvoicingApp {
|
|
6651
|
+
/** A unique identifier for the resource. */
|
|
6652
|
+
id: string;
|
|
6653
|
+
/** Human-readable name for the resource. Between 1 and 256 characters. */
|
|
5405
6654
|
name: string;
|
|
6655
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
6656
|
+
description?: string;
|
|
6657
|
+
/** Additional metadata for the resource. */
|
|
6658
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
6659
|
+
/** Timestamp of when the resource was created. */
|
|
6660
|
+
createdAt: Date;
|
|
6661
|
+
/** Timestamp of when the resource was last updated. */
|
|
6662
|
+
updatedAt: Date;
|
|
6663
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
6664
|
+
deletedAt?: Date;
|
|
6665
|
+
/** The marketplace listing that this installed app is based on. */
|
|
6666
|
+
listing: NotificationEventV1MarketplaceListing;
|
|
6667
|
+
/** Status of the app connection. */
|
|
6668
|
+
status: 'ready' | 'unauthorized';
|
|
6669
|
+
/** The app's type is CustomInvoicing. */
|
|
6670
|
+
type: 'custom_invoicing';
|
|
5406
6671
|
/**
|
|
5407
|
-
*
|
|
6672
|
+
* Enable draft.sync hook.
|
|
5408
6673
|
*
|
|
5409
|
-
*
|
|
6674
|
+
* If the hook is not enabled, the invoice will be progressed to the next state
|
|
6675
|
+
* automatically.
|
|
6676
|
+
*/
|
|
6677
|
+
enableDraftSyncHook: boolean;
|
|
6678
|
+
/**
|
|
6679
|
+
* Enable issuing.sync hook.
|
|
6680
|
+
*
|
|
6681
|
+
* If the hook is not enabled, the invoice will be progressed to the next state
|
|
6682
|
+
* automatically.
|
|
5410
6683
|
*/
|
|
6684
|
+
enableIssuingSyncHook: boolean;
|
|
6685
|
+
}
|
|
6686
|
+
/**
|
|
6687
|
+
* InvoiceLineAmountDiscount represents an amount deducted from the line, and will
|
|
6688
|
+
* be applied before taxes.
|
|
6689
|
+
*/
|
|
6690
|
+
export interface NotificationEventV1InvoiceLineAmountDiscount {
|
|
6691
|
+
/** Timestamp of when the resource was created. */
|
|
6692
|
+
createdAt: Date;
|
|
6693
|
+
/** Timestamp of when the resource was last updated. */
|
|
6694
|
+
updatedAt: Date;
|
|
6695
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
6696
|
+
deletedAt?: Date;
|
|
6697
|
+
/** ID of the charge or discount. */
|
|
6698
|
+
id: string;
|
|
6699
|
+
/** Reason code. */
|
|
6700
|
+
reason: NotificationEventV1BillingDiscountReason;
|
|
6701
|
+
/** Text description as to why the discount was applied. */
|
|
5411
6702
|
description?: string;
|
|
5412
|
-
|
|
5413
|
-
|
|
6703
|
+
/** External IDs of the invoice in other apps such as Stripe. */
|
|
6704
|
+
externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
|
|
6705
|
+
/** Fixed discount amount to apply (calculated if percent present). */
|
|
6706
|
+
amount: string;
|
|
6707
|
+
}
|
|
6708
|
+
/**
|
|
6709
|
+
* InvoiceLineUsageDiscount represents an usage-based discount applied to the line.
|
|
6710
|
+
*
|
|
6711
|
+
* The deduction is done before the pricing algorithm is applied.
|
|
6712
|
+
*/
|
|
6713
|
+
export interface NotificationEventV1InvoiceLineUsageDiscount {
|
|
6714
|
+
/** Timestamp of when the resource was created. */
|
|
5414
6715
|
createdAt: Date;
|
|
5415
|
-
/**
|
|
6716
|
+
/** Timestamp of when the resource was last updated. */
|
|
5416
6717
|
updatedAt: Date;
|
|
5417
|
-
/**
|
|
6718
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
5418
6719
|
deletedAt?: Date;
|
|
5419
|
-
/**
|
|
5420
|
-
|
|
5421
|
-
/**
|
|
5422
|
-
|
|
5423
|
-
/**
|
|
5424
|
-
|
|
5425
|
-
/**
|
|
5426
|
-
|
|
5427
|
-
/**
|
|
5428
|
-
creditsApplied?: InvoiceLineCreditsApplied[];
|
|
5429
|
-
/** External identifiers for this detailed line. */
|
|
5430
|
-
externalReferences?: InvoiceLineExternalReferences;
|
|
5431
|
-
/** The quantity of the detailed line. */
|
|
6720
|
+
/** ID of the charge or discount. */
|
|
6721
|
+
id: string;
|
|
6722
|
+
/** Reason code. */
|
|
6723
|
+
reason: NotificationEventV1BillingDiscountReason;
|
|
6724
|
+
/** Text description as to why the discount was applied. */
|
|
6725
|
+
description?: string;
|
|
6726
|
+
/** External IDs of the invoice in other apps such as Stripe. */
|
|
6727
|
+
externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
|
|
6728
|
+
/** The usage to apply. */
|
|
5432
6729
|
quantity: string;
|
|
5433
|
-
/** The unit price of the detailed line. */
|
|
5434
|
-
unitPrice: string;
|
|
5435
|
-
}
|
|
5436
|
-
/** Snapshot of the billing workflow configuration captured at invoice creation. */
|
|
5437
|
-
export interface UpdateInvoiceWorkflowSettings {
|
|
5438
6730
|
/**
|
|
5439
|
-
* The
|
|
6731
|
+
* The usage discount already applied to the previous split lines.
|
|
5440
6732
|
*
|
|
5441
|
-
* Only
|
|
5442
|
-
* invoicing behaviour (auto-advance, draft period) and payment settings
|
|
5443
|
-
* (collection method, due date). Profile-wide settings such as collection
|
|
5444
|
-
* alignment, progressive billing, and tax policy are omitted.
|
|
6733
|
+
* Only set if progressive billing is enabled and the line is a split line.
|
|
5445
6734
|
*/
|
|
5446
|
-
|
|
6735
|
+
preLinePeriodQuantity?: string;
|
|
5447
6736
|
}
|
|
5448
|
-
/**
|
|
5449
|
-
|
|
6737
|
+
/**
|
|
6738
|
+
* InvoiceDetailedLineRateCard represents the rate card (intent) for a flat fee
|
|
6739
|
+
* line.
|
|
6740
|
+
*/
|
|
6741
|
+
export interface NotificationEventV1InvoiceDetailedLineRateCard {
|
|
5450
6742
|
/**
|
|
5451
|
-
* The
|
|
5452
|
-
*
|
|
5453
|
-
* `key`s.
|
|
5454
|
-
*
|
|
5455
|
-
* Duplicate or aliased identifiers that resolve to the same customer collapse to a
|
|
5456
|
-
* single result entry, with every requested identifier listed here.
|
|
6743
|
+
* The tax config of the rate card. When undefined, the tax config of the feature
|
|
6744
|
+
* or the default tax config of the plan is used.
|
|
5457
6745
|
*/
|
|
5458
|
-
|
|
5459
|
-
/** The
|
|
5460
|
-
|
|
6746
|
+
taxConfig?: NotificationEventV1TaxConfig;
|
|
6747
|
+
/** The price of the rate card. When null, the feature or service is free. */
|
|
6748
|
+
price: NotificationEventV1FlatPriceWithPaymentTerm | null;
|
|
5461
6749
|
/**
|
|
5462
|
-
*
|
|
6750
|
+
* Quantity of the item being sold.
|
|
5463
6751
|
*
|
|
5464
|
-
*
|
|
5465
|
-
* `key` available in the organization when the feature filter was omitted.
|
|
5466
|
-
*/
|
|
5467
|
-
features: Record<string, EntitlementFeatureAccess>;
|
|
5468
|
-
/**
|
|
5469
|
-
* Timestamp of the most recent change to the customer's access state reflected in
|
|
5470
|
-
* this result.
|
|
6752
|
+
* Default: 1
|
|
5471
6753
|
*/
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
export interface NotificationEventBalanceThresholdPayload {
|
|
5476
|
-
/** The identifier of the event the payload belongs to. */
|
|
5477
|
-
id: string;
|
|
5478
|
-
/** The type of the event. */
|
|
5479
|
-
type: 'entitlements.balance.threshold';
|
|
5480
|
-
/** When the event was generated. */
|
|
5481
|
-
timestamp: Date;
|
|
5482
|
-
/** The entities and threshold the event refers to. */
|
|
5483
|
-
data: NotificationEventBalanceThresholdData;
|
|
5484
|
-
}
|
|
5485
|
-
/** An entitlement reset notification event payload. */
|
|
5486
|
-
export interface NotificationEventResetPayload {
|
|
5487
|
-
/** The identifier of the event the payload belongs to. */
|
|
5488
|
-
id: string;
|
|
5489
|
-
/** The type of the event. */
|
|
5490
|
-
type: 'entitlements.reset';
|
|
5491
|
-
/** When the event was generated. */
|
|
5492
|
-
timestamp: Date;
|
|
5493
|
-
/** The entities the event refers to. */
|
|
5494
|
-
data: NotificationEventEntitlementData;
|
|
6754
|
+
quantity?: string;
|
|
6755
|
+
/** The discounts that are applied to the line. */
|
|
6756
|
+
discounts?: NotificationEventV1BillingDiscounts;
|
|
5495
6757
|
}
|
|
5496
6758
|
/** A capability or billable dimension offered by a provider. */
|
|
5497
6759
|
export interface Feature {
|
|
@@ -5666,6 +6928,8 @@ export interface CreditGrant {
|
|
|
5666
6928
|
* fiat currency.
|
|
5667
6929
|
*/
|
|
5668
6930
|
currency: BillingCurrencyCode;
|
|
6931
|
+
/** Managed currency reference. Present only for custom currencies. */
|
|
6932
|
+
customCurrency?: CurrencyCustomReference;
|
|
5669
6933
|
/** Granted credit amount. */
|
|
5670
6934
|
amount: string;
|
|
5671
6935
|
/** Present when a funding workflow applies (funding_method is not `none`). */
|
|
@@ -5908,6 +7172,73 @@ export interface NotificationRulePagePaginatedResponse {
|
|
|
5908
7172
|
data: NotificationRule[];
|
|
5909
7173
|
meta: PaginatedMeta;
|
|
5910
7174
|
}
|
|
7175
|
+
/**
|
|
7176
|
+
* Represents a feature that can be enabled or disabled for a plan. Used both for
|
|
7177
|
+
* product catalog and entitlements.
|
|
7178
|
+
*/
|
|
7179
|
+
export interface NotificationEventV1Feature {
|
|
7180
|
+
/** Timestamp of when the resource was created. */
|
|
7181
|
+
createdAt: Date;
|
|
7182
|
+
/** Timestamp of when the resource was last updated. */
|
|
7183
|
+
updatedAt: Date;
|
|
7184
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
7185
|
+
deletedAt?: Date;
|
|
7186
|
+
/** Timestamp of when the resource was archived. */
|
|
7187
|
+
archivedAt?: Date;
|
|
7188
|
+
/** A key is a unique string that is used to identify a resource. */
|
|
7189
|
+
key: string;
|
|
7190
|
+
/** The human-readable name of the feature. */
|
|
7191
|
+
name: string;
|
|
7192
|
+
/** Optional metadata. */
|
|
7193
|
+
metadata?: NotificationEventV1Metadata;
|
|
7194
|
+
/** A key is a unique string that is used to identify a resource. */
|
|
7195
|
+
meterSlug?: string;
|
|
7196
|
+
/**
|
|
7197
|
+
* Optional meter group by filters. Useful if the meter scope is broader than what
|
|
7198
|
+
* feature tracks. Example scenario would be a meter tracking all token use with
|
|
7199
|
+
* groupBy fields for the model, then the feature could filter for model=gpt-4.
|
|
7200
|
+
*
|
|
7201
|
+
* ⚠️ **Deprecated**: Use advancedMeterGroupByFilters instead
|
|
7202
|
+
*/
|
|
7203
|
+
meterGroupByFilters?: Record<string, string>;
|
|
7204
|
+
/**
|
|
7205
|
+
* Optional advanced meter group by filters. You can use this to filter for values
|
|
7206
|
+
* of the meter groupBy fields.
|
|
7207
|
+
*/
|
|
7208
|
+
advancedMeterGroupByFilters?: Record<string, NotificationEventV1FilterString>;
|
|
7209
|
+
/**
|
|
7210
|
+
* Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or
|
|
7211
|
+
* "llm" to look up cost from the LLM cost database based on meter group-by
|
|
7212
|
+
* properties.
|
|
7213
|
+
*/
|
|
7214
|
+
unitCost?: NotificationEventV1FeatureUnitCost;
|
|
7215
|
+
/** Readonly unique ULID identifier. */
|
|
7216
|
+
id: string;
|
|
7217
|
+
}
|
|
7218
|
+
/**
|
|
7219
|
+
* InvoiceLineDiscounts represents the discounts applied to the invoice line by
|
|
7220
|
+
* type.
|
|
7221
|
+
*/
|
|
7222
|
+
export interface NotificationEventV1InvoiceLineDiscounts {
|
|
7223
|
+
/**
|
|
7224
|
+
* Amount based discounts applied to the line.
|
|
7225
|
+
*
|
|
7226
|
+
* Amount based discounts are deduced from the total price of the line.
|
|
7227
|
+
*/
|
|
7228
|
+
amount?: NotificationEventV1InvoiceLineAmountDiscount[];
|
|
7229
|
+
/**
|
|
7230
|
+
* Usage based discounts applied to the line.
|
|
7231
|
+
*
|
|
7232
|
+
* Usage based discounts are deduced from the usage of the line before price
|
|
7233
|
+
* calculations are applied.
|
|
7234
|
+
*/
|
|
7235
|
+
usage?: NotificationEventV1InvoiceLineUsageDiscount[];
|
|
7236
|
+
}
|
|
7237
|
+
/** Payment contains details as to how the invoice should be paid. */
|
|
7238
|
+
export interface NotificationEventV1InvoicePaymentTerms {
|
|
7239
|
+
/** The terms of payment for the invoice. */
|
|
7240
|
+
terms?: NotificationEventV1PaymentTerms;
|
|
7241
|
+
}
|
|
5911
7242
|
/** A rate card defines the pricing and entitlement of a feature or service. */
|
|
5912
7243
|
export interface RateCard {
|
|
5913
7244
|
/**
|
|
@@ -6151,23 +7482,193 @@ export interface ProfileApps {
|
|
|
6151
7482
|
payment: App;
|
|
6152
7483
|
}
|
|
6153
7484
|
/**
|
|
6154
|
-
*
|
|
6155
|
-
*
|
|
6156
|
-
* system and cannot be modified.
|
|
7485
|
+
* Workflow collection specifies how to collect the pending line items for an
|
|
7486
|
+
* invoice
|
|
6157
7487
|
*/
|
|
6158
|
-
export interface
|
|
6159
|
-
/** The
|
|
6160
|
-
|
|
6161
|
-
/**
|
|
6162
|
-
|
|
6163
|
-
|
|
7488
|
+
export interface NotificationEventV1BillingWorkflowCollectionSettings {
|
|
7489
|
+
/** The alignment for collecting the pending line items into an invoice. */
|
|
7490
|
+
alignment?: NotificationEventV1BillingWorkflowCollectionAlignment;
|
|
7491
|
+
/**
|
|
7492
|
+
* This grace period can be used to delay the collection of the pending line items
|
|
7493
|
+
* specified in alignment.
|
|
7494
|
+
*
|
|
7495
|
+
* This is useful, in case of multiple subscriptions having slightly different
|
|
7496
|
+
* billing periods.
|
|
7497
|
+
*/
|
|
7498
|
+
interval?: string;
|
|
7499
|
+
}
|
|
7500
|
+
/**
|
|
7501
|
+
* Payload of `v1.entitlement.balance_threshold.triggered`, the legacy
|
|
7502
|
+
* `entitlements.balance.threshold` Event type.
|
|
7503
|
+
*/
|
|
7504
|
+
export interface EntitlementBalanceThresholdTriggeredV1Payload {
|
|
7505
|
+
/** Entitlement. */
|
|
7506
|
+
entitlement: NotificationEventV1EntitlementMetered;
|
|
7507
|
+
/** Feature. */
|
|
7508
|
+
feature: NotificationEventV1Feature;
|
|
7509
|
+
/** Subject. */
|
|
7510
|
+
subject: NotificationEventV1Subject;
|
|
7511
|
+
/** Entitlement Value. */
|
|
7512
|
+
value: NotificationEventV1EntitlementValue;
|
|
7513
|
+
/** Customer. */
|
|
7514
|
+
customer?: NotificationEventV1Customer;
|
|
7515
|
+
/** Threshold. */
|
|
7516
|
+
threshold: NotificationEventV1RuleBalanceThresholdValue;
|
|
7517
|
+
}
|
|
7518
|
+
/**
|
|
7519
|
+
* Payload of `v1.entitlement.usage_period.reset`, the legacy `entitlements.reset`
|
|
7520
|
+
* Event type.
|
|
7521
|
+
*/
|
|
7522
|
+
export interface EntitlementUsagePeriodResetV1Payload {
|
|
7523
|
+
/** Entitlement. */
|
|
7524
|
+
entitlement: NotificationEventV1EntitlementMetered;
|
|
7525
|
+
/** Feature. */
|
|
7526
|
+
feature: NotificationEventV1Feature;
|
|
7527
|
+
/** Subject. */
|
|
7528
|
+
subject: NotificationEventV1Subject;
|
|
7529
|
+
/** Entitlement Value. */
|
|
7530
|
+
value: NotificationEventV1EntitlementValue;
|
|
7531
|
+
/** Customer. */
|
|
7532
|
+
customer?: NotificationEventV1Customer;
|
|
7533
|
+
}
|
|
7534
|
+
/**
|
|
7535
|
+
* Data of the payload for notification event with `entitlements.balance.threshold`
|
|
7536
|
+
* type.
|
|
7537
|
+
*/
|
|
7538
|
+
export interface NotificationEventV1BalanceThresholdPayloadData {
|
|
7539
|
+
/** Entitlement. */
|
|
7540
|
+
entitlement: NotificationEventV1EntitlementMetered;
|
|
7541
|
+
/** Feature. */
|
|
7542
|
+
feature: NotificationEventV1Feature;
|
|
7543
|
+
/** Subject. */
|
|
7544
|
+
subject: NotificationEventV1Subject;
|
|
7545
|
+
/** Entitlement Value. */
|
|
7546
|
+
value: NotificationEventV1EntitlementValue;
|
|
7547
|
+
/** Customer. */
|
|
7548
|
+
customer?: NotificationEventV1Customer;
|
|
7549
|
+
/** Threshold. */
|
|
7550
|
+
threshold: NotificationEventV1RuleBalanceThresholdValue;
|
|
7551
|
+
}
|
|
7552
|
+
/** Base data for any payload with entitlement entitlement value. */
|
|
7553
|
+
export interface NotificationEventV1EntitlementValuePayloadBase {
|
|
7554
|
+
/** Entitlement. */
|
|
7555
|
+
entitlement: NotificationEventV1EntitlementMetered;
|
|
7556
|
+
/** Feature. */
|
|
7557
|
+
feature: NotificationEventV1Feature;
|
|
7558
|
+
/** Subject. */
|
|
7559
|
+
subject: NotificationEventV1Subject;
|
|
7560
|
+
/** Entitlement Value. */
|
|
7561
|
+
value: NotificationEventV1EntitlementValue;
|
|
7562
|
+
/** Customer. */
|
|
7563
|
+
customer?: NotificationEventV1Customer;
|
|
7564
|
+
}
|
|
7565
|
+
/**
|
|
7566
|
+
* InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based
|
|
7567
|
+
* line.
|
|
7568
|
+
*/
|
|
7569
|
+
export interface NotificationEventV1InvoiceUsageBasedRateCard {
|
|
7570
|
+
/** The feature the customer is entitled to use. */
|
|
7571
|
+
featureKey?: string;
|
|
7572
|
+
/**
|
|
7573
|
+
* The tax config of the rate card. When undefined, the tax config of the feature
|
|
7574
|
+
* or the default tax config of the plan is used.
|
|
7575
|
+
*/
|
|
7576
|
+
taxConfig?: NotificationEventV1TaxConfig;
|
|
7577
|
+
/** The price of the rate card. When null, the feature or service is free. */
|
|
7578
|
+
price: NotificationEventV1RateCardUsageBasedPrice | null;
|
|
7579
|
+
/** The discounts that are applied to the line. */
|
|
7580
|
+
discounts?: NotificationEventV1BillingDiscounts;
|
|
7581
|
+
}
|
|
7582
|
+
/** BillingProfileApps represents the applications used by a billing profile */
|
|
7583
|
+
export interface NotificationEventV1BillingProfileApps {
|
|
7584
|
+
/** The tax app used for this workflow */
|
|
7585
|
+
tax: NotificationEventV1App | null;
|
|
7586
|
+
/** The invoicing app used for this workflow */
|
|
7587
|
+
invoicing: NotificationEventV1App | null;
|
|
7588
|
+
/** The payment app used for this workflow */
|
|
7589
|
+
payment: NotificationEventV1App | null;
|
|
7590
|
+
}
|
|
7591
|
+
/**
|
|
7592
|
+
* InvoiceDetailedLine represents a line item that is sold to the customer as a
|
|
7593
|
+
* manually added fee.
|
|
7594
|
+
*/
|
|
7595
|
+
export interface NotificationEventV1InvoiceDetailedLine {
|
|
7596
|
+
/** Human-readable name for the resource. Between 1 and 256 characters. */
|
|
7597
|
+
name: string;
|
|
7598
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
7599
|
+
description?: string;
|
|
7600
|
+
/** Additional metadata for the resource. */
|
|
7601
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
7602
|
+
/** Timestamp of when the resource was created. */
|
|
6164
7603
|
createdAt: Date;
|
|
6165
|
-
/**
|
|
6166
|
-
|
|
6167
|
-
/**
|
|
6168
|
-
|
|
6169
|
-
/**
|
|
6170
|
-
|
|
7604
|
+
/** Timestamp of when the resource was last updated. */
|
|
7605
|
+
updatedAt: Date;
|
|
7606
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
7607
|
+
deletedAt?: Date;
|
|
7608
|
+
/** ID of the line. */
|
|
7609
|
+
id: string;
|
|
7610
|
+
/**
|
|
7611
|
+
* managedBy specifies if the line is manually added via the api or managed by
|
|
7612
|
+
* OpenMeter.
|
|
7613
|
+
*/
|
|
7614
|
+
managedBy: 'subscription' | 'system' | 'manual';
|
|
7615
|
+
/**
|
|
7616
|
+
* Status of the line.
|
|
7617
|
+
*
|
|
7618
|
+
* External calls always create valid lines, other line types are managed by the
|
|
7619
|
+
* billing engine of OpenMeter.
|
|
7620
|
+
*/
|
|
7621
|
+
status: 'valid' | 'detailed' | 'split';
|
|
7622
|
+
/**
|
|
7623
|
+
* Discounts detailes applied to this line.
|
|
7624
|
+
*
|
|
7625
|
+
* New discounts can be added via the invoice's discounts API, to facilitate
|
|
7626
|
+
* discounts that are affecting multiple lines.
|
|
7627
|
+
*/
|
|
7628
|
+
discounts?: NotificationEventV1InvoiceLineDiscounts;
|
|
7629
|
+
/**
|
|
7630
|
+
* Credit allocations applied to this line.
|
|
7631
|
+
*
|
|
7632
|
+
* Credits are deducted from the line total before taxes are applied.
|
|
7633
|
+
*/
|
|
7634
|
+
creditAllocations?: NotificationEventV1InvoiceLineCreditAllocation[];
|
|
7635
|
+
/** The invoice this item belongs to. */
|
|
7636
|
+
invoice?: NotificationEventV1InvoiceReference;
|
|
7637
|
+
/** The currency of this line. */
|
|
7638
|
+
currency: string;
|
|
7639
|
+
/** Taxes applied to the invoice totals. */
|
|
7640
|
+
taxes?: NotificationEventV1InvoiceLineTaxItem[];
|
|
7641
|
+
/** Tax config specify the tax configuration for this line. */
|
|
7642
|
+
taxConfig?: NotificationEventV1TaxConfig;
|
|
7643
|
+
/** Totals for this line. */
|
|
7644
|
+
totals: NotificationEventV1InvoiceTotals;
|
|
7645
|
+
/**
|
|
7646
|
+
* Period of the line item applies to for revenue recognition pruposes.
|
|
7647
|
+
*
|
|
7648
|
+
* Billing always treats periods as start being inclusive and end being exclusive.
|
|
7649
|
+
*/
|
|
7650
|
+
period: NotificationEventV1Period;
|
|
7651
|
+
/** External IDs of the invoice in other apps such as Stripe. */
|
|
7652
|
+
externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
|
|
7653
|
+
/**
|
|
7654
|
+
* Subscription are the references to the subscritpions that this line is related
|
|
7655
|
+
* to.
|
|
7656
|
+
*/
|
|
7657
|
+
subscription?: NotificationEventV1InvoiceLineSubscriptionReference;
|
|
7658
|
+
/** The time this line item should be invoiced. */
|
|
7659
|
+
invoiceAt: Date;
|
|
7660
|
+
/** Type of the line. */
|
|
7661
|
+
type: 'flat_fee';
|
|
7662
|
+
/** Price of the item being sold. */
|
|
7663
|
+
perUnitAmount?: string;
|
|
7664
|
+
/** Payment term of the line. */
|
|
7665
|
+
paymentTerm?: 'in_advance' | 'in_arrears';
|
|
7666
|
+
/** Quantity of the item being sold. */
|
|
7667
|
+
quantity?: string;
|
|
7668
|
+
/** The rate card that is used for this line. */
|
|
7669
|
+
rateCard?: NotificationEventV1InvoiceDetailedLineRateCard;
|
|
7670
|
+
/** Category of the flat fee. */
|
|
7671
|
+
category?: 'regular' | 'commitment';
|
|
6171
7672
|
}
|
|
6172
7673
|
/** A subscription item pins a rate card to a cadence within a subscription phase. */
|
|
6173
7674
|
export interface SubscriptionItem {
|
|
@@ -6559,57 +8060,198 @@ export interface UpsertBillingProfileRequest {
|
|
|
6559
8060
|
*/
|
|
6560
8061
|
export interface ChargeRealization {
|
|
6561
8062
|
/**
|
|
6562
|
-
* The ID of the realization run. Not present on `outstanding` entries, which are
|
|
6563
|
-
* projections rather than persisted runs.
|
|
8063
|
+
* The ID of the realization run. Not present on `outstanding` entries, which are
|
|
8064
|
+
* projections rather than persisted runs.
|
|
8065
|
+
*/
|
|
8066
|
+
id?: string;
|
|
8067
|
+
/**
|
|
8068
|
+
* The ID of the invoice line this realization was booked to, when the realization
|
|
8069
|
+
* has been invoiced.
|
|
8070
|
+
*/
|
|
8071
|
+
lineId?: string;
|
|
8072
|
+
/** The reference of the invoice related to the realization. */
|
|
8073
|
+
invoice?: ChargeRealizationInvoiceOrReference;
|
|
8074
|
+
/** The type of the realization run. */
|
|
8075
|
+
type: 'final_realization' | 'partial_invoice' | 'outstanding' | 'voided';
|
|
8076
|
+
/** The service period covered by this realization run. */
|
|
8077
|
+
servicePeriod: ClosedPeriod;
|
|
8078
|
+
/**
|
|
8079
|
+
* The metered usage quantity this realization run accounts for. Only present on
|
|
8080
|
+
* usage-based charges; flat fees are not metered, so their realizations carry no
|
|
8081
|
+
* usage.
|
|
8082
|
+
*
|
|
8083
|
+
* Booked entries report a signed delta: a negative value states a downward usage
|
|
8084
|
+
* correction (or a voided run that snapshotted behind its live neighbors) instead
|
|
8085
|
+
* of masking it as zero.
|
|
8086
|
+
*
|
|
8087
|
+
* On an `outstanding` entry, usage is omitted unless `real_time_usage` supplies a
|
|
8088
|
+
* live reading. When present, it is the unbooked remainder of that reading,
|
|
8089
|
+
* floored at zero.
|
|
8090
|
+
*/
|
|
8091
|
+
usage?: string;
|
|
8092
|
+
/**
|
|
8093
|
+
* The payment state of the realization, when the charge requires a fiat
|
|
8094
|
+
* transaction to settle.
|
|
8095
|
+
*/
|
|
8096
|
+
payment?: ChargeRealizationPayment;
|
|
8097
|
+
/**
|
|
8098
|
+
* Financial totals for the realization run, including credit allocations.
|
|
8099
|
+
*
|
|
8100
|
+
* Requires the `realization.totals` expand.
|
|
8101
|
+
*/
|
|
8102
|
+
totals?: Totals;
|
|
8103
|
+
/**
|
|
8104
|
+
* The detailed (rated) lines produced by the realization run.
|
|
8105
|
+
*
|
|
8106
|
+
* Requires the `realization.detailed_lines` expand.
|
|
8107
|
+
*/
|
|
8108
|
+
detailedLines?: ChargeRealizationDetailedLine[];
|
|
8109
|
+
}
|
|
8110
|
+
/** BillingWorkflow represents the settings for a billing workflow. */
|
|
8111
|
+
export interface NotificationEventV1BillingWorkflow {
|
|
8112
|
+
/** The collection settings for this workflow */
|
|
8113
|
+
collection?: NotificationEventV1BillingWorkflowCollectionSettings;
|
|
8114
|
+
/** The invoicing settings for this workflow */
|
|
8115
|
+
invoicing?: NotificationEventV1BillingWorkflowInvoicingSettings;
|
|
8116
|
+
/** The payment settings for this workflow */
|
|
8117
|
+
payment?: NotificationEventV1BillingWorkflowPaymentSettings;
|
|
8118
|
+
/** The tax settings for this workflow */
|
|
8119
|
+
tax?: NotificationEventV1BillingWorkflowTaxSettings;
|
|
8120
|
+
}
|
|
8121
|
+
/** A balance threshold notification event payload. */
|
|
8122
|
+
export interface NotificationEventBalanceThresholdPayload {
|
|
8123
|
+
/** The identifier of the event the payload belongs to. */
|
|
8124
|
+
id: string;
|
|
8125
|
+
/** The type of the event. */
|
|
8126
|
+
type: 'entitlements.balance.threshold';
|
|
8127
|
+
/** When the event was generated. */
|
|
8128
|
+
timestamp: Date;
|
|
8129
|
+
/** The entities and threshold the event refers to. */
|
|
8130
|
+
data: EntitlementBalanceThresholdTriggeredV1Payload;
|
|
8131
|
+
}
|
|
8132
|
+
/** An entitlement reset notification event payload. */
|
|
8133
|
+
export interface NotificationEventResetPayload {
|
|
8134
|
+
/** The identifier of the event the payload belongs to. */
|
|
8135
|
+
id: string;
|
|
8136
|
+
/** The type of the event. */
|
|
8137
|
+
type: 'entitlements.reset';
|
|
8138
|
+
/** When the event was generated. */
|
|
8139
|
+
timestamp: Date;
|
|
8140
|
+
/** The entities the event refers to. */
|
|
8141
|
+
data: EntitlementUsagePeriodResetV1Payload;
|
|
8142
|
+
}
|
|
8143
|
+
/**
|
|
8144
|
+
* InvoiceUsageBasedLine represents a line item that is sold to the customer based
|
|
8145
|
+
* on usage.
|
|
8146
|
+
*/
|
|
8147
|
+
export interface NotificationEventV1InvoiceLine {
|
|
8148
|
+
/** Human-readable name for the resource. Between 1 and 256 characters. */
|
|
8149
|
+
name: string;
|
|
8150
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
8151
|
+
description?: string;
|
|
8152
|
+
/** Additional metadata for the resource. */
|
|
8153
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
8154
|
+
/** Timestamp of when the resource was created. */
|
|
8155
|
+
createdAt: Date;
|
|
8156
|
+
/** Timestamp of when the resource was last updated. */
|
|
8157
|
+
updatedAt: Date;
|
|
8158
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
8159
|
+
deletedAt?: Date;
|
|
8160
|
+
/** ID of the line. */
|
|
8161
|
+
id: string;
|
|
8162
|
+
/**
|
|
8163
|
+
* managedBy specifies if the line is manually added via the api or managed by
|
|
8164
|
+
* OpenMeter.
|
|
8165
|
+
*/
|
|
8166
|
+
managedBy: 'subscription' | 'system' | 'manual';
|
|
8167
|
+
/**
|
|
8168
|
+
* Status of the line.
|
|
8169
|
+
*
|
|
8170
|
+
* External calls always create valid lines, other line types are managed by the
|
|
8171
|
+
* billing engine of OpenMeter.
|
|
8172
|
+
*/
|
|
8173
|
+
status: 'valid' | 'detailed' | 'split';
|
|
8174
|
+
/**
|
|
8175
|
+
* Discounts detailes applied to this line.
|
|
8176
|
+
*
|
|
8177
|
+
* New discounts can be added via the invoice's discounts API, to facilitate
|
|
8178
|
+
* discounts that are affecting multiple lines.
|
|
8179
|
+
*/
|
|
8180
|
+
discounts?: NotificationEventV1InvoiceLineDiscounts;
|
|
8181
|
+
/**
|
|
8182
|
+
* Credit allocations applied to this line.
|
|
8183
|
+
*
|
|
8184
|
+
* Credits are deducted from the line total before taxes are applied.
|
|
6564
8185
|
*/
|
|
6565
|
-
|
|
8186
|
+
creditAllocations?: NotificationEventV1InvoiceLineCreditAllocation[];
|
|
8187
|
+
/** The invoice this item belongs to. */
|
|
8188
|
+
invoice?: NotificationEventV1InvoiceReference;
|
|
8189
|
+
/** The currency of this line. */
|
|
8190
|
+
currency: string;
|
|
8191
|
+
/** Taxes applied to the invoice totals. */
|
|
8192
|
+
taxes?: NotificationEventV1InvoiceLineTaxItem[];
|
|
8193
|
+
/** Tax config specify the tax configuration for this line. */
|
|
8194
|
+
taxConfig?: NotificationEventV1TaxConfig;
|
|
8195
|
+
/** Totals for this line. */
|
|
8196
|
+
totals: NotificationEventV1InvoiceTotals;
|
|
6566
8197
|
/**
|
|
6567
|
-
*
|
|
6568
|
-
*
|
|
8198
|
+
* Period of the line item applies to for revenue recognition pruposes.
|
|
8199
|
+
*
|
|
8200
|
+
* Billing always treats periods as start being inclusive and end being exclusive.
|
|
6569
8201
|
*/
|
|
6570
|
-
|
|
6571
|
-
/** The
|
|
6572
|
-
|
|
6573
|
-
/**
|
|
6574
|
-
|
|
6575
|
-
/** The service period covered by this realization run. */
|
|
6576
|
-
servicePeriod: ClosedPeriod;
|
|
8202
|
+
period: NotificationEventV1Period;
|
|
8203
|
+
/** The time this line item should be invoiced. */
|
|
8204
|
+
invoiceAt: Date;
|
|
8205
|
+
/** External IDs of the invoice in other apps such as Stripe. */
|
|
8206
|
+
externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
|
|
6577
8207
|
/**
|
|
6578
|
-
*
|
|
6579
|
-
*
|
|
6580
|
-
|
|
8208
|
+
* Subscription are the references to the subscritpions that this line is related
|
|
8209
|
+
* to.
|
|
8210
|
+
*/
|
|
8211
|
+
subscription?: NotificationEventV1InvoiceLineSubscriptionReference;
|
|
8212
|
+
/** Type of the line. */
|
|
8213
|
+
type: 'usage_based';
|
|
8214
|
+
/** Price of the usage-based item being sold. */
|
|
8215
|
+
price?: NotificationEventV1RateCardUsageBasedPrice;
|
|
8216
|
+
/** The feature that the usage is based on. */
|
|
8217
|
+
featureKey?: string;
|
|
8218
|
+
/** The lines detailing the item or service sold. */
|
|
8219
|
+
children?: NotificationEventV1InvoiceDetailedLine[];
|
|
8220
|
+
/**
|
|
8221
|
+
* The rate card that is used for this line.
|
|
6581
8222
|
*
|
|
6582
|
-
*
|
|
6583
|
-
*
|
|
6584
|
-
|
|
8223
|
+
* The rate card captures the intent of the price and discounts for the usage-based
|
|
8224
|
+
* item.
|
|
8225
|
+
*/
|
|
8226
|
+
rateCard?: NotificationEventV1InvoiceUsageBasedRateCard;
|
|
8227
|
+
/**
|
|
8228
|
+
* The quantity of the item being sold.
|
|
6585
8229
|
*
|
|
6586
|
-
*
|
|
6587
|
-
* applied, in which case it is the not-yet-booked remainder of the live metering
|
|
6588
|
-
* read (never negative).
|
|
8230
|
+
* Any usage discounts applied previously are deducted from this quantity.
|
|
6589
8231
|
*/
|
|
6590
|
-
|
|
8232
|
+
quantity?: string;
|
|
6591
8233
|
/**
|
|
6592
|
-
* The
|
|
6593
|
-
*
|
|
8234
|
+
* The quantity of the item that has been metered for the period before any
|
|
8235
|
+
* discounts were applied.
|
|
6594
8236
|
*/
|
|
6595
|
-
|
|
8237
|
+
meteredQuantity?: string;
|
|
6596
8238
|
/**
|
|
6597
|
-
*
|
|
8239
|
+
* The quantity of the item used before this line's period.
|
|
6598
8240
|
*
|
|
6599
|
-
*
|
|
8241
|
+
* It is non-zero in case of progressive billing, when this shows how much of the
|
|
8242
|
+
* usage was already billed.
|
|
8243
|
+
*
|
|
8244
|
+
* Any usage discounts applied previously are deducted from this quantity.
|
|
6600
8245
|
*/
|
|
6601
|
-
|
|
8246
|
+
preLinePeriodQuantity?: string;
|
|
6602
8247
|
/**
|
|
6603
|
-
* The
|
|
8248
|
+
* The metered quantity of the item used in before this line's period without any
|
|
8249
|
+
* discounts applied.
|
|
6604
8250
|
*
|
|
6605
|
-
*
|
|
8251
|
+
* It is non-zero in case of progressive billing, when this shows how much of the
|
|
8252
|
+
* usage was already billed.
|
|
6606
8253
|
*/
|
|
6607
|
-
|
|
6608
|
-
}
|
|
6609
|
-
/** Page paginated response. */
|
|
6610
|
-
export interface NotificationEventPagePaginatedResponse {
|
|
6611
|
-
data: NotificationEvent[];
|
|
6612
|
-
meta: PaginatedMeta;
|
|
8254
|
+
meteredPreLinePeriodQuantity?: string;
|
|
6613
8255
|
}
|
|
6614
8256
|
/**
|
|
6615
8257
|
* A subscription phase groups the rate cards in effect for a segment of the
|
|
@@ -6886,6 +8528,31 @@ export interface ProfilePagePaginatedResponse {
|
|
|
6886
8528
|
data: Profile[];
|
|
6887
8529
|
meta: PaginatedMeta;
|
|
6888
8530
|
}
|
|
8531
|
+
/**
|
|
8532
|
+
* InvoiceWorkflowSettings represents the workflow settings used by the invoice.
|
|
8533
|
+
*
|
|
8534
|
+
* This is a clone of the billing profile's workflow settings at the time of
|
|
8535
|
+
* invoice creation with customer overrides considered.
|
|
8536
|
+
*/
|
|
8537
|
+
export interface NotificationEventV1InvoiceWorkflowSettings {
|
|
8538
|
+
/**
|
|
8539
|
+
* The apps that will be used to orchestrate the invoice's workflow.
|
|
8540
|
+
*
|
|
8541
|
+
* The v1 schema allows app references here too, but the v1 Event payloads always
|
|
8542
|
+
* carry the full apps.
|
|
8543
|
+
*/
|
|
8544
|
+
apps?: NotificationEventV1BillingProfileApps;
|
|
8545
|
+
/**
|
|
8546
|
+
* sourceBillingProfileID is the billing profile on which the workflow was based
|
|
8547
|
+
* on.
|
|
8548
|
+
*
|
|
8549
|
+
* The profile is snapshotted on invoice creation, after which it can be altered
|
|
8550
|
+
* independently of the profile itself.
|
|
8551
|
+
*/
|
|
8552
|
+
sourceBillingProfileId: string;
|
|
8553
|
+
/** The workflow details used by this invoice. */
|
|
8554
|
+
workflow: NotificationEventV1BillingWorkflow;
|
|
8555
|
+
}
|
|
6889
8556
|
/** Subscription. */
|
|
6890
8557
|
export interface Subscription {
|
|
6891
8558
|
id: string;
|
|
@@ -7241,6 +8908,366 @@ export interface UpdateInvoiceStandardRequest {
|
|
|
7241
8908
|
*/
|
|
7242
8909
|
lines?: UpdateInvoiceLine[];
|
|
7243
8910
|
}
|
|
8911
|
+
/**
|
|
8912
|
+
* Payload of `v1.billing.invoice.created`, the legacy `invoice.created` Event
|
|
8913
|
+
* type: the invoice as it was created.
|
|
8914
|
+
*/
|
|
8915
|
+
export interface InvoiceCreatedV1Payload {
|
|
8916
|
+
/** A unique identifier for the resource. */
|
|
8917
|
+
id: string;
|
|
8918
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
8919
|
+
description?: string;
|
|
8920
|
+
/** Additional metadata for the resource. */
|
|
8921
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
8922
|
+
/** Timestamp of when the resource was created. */
|
|
8923
|
+
createdAt: Date;
|
|
8924
|
+
/** Timestamp of when the resource was last updated. */
|
|
8925
|
+
updatedAt: Date;
|
|
8926
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
8927
|
+
deletedAt?: Date;
|
|
8928
|
+
/**
|
|
8929
|
+
* Type of the invoice.
|
|
8930
|
+
*
|
|
8931
|
+
* The type of invoice determines the purpose of the invoice and how it should be
|
|
8932
|
+
* handled.
|
|
8933
|
+
*
|
|
8934
|
+
* Supported types:
|
|
8935
|
+
*
|
|
8936
|
+
* - standard: A regular commercial invoice document between a supplier and
|
|
8937
|
+
* customer.
|
|
8938
|
+
* - credit_note: Reflects a refund either partial or complete of the preceding
|
|
8939
|
+
* document. A credit note effectively _extends_ the previous document.
|
|
8940
|
+
*/
|
|
8941
|
+
type: 'standard' | 'credit_note';
|
|
8942
|
+
/** The taxable entity supplying the goods or services. */
|
|
8943
|
+
supplier: NotificationEventV1BillingParty;
|
|
8944
|
+
/** Legal entity receiving the goods or services. */
|
|
8945
|
+
customer: NotificationEventV1BillingInvoiceCustomerExtendedDetails;
|
|
8946
|
+
/**
|
|
8947
|
+
* Number specifies the human readable key used to reference this Invoice.
|
|
8948
|
+
*
|
|
8949
|
+
* The invoice number can change in the draft phases, as we are allocating
|
|
8950
|
+
* temporary draft invoice numbers, but it's final as soon as the invoice gets
|
|
8951
|
+
* finalized (issued state).
|
|
8952
|
+
*
|
|
8953
|
+
* Please note that the number is (depending on the upstream settings) either
|
|
8954
|
+
* unique for the whole organization or unique for the customer, or in multi
|
|
8955
|
+
* (stripe) account setups unique for the account.
|
|
8956
|
+
*/
|
|
8957
|
+
number: string;
|
|
8958
|
+
/**
|
|
8959
|
+
* Currency for all invoice line items.
|
|
8960
|
+
*
|
|
8961
|
+
* Multi currency invoices are not supported yet.
|
|
8962
|
+
*/
|
|
8963
|
+
currency: string;
|
|
8964
|
+
/**
|
|
8965
|
+
* Key information regarding previous invoices and potentially details as to why
|
|
8966
|
+
* they were corrected.
|
|
8967
|
+
*/
|
|
8968
|
+
preceding?: NotificationEventV1InvoiceDocumentRef[];
|
|
8969
|
+
/** Summary of all the invoice totals, including taxes (calculated). */
|
|
8970
|
+
totals: NotificationEventV1InvoiceTotals;
|
|
8971
|
+
/**
|
|
8972
|
+
* The status of the invoice.
|
|
8973
|
+
*
|
|
8974
|
+
* This field only conatins a simplified status, for more detailed information use
|
|
8975
|
+
* the statusDetails field.
|
|
8976
|
+
*/
|
|
8977
|
+
status: 'gathering' | 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
|
|
8978
|
+
/** The details of the current invoice status. */
|
|
8979
|
+
statusDetails: NotificationEventV1InvoiceStatusDetails;
|
|
8980
|
+
/**
|
|
8981
|
+
* The time the invoice was issued.
|
|
8982
|
+
*
|
|
8983
|
+
* Depending on the status of the invoice this can mean multiple things:
|
|
8984
|
+
*
|
|
8985
|
+
* - draft, gathering: The time the invoice will be issued based on the workflow
|
|
8986
|
+
* settings.
|
|
8987
|
+
* - issued: The time the invoice was issued.
|
|
8988
|
+
*/
|
|
8989
|
+
issuedAt?: Date;
|
|
8990
|
+
/**
|
|
8991
|
+
* The time until the invoice is in draft status.
|
|
8992
|
+
*
|
|
8993
|
+
* On draft invoice creation it is calculated from the workflow settings.
|
|
8994
|
+
*
|
|
8995
|
+
* If manual approval is required, the draftUntil time is set.
|
|
8996
|
+
*/
|
|
8997
|
+
draftUntil?: Date;
|
|
8998
|
+
/** The time when the quantity snapshots on the invoice lines were taken. */
|
|
8999
|
+
quantitySnapshotedAt?: Date;
|
|
9000
|
+
/** The time when the invoice will be/has been collected. */
|
|
9001
|
+
collectionAt?: Date;
|
|
9002
|
+
/** Due time of the fulfillment of the invoice (if available). */
|
|
9003
|
+
dueAt?: Date;
|
|
9004
|
+
/** The period the invoice covers. If the invoice has no line items, it's not set. */
|
|
9005
|
+
period?: NotificationEventV1Period;
|
|
9006
|
+
/**
|
|
9007
|
+
* The time the invoice was voided.
|
|
9008
|
+
*
|
|
9009
|
+
* If the invoice was voided, this field will be set to the time the invoice was
|
|
9010
|
+
* voided.
|
|
9011
|
+
*/
|
|
9012
|
+
voidedAt?: Date;
|
|
9013
|
+
/** The time the invoice was sent to customer. */
|
|
9014
|
+
sentToCustomerAt?: Date;
|
|
9015
|
+
/**
|
|
9016
|
+
* The workflow associated with the invoice.
|
|
9017
|
+
*
|
|
9018
|
+
* It is always a snapshot of the workflow settings at the time of invoice
|
|
9019
|
+
* creation. The field is optional as it should be explicitly requested with expand
|
|
9020
|
+
* options.
|
|
9021
|
+
*/
|
|
9022
|
+
workflow: NotificationEventV1InvoiceWorkflowSettings;
|
|
9023
|
+
/** List of invoice lines representing each of the items sold to the customer. */
|
|
9024
|
+
lines?: NotificationEventV1InvoiceLine[];
|
|
9025
|
+
/** Information on when, how, and to whom the invoice should be paid. */
|
|
9026
|
+
payment?: NotificationEventV1InvoicePaymentTerms;
|
|
9027
|
+
/** Validation issues reported by the invoice workflow. */
|
|
9028
|
+
validationIssues?: NotificationEventV1ValidationIssue[];
|
|
9029
|
+
/** External IDs of the invoice in other apps such as Stripe. */
|
|
9030
|
+
externalIds?: NotificationEventV1InvoiceAppExternalIds;
|
|
9031
|
+
}
|
|
9032
|
+
/**
|
|
9033
|
+
* Payload of `v1.billing.invoice.updated`, the legacy `invoice.updated` Event
|
|
9034
|
+
* type: the invoice after the update.
|
|
9035
|
+
*/
|
|
9036
|
+
export interface InvoiceUpdatedV1Payload {
|
|
9037
|
+
/** A unique identifier for the resource. */
|
|
9038
|
+
id: string;
|
|
9039
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
9040
|
+
description?: string;
|
|
9041
|
+
/** Additional metadata for the resource. */
|
|
9042
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
9043
|
+
/** Timestamp of when the resource was created. */
|
|
9044
|
+
createdAt: Date;
|
|
9045
|
+
/** Timestamp of when the resource was last updated. */
|
|
9046
|
+
updatedAt: Date;
|
|
9047
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
9048
|
+
deletedAt?: Date;
|
|
9049
|
+
/**
|
|
9050
|
+
* Type of the invoice.
|
|
9051
|
+
*
|
|
9052
|
+
* The type of invoice determines the purpose of the invoice and how it should be
|
|
9053
|
+
* handled.
|
|
9054
|
+
*
|
|
9055
|
+
* Supported types:
|
|
9056
|
+
*
|
|
9057
|
+
* - standard: A regular commercial invoice document between a supplier and
|
|
9058
|
+
* customer.
|
|
9059
|
+
* - credit_note: Reflects a refund either partial or complete of the preceding
|
|
9060
|
+
* document. A credit note effectively _extends_ the previous document.
|
|
9061
|
+
*/
|
|
9062
|
+
type: 'standard' | 'credit_note';
|
|
9063
|
+
/** The taxable entity supplying the goods or services. */
|
|
9064
|
+
supplier: NotificationEventV1BillingParty;
|
|
9065
|
+
/** Legal entity receiving the goods or services. */
|
|
9066
|
+
customer: NotificationEventV1BillingInvoiceCustomerExtendedDetails;
|
|
9067
|
+
/**
|
|
9068
|
+
* Number specifies the human readable key used to reference this Invoice.
|
|
9069
|
+
*
|
|
9070
|
+
* The invoice number can change in the draft phases, as we are allocating
|
|
9071
|
+
* temporary draft invoice numbers, but it's final as soon as the invoice gets
|
|
9072
|
+
* finalized (issued state).
|
|
9073
|
+
*
|
|
9074
|
+
* Please note that the number is (depending on the upstream settings) either
|
|
9075
|
+
* unique for the whole organization or unique for the customer, or in multi
|
|
9076
|
+
* (stripe) account setups unique for the account.
|
|
9077
|
+
*/
|
|
9078
|
+
number: string;
|
|
9079
|
+
/**
|
|
9080
|
+
* Currency for all invoice line items.
|
|
9081
|
+
*
|
|
9082
|
+
* Multi currency invoices are not supported yet.
|
|
9083
|
+
*/
|
|
9084
|
+
currency: string;
|
|
9085
|
+
/**
|
|
9086
|
+
* Key information regarding previous invoices and potentially details as to why
|
|
9087
|
+
* they were corrected.
|
|
9088
|
+
*/
|
|
9089
|
+
preceding?: NotificationEventV1InvoiceDocumentRef[];
|
|
9090
|
+
/** Summary of all the invoice totals, including taxes (calculated). */
|
|
9091
|
+
totals: NotificationEventV1InvoiceTotals;
|
|
9092
|
+
/**
|
|
9093
|
+
* The status of the invoice.
|
|
9094
|
+
*
|
|
9095
|
+
* This field only conatins a simplified status, for more detailed information use
|
|
9096
|
+
* the statusDetails field.
|
|
9097
|
+
*/
|
|
9098
|
+
status: 'gathering' | 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
|
|
9099
|
+
/** The details of the current invoice status. */
|
|
9100
|
+
statusDetails: NotificationEventV1InvoiceStatusDetails;
|
|
9101
|
+
/**
|
|
9102
|
+
* The time the invoice was issued.
|
|
9103
|
+
*
|
|
9104
|
+
* Depending on the status of the invoice this can mean multiple things:
|
|
9105
|
+
*
|
|
9106
|
+
* - draft, gathering: The time the invoice will be issued based on the workflow
|
|
9107
|
+
* settings.
|
|
9108
|
+
* - issued: The time the invoice was issued.
|
|
9109
|
+
*/
|
|
9110
|
+
issuedAt?: Date;
|
|
9111
|
+
/**
|
|
9112
|
+
* The time until the invoice is in draft status.
|
|
9113
|
+
*
|
|
9114
|
+
* On draft invoice creation it is calculated from the workflow settings.
|
|
9115
|
+
*
|
|
9116
|
+
* If manual approval is required, the draftUntil time is set.
|
|
9117
|
+
*/
|
|
9118
|
+
draftUntil?: Date;
|
|
9119
|
+
/** The time when the quantity snapshots on the invoice lines were taken. */
|
|
9120
|
+
quantitySnapshotedAt?: Date;
|
|
9121
|
+
/** The time when the invoice will be/has been collected. */
|
|
9122
|
+
collectionAt?: Date;
|
|
9123
|
+
/** Due time of the fulfillment of the invoice (if available). */
|
|
9124
|
+
dueAt?: Date;
|
|
9125
|
+
/** The period the invoice covers. If the invoice has no line items, it's not set. */
|
|
9126
|
+
period?: NotificationEventV1Period;
|
|
9127
|
+
/**
|
|
9128
|
+
* The time the invoice was voided.
|
|
9129
|
+
*
|
|
9130
|
+
* If the invoice was voided, this field will be set to the time the invoice was
|
|
9131
|
+
* voided.
|
|
9132
|
+
*/
|
|
9133
|
+
voidedAt?: Date;
|
|
9134
|
+
/** The time the invoice was sent to customer. */
|
|
9135
|
+
sentToCustomerAt?: Date;
|
|
9136
|
+
/**
|
|
9137
|
+
* The workflow associated with the invoice.
|
|
9138
|
+
*
|
|
9139
|
+
* It is always a snapshot of the workflow settings at the time of invoice
|
|
9140
|
+
* creation. The field is optional as it should be explicitly requested with expand
|
|
9141
|
+
* options.
|
|
9142
|
+
*/
|
|
9143
|
+
workflow: NotificationEventV1InvoiceWorkflowSettings;
|
|
9144
|
+
/** List of invoice lines representing each of the items sold to the customer. */
|
|
9145
|
+
lines?: NotificationEventV1InvoiceLine[];
|
|
9146
|
+
/** Information on when, how, and to whom the invoice should be paid. */
|
|
9147
|
+
payment?: NotificationEventV1InvoicePaymentTerms;
|
|
9148
|
+
/** Validation issues reported by the invoice workflow. */
|
|
9149
|
+
validationIssues?: NotificationEventV1ValidationIssue[];
|
|
9150
|
+
/** External IDs of the invoice in other apps such as Stripe. */
|
|
9151
|
+
externalIds?: NotificationEventV1InvoiceAppExternalIds;
|
|
9152
|
+
}
|
|
9153
|
+
/** Invoice represents an invoice in the system. */
|
|
9154
|
+
export interface NotificationEventV1Invoice {
|
|
9155
|
+
/** A unique identifier for the resource. */
|
|
9156
|
+
id: string;
|
|
9157
|
+
/** Optional description of the resource. Maximum 1024 characters. */
|
|
9158
|
+
description?: string;
|
|
9159
|
+
/** Additional metadata for the resource. */
|
|
9160
|
+
metadata?: NotificationEventV1Metadata | null;
|
|
9161
|
+
/** Timestamp of when the resource was created. */
|
|
9162
|
+
createdAt: Date;
|
|
9163
|
+
/** Timestamp of when the resource was last updated. */
|
|
9164
|
+
updatedAt: Date;
|
|
9165
|
+
/** Timestamp of when the resource was permanently deleted. */
|
|
9166
|
+
deletedAt?: Date;
|
|
9167
|
+
/**
|
|
9168
|
+
* Type of the invoice.
|
|
9169
|
+
*
|
|
9170
|
+
* The type of invoice determines the purpose of the invoice and how it should be
|
|
9171
|
+
* handled.
|
|
9172
|
+
*
|
|
9173
|
+
* Supported types:
|
|
9174
|
+
*
|
|
9175
|
+
* - standard: A regular commercial invoice document between a supplier and
|
|
9176
|
+
* customer.
|
|
9177
|
+
* - credit_note: Reflects a refund either partial or complete of the preceding
|
|
9178
|
+
* document. A credit note effectively _extends_ the previous document.
|
|
9179
|
+
*/
|
|
9180
|
+
type: 'standard' | 'credit_note';
|
|
9181
|
+
/** The taxable entity supplying the goods or services. */
|
|
9182
|
+
supplier: NotificationEventV1BillingParty;
|
|
9183
|
+
/** Legal entity receiving the goods or services. */
|
|
9184
|
+
customer: NotificationEventV1BillingInvoiceCustomerExtendedDetails;
|
|
9185
|
+
/**
|
|
9186
|
+
* Number specifies the human readable key used to reference this Invoice.
|
|
9187
|
+
*
|
|
9188
|
+
* The invoice number can change in the draft phases, as we are allocating
|
|
9189
|
+
* temporary draft invoice numbers, but it's final as soon as the invoice gets
|
|
9190
|
+
* finalized (issued state).
|
|
9191
|
+
*
|
|
9192
|
+
* Please note that the number is (depending on the upstream settings) either
|
|
9193
|
+
* unique for the whole organization or unique for the customer, or in multi
|
|
9194
|
+
* (stripe) account setups unique for the account.
|
|
9195
|
+
*/
|
|
9196
|
+
number: string;
|
|
9197
|
+
/**
|
|
9198
|
+
* Currency for all invoice line items.
|
|
9199
|
+
*
|
|
9200
|
+
* Multi currency invoices are not supported yet.
|
|
9201
|
+
*/
|
|
9202
|
+
currency: string;
|
|
9203
|
+
/**
|
|
9204
|
+
* Key information regarding previous invoices and potentially details as to why
|
|
9205
|
+
* they were corrected.
|
|
9206
|
+
*/
|
|
9207
|
+
preceding?: NotificationEventV1InvoiceDocumentRef[];
|
|
9208
|
+
/** Summary of all the invoice totals, including taxes (calculated). */
|
|
9209
|
+
totals: NotificationEventV1InvoiceTotals;
|
|
9210
|
+
/**
|
|
9211
|
+
* The status of the invoice.
|
|
9212
|
+
*
|
|
9213
|
+
* This field only conatins a simplified status, for more detailed information use
|
|
9214
|
+
* the statusDetails field.
|
|
9215
|
+
*/
|
|
9216
|
+
status: 'gathering' | 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
|
|
9217
|
+
/** The details of the current invoice status. */
|
|
9218
|
+
statusDetails: NotificationEventV1InvoiceStatusDetails;
|
|
9219
|
+
/**
|
|
9220
|
+
* The time the invoice was issued.
|
|
9221
|
+
*
|
|
9222
|
+
* Depending on the status of the invoice this can mean multiple things:
|
|
9223
|
+
*
|
|
9224
|
+
* - draft, gathering: The time the invoice will be issued based on the workflow
|
|
9225
|
+
* settings.
|
|
9226
|
+
* - issued: The time the invoice was issued.
|
|
9227
|
+
*/
|
|
9228
|
+
issuedAt?: Date;
|
|
9229
|
+
/**
|
|
9230
|
+
* The time until the invoice is in draft status.
|
|
9231
|
+
*
|
|
9232
|
+
* On draft invoice creation it is calculated from the workflow settings.
|
|
9233
|
+
*
|
|
9234
|
+
* If manual approval is required, the draftUntil time is set.
|
|
9235
|
+
*/
|
|
9236
|
+
draftUntil?: Date;
|
|
9237
|
+
/** The time when the quantity snapshots on the invoice lines were taken. */
|
|
9238
|
+
quantitySnapshotedAt?: Date;
|
|
9239
|
+
/** The time when the invoice will be/has been collected. */
|
|
9240
|
+
collectionAt?: Date;
|
|
9241
|
+
/** Due time of the fulfillment of the invoice (if available). */
|
|
9242
|
+
dueAt?: Date;
|
|
9243
|
+
/** The period the invoice covers. If the invoice has no line items, it's not set. */
|
|
9244
|
+
period?: NotificationEventV1Period;
|
|
9245
|
+
/**
|
|
9246
|
+
* The time the invoice was voided.
|
|
9247
|
+
*
|
|
9248
|
+
* If the invoice was voided, this field will be set to the time the invoice was
|
|
9249
|
+
* voided.
|
|
9250
|
+
*/
|
|
9251
|
+
voidedAt?: Date;
|
|
9252
|
+
/** The time the invoice was sent to customer. */
|
|
9253
|
+
sentToCustomerAt?: Date;
|
|
9254
|
+
/**
|
|
9255
|
+
* The workflow associated with the invoice.
|
|
9256
|
+
*
|
|
9257
|
+
* It is always a snapshot of the workflow settings at the time of invoice
|
|
9258
|
+
* creation. The field is optional as it should be explicitly requested with expand
|
|
9259
|
+
* options.
|
|
9260
|
+
*/
|
|
9261
|
+
workflow: NotificationEventV1InvoiceWorkflowSettings;
|
|
9262
|
+
/** List of invoice lines representing each of the items sold to the customer. */
|
|
9263
|
+
lines?: NotificationEventV1InvoiceLine[];
|
|
9264
|
+
/** Information on when, how, and to whom the invoice should be paid. */
|
|
9265
|
+
payment?: NotificationEventV1InvoicePaymentTerms;
|
|
9266
|
+
/** Validation issues reported by the invoice workflow. */
|
|
9267
|
+
validationIssues?: NotificationEventV1ValidationIssue[];
|
|
9268
|
+
/** External IDs of the invoice in other apps such as Stripe. */
|
|
9269
|
+
externalIds?: NotificationEventV1InvoiceAppExternalIds;
|
|
9270
|
+
}
|
|
7244
9271
|
/** Page paginated response. */
|
|
7245
9272
|
export interface SubscriptionPagePaginatedResponse {
|
|
7246
9273
|
data: Subscription[];
|
|
@@ -7264,6 +9291,28 @@ export interface SubscriptionMigrateResponse {
|
|
|
7264
9291
|
/** The resulting subscription, including its phases and items. */
|
|
7265
9292
|
next: Subscription;
|
|
7266
9293
|
}
|
|
9294
|
+
/** An invoice created notification event payload. */
|
|
9295
|
+
export interface NotificationEventInvoiceCreatedPayload {
|
|
9296
|
+
/** The identifier of the event the payload belongs to. */
|
|
9297
|
+
id: string;
|
|
9298
|
+
/** The type of the event. */
|
|
9299
|
+
type: 'invoice.created';
|
|
9300
|
+
/** When the event was generated. */
|
|
9301
|
+
timestamp: Date;
|
|
9302
|
+
/** The invoice the event refers to. */
|
|
9303
|
+
data: InvoiceCreatedV1Payload;
|
|
9304
|
+
}
|
|
9305
|
+
/** An invoice updated notification event payload. */
|
|
9306
|
+
export interface NotificationEventInvoiceUpdatedPayload {
|
|
9307
|
+
/** The identifier of the event the payload belongs to. */
|
|
9308
|
+
id: string;
|
|
9309
|
+
/** The type of the event. */
|
|
9310
|
+
type: 'invoice.updated';
|
|
9311
|
+
/** When the event was generated. */
|
|
9312
|
+
timestamp: Date;
|
|
9313
|
+
/** The invoice the event refers to. */
|
|
9314
|
+
data: InvoiceUpdatedV1Payload;
|
|
9315
|
+
}
|
|
7267
9316
|
/** A flat fee charge for a customer. */
|
|
7268
9317
|
export interface ChargeFlatFee {
|
|
7269
9318
|
id: string;
|
|
@@ -7487,16 +9536,45 @@ export interface ChargeUsageBased {
|
|
|
7487
9536
|
*/
|
|
7488
9537
|
systemIntent?: ChargeUsageBasedSystemIntent;
|
|
7489
9538
|
}
|
|
9539
|
+
/** Result of manually collecting a customer's pending lines into invoices. */
|
|
9540
|
+
export interface InvoiceCustomerChargesResult {
|
|
9541
|
+
/** Created standard invoices, one per collected currency. */
|
|
9542
|
+
invoices: Invoice[];
|
|
9543
|
+
}
|
|
7490
9544
|
/** Page paginated response. */
|
|
7491
9545
|
export interface InvoicePagePaginatedResponse {
|
|
7492
9546
|
data: Invoice[];
|
|
7493
9547
|
meta: PaginatedMeta;
|
|
7494
9548
|
}
|
|
9549
|
+
/**
|
|
9550
|
+
* A notification event records that a notification rule fired and tracks the
|
|
9551
|
+
* delivery of its payload to each channel of the rule. Events are created by the
|
|
9552
|
+
* system and cannot be modified.
|
|
9553
|
+
*/
|
|
9554
|
+
export interface NotificationEvent {
|
|
9555
|
+
/** The unique identifier of the event. */
|
|
9556
|
+
id: string;
|
|
9557
|
+
/** The type of the event. */
|
|
9558
|
+
type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated';
|
|
9559
|
+
/** When the event was generated. */
|
|
9560
|
+
createdAt: Date;
|
|
9561
|
+
/** The rule that generated the event. */
|
|
9562
|
+
rule: NotificationRuleReference;
|
|
9563
|
+
/** The delivery status of the event, one entry per channel of the rule. */
|
|
9564
|
+
deliveryStatus: NotificationEventDeliveryStatus[];
|
|
9565
|
+
/** The payload delivered to the channels. */
|
|
9566
|
+
payload: NotificationEventPayload;
|
|
9567
|
+
}
|
|
7495
9568
|
/** Page paginated response. */
|
|
7496
9569
|
export interface ChargePagePaginatedResponse {
|
|
7497
9570
|
data: Charge[];
|
|
7498
9571
|
meta: PaginatedMeta;
|
|
7499
9572
|
}
|
|
9573
|
+
/** Page paginated response. */
|
|
9574
|
+
export interface NotificationEventPagePaginatedResponse {
|
|
9575
|
+
data: NotificationEvent[];
|
|
9576
|
+
meta: PaginatedMeta;
|
|
9577
|
+
}
|
|
7500
9578
|
/**
|
|
7501
9579
|
* Filters on the given string field value by either exact or fuzzy match. All
|
|
7502
9580
|
* properties are optional; provide exactly one to specify the comparison.
|
|
@@ -7585,6 +9663,8 @@ export type AppActionRequest = AppReconcileWebhookEventsActionRequest;
|
|
|
7585
9663
|
export type InstallAppRequest = InstallAppStripeWithApiKey | InstallAppSandbox | InstallAppExternalInvoicing;
|
|
7586
9664
|
/** Payment settings for a billing workflow. */
|
|
7587
9665
|
export type UpdateBillingWorkflowPaymentSettings = UpdateBillingWorkflowPaymentChargeAutomaticallySettings | UpdateBillingWorkflowPaymentSendInvoiceSettings;
|
|
9666
|
+
/** Period duration for the recurrence */
|
|
9667
|
+
export type NotificationEventV1RecurringPeriodInterval = string | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
7588
9668
|
/**
|
|
7589
9669
|
* Cost basis selection for a custom-currency charge. The variant chosen fixes when
|
|
7590
9670
|
* and how the conversion rate is determined.
|
|
@@ -7604,6 +9684,8 @@ export type InvalidParameter = InvalidParameterStandard | InvalidParameterMinimu
|
|
|
7604
9684
|
export type RateCardEntitlement = RateCardMeteredEntitlement | RateCardStaticEntitlement | RateCardBooleanEntitlement;
|
|
7605
9685
|
/** Request to update an installed app. */
|
|
7606
9686
|
export type UpdateAppRequest = UpdateAppStripeRequest | UpdateAppSandboxRequest | UpdateAppExternalInvoicingRequest;
|
|
9687
|
+
/** The reason for the discount. */
|
|
9688
|
+
export type NotificationEventV1BillingDiscountReason = NotificationEventV1DiscountReasonMaximumSpend | NotificationEventV1DiscountReasonRatecardPercentage | NotificationEventV1DiscountReasonRatecardUsage;
|
|
7607
9689
|
/**
|
|
7608
9690
|
* Per-unit cost configuration for a feature. Either a fixed manual amount or a
|
|
7609
9691
|
* dynamic LLM cost lookup.
|
|
@@ -7644,6 +9726,13 @@ export type NotificationRule = NotificationRuleBalanceThreshold | NotificationRu
|
|
|
7644
9726
|
* to their defaults. The `type` must match the existing rule on update.
|
|
7645
9727
|
*/
|
|
7646
9728
|
export type NotificationRuleRequest = NotificationRuleBalanceThresholdRequest | NotificationRuleEntitlementResetRequest | NotificationRuleInvoiceCreatedRequest | NotificationRuleInvoiceUpdatedRequest;
|
|
9729
|
+
/**
|
|
9730
|
+
* Per-unit cost configuration for a feature. Either a fixed manual amount or a
|
|
9731
|
+
* dynamic LLM cost lookup.
|
|
9732
|
+
*/
|
|
9733
|
+
export type NotificationEventV1FeatureUnitCost = NotificationEventV1FeatureManualUnitCost | NotificationEventV1FeatureLlmUnitCost;
|
|
9734
|
+
/** PaymentTerms defines the terms for payment. */
|
|
9735
|
+
export type NotificationEventV1PaymentTerms = NotificationEventV1PaymentTermInstant | NotificationEventV1PaymentTermDueDate;
|
|
7647
9736
|
/** Price. */
|
|
7648
9737
|
export type Price = PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
|
|
7649
9738
|
/**
|
|
@@ -7661,8 +9750,18 @@ export type CreateEntitlementRequest = CreateEntitlementMeteredRequest | CreateE
|
|
|
7661
9750
|
export type App = AppStripe | AppSandbox | AppExternalInvoicing;
|
|
7662
9751
|
/** Response of the app install. */
|
|
7663
9752
|
export type BillingInstallAppResponse = InstalledAppStripe | InstalledAppSandbox | InstalledAppExternalInvoicing;
|
|
7664
|
-
/**
|
|
7665
|
-
|
|
9753
|
+
/**
|
|
9754
|
+
* The alignment for collecting the pending line items into an invoice.
|
|
9755
|
+
*
|
|
9756
|
+
* Defaults to subscription, which means that we are to create a new invoice every
|
|
9757
|
+
* time the a subscription period starts (for in advance items) or ends (for in
|
|
9758
|
+
* arrears items).
|
|
9759
|
+
*/
|
|
9760
|
+
export type NotificationEventV1BillingWorkflowCollectionAlignment = NotificationEventV1BillingWorkflowCollectionAlignmentSubscription | NotificationEventV1BillingWorkflowCollectionAlignmentAnchored;
|
|
9761
|
+
/** The price of the usage based rate card. */
|
|
9762
|
+
export type NotificationEventV1RateCardUsageBasedPrice = NotificationEventV1FlatPriceWithPaymentTerm | NotificationEventV1UnitPriceWithCommitments | NotificationEventV1TieredPriceWithCommitments | NotificationEventV1DynamicPriceWithCommitments | NotificationEventV1PackagePriceWithCommitments;
|
|
9763
|
+
/** App. One of: stripe */
|
|
9764
|
+
export type NotificationEventV1App = NotificationEventV1StripeApp | NotificationEventV1SandboxApp | NotificationEventV1CustomInvoicingApp;
|
|
7666
9765
|
/** Feature or reference. */
|
|
7667
9766
|
export type FeatureOrReference = Feature | FeatureReference;
|
|
7668
9767
|
/** ChargeRealizationInvoice or reference. */
|
|
@@ -7702,6 +9801,8 @@ export type SubscriptionOrReference = Subscription | SubscriptionReference;
|
|
|
7702
9801
|
export type Invoice = InvoiceStandard;
|
|
7703
9802
|
/** UpdateInvoiceRequest update request. */
|
|
7704
9803
|
export type UpdateInvoiceRequest = UpdateInvoiceStandardRequest;
|
|
9804
|
+
/** The payload delivered to the channels, discriminated by the event type. */
|
|
9805
|
+
export type NotificationEventPayload = NotificationEventBalanceThresholdPayload | NotificationEventResetPayload | NotificationEventInvoiceCreatedPayload | NotificationEventInvoiceUpdatedPayload;
|
|
7705
9806
|
/** Customer charge. */
|
|
7706
9807
|
export type Charge = ChargeFlatFee | ChargeUsageBased;
|
|
7707
9808
|
/**
|
|
@@ -8021,6 +10122,11 @@ export interface WorkflowInvoicingSettingsInput {
|
|
|
8021
10122
|
progressiveBilling?: boolean;
|
|
8022
10123
|
/** Controls how subscription-ending shortened service periods are billed. */
|
|
8023
10124
|
subscriptionEndProrationMode?: 'bill_full_period' | 'bill_actual_period';
|
|
10125
|
+
/**
|
|
10126
|
+
* Controls whether empty invoices are created in the invoicing app. An invoice is
|
|
10127
|
+
* empty when it has no line items or its total is zero.
|
|
10128
|
+
*/
|
|
10129
|
+
emptyInvoiceMode?: 'create' | 'omit';
|
|
8024
10130
|
}
|
|
8025
10131
|
/** Query to evaluate feature access for a list of customers. */
|
|
8026
10132
|
export interface EntitlementAccessQueryRequestInput {
|
|
@@ -8990,6 +11096,8 @@ export interface CreditGrantInput {
|
|
|
8990
11096
|
* fiat currency.
|
|
8991
11097
|
*/
|
|
8992
11098
|
currency: BillingCurrencyCode;
|
|
11099
|
+
/** Managed currency reference. Present only for custom currencies. */
|
|
11100
|
+
customCurrency?: CurrencyCustomReference;
|
|
8993
11101
|
/** Granted credit amount. */
|
|
8994
11102
|
amount: string;
|
|
8995
11103
|
/** Present when a funding workflow applies (funding_method is not `none`). */
|
|
@@ -9748,9 +11856,9 @@ export interface ChargeRealizationInput {
|
|
|
9748
11856
|
* correction (or a voided run that snapshotted behind its live neighbors) instead
|
|
9749
11857
|
* of masking it as zero.
|
|
9750
11858
|
*
|
|
9751
|
-
* On an `outstanding` entry
|
|
9752
|
-
*
|
|
9753
|
-
*
|
|
11859
|
+
* On an `outstanding` entry, usage is omitted unless `real_time_usage` supplies a
|
|
11860
|
+
* live reading. When present, it is the unbooked remainder of that reading,
|
|
11861
|
+
* floored at zero.
|
|
9754
11862
|
*/
|
|
9755
11863
|
usage?: string;
|
|
9756
11864
|
/**
|
|
@@ -10647,6 +12755,11 @@ export interface ChargeUsageBasedInput {
|
|
|
10647
12755
|
*/
|
|
10648
12756
|
systemIntent?: ChargeUsageBasedSystemIntentInput;
|
|
10649
12757
|
}
|
|
12758
|
+
/** Result of manually collecting a customer's pending lines into invoices. */
|
|
12759
|
+
export interface InvoiceCustomerChargesResultInput {
|
|
12760
|
+
/** Created standard invoices, one per collected currency. */
|
|
12761
|
+
invoices: InvoiceInput[];
|
|
12762
|
+
}
|
|
10650
12763
|
/** Page paginated response. */
|
|
10651
12764
|
export interface InvoicePagePaginatedResponseInput {
|
|
10652
12765
|
data: InvoiceInput[];
|