@openmeter/client 1.0.0-beta-73351113ac6e → 1.0.0-beta-fd561cd8ec89

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.
@@ -526,6 +526,13 @@ export interface AppCustomerDataExternalInvoicing {
526
526
  labels?: Labels;
527
527
  }
528
528
  /** Cost basis resolved at the charge's full service period start. */
529
+ export interface CreateChargeCostBasisDynamic {
530
+ /** Discriminator selecting the cost basis mode. */
531
+ type: 'dynamic';
532
+ /** The fiat currency the charge amount is converted into for invoicing. */
533
+ fiatCurrency: string;
534
+ }
535
+ /** Cost basis resolved at the charge's full service period start. */
529
536
  export interface ChargeCostBasisDynamic {
530
537
  /** Discriminator selecting the cost basis mode. */
531
538
  type: 'dynamic';
@@ -599,6 +606,24 @@ export interface CreateCurrencyCustomRequest {
599
606
  thousandSeparator: string;
600
607
  code: string;
601
608
  }
609
+ /** Cost basis with an explicit conversion rate supplied with the charge. */
610
+ export interface CreateChargeCostBasisManual {
611
+ /** Discriminator selecting the cost basis mode. */
612
+ type: 'manual';
613
+ /** The fiat currency the charge amount is converted into for invoicing. */
614
+ fiatCurrency?: string;
615
+ /** Fiat amount per one unit of the custom currency. */
616
+ rate: string;
617
+ }
618
+ /** Cost basis with an explicit conversion rate supplied with the charge. */
619
+ export interface ChargeCostBasisManual {
620
+ /** Discriminator selecting the cost basis mode. */
621
+ type: 'manual';
622
+ /** The fiat currency the charge amount is converted into for invoicing. */
623
+ fiatCurrency?: string;
624
+ /** Fiat amount per one unit of the custom currency. */
625
+ rate: string;
626
+ }
602
627
  /** Flat price. */
603
628
  export interface PriceFlat {
604
629
  /** The type of the price. */
@@ -639,15 +664,6 @@ export interface RateCardDiscounts {
639
664
  */
640
665
  usage?: string;
641
666
  }
642
- /** Cost basis with an explicit conversion rate supplied with the charge. */
643
- export interface ChargeCostBasisManual {
644
- /** Discriminator selecting the cost basis mode. */
645
- type: 'manual';
646
- /** The fiat currency the charge amount is converted into for invoicing. */
647
- fiatCurrency: string;
648
- /** Fiat amount per one unit of the custom currency. */
649
- rate: string;
650
- }
651
667
  /** Totals contains the summaries of all calculations for a billing resource. */
652
668
  export interface Totals {
653
669
  /** The total value of the resource before taxes, discounts and commitments. */
@@ -844,10 +860,28 @@ export interface ProfileReference {
844
860
  /** The ID of the billing profile. */
845
861
  id: string;
846
862
  }
863
+ /** Cost basis pinned to a specific cost basis resource of the custom currency. */
864
+ export interface CreateChargeCostBasisPinned {
865
+ /** Discriminator selecting the cost basis mode. */
866
+ type: 'pinned';
867
+ /** The fiat currency the charge amount is converted into for invoicing. */
868
+ fiatCurrency: string;
869
+ /** ID of the custom currency's cost basis resource to pin. */
870
+ costBasisId: string;
871
+ }
847
872
  /** TaxCode reference. */
848
873
  export interface CreateResourceReference {
849
874
  id: string;
850
875
  }
876
+ /** Cost basis pinned to a specific cost basis resource of the custom currency. */
877
+ export interface ChargeCostBasisPinned {
878
+ /** Discriminator selecting the cost basis mode. */
879
+ type: 'pinned';
880
+ /** The fiat currency the charge amount is converted into for invoicing. */
881
+ fiatCurrency: string;
882
+ /** ID of the custom currency's cost basis resource to pin. */
883
+ costBasisId: string;
884
+ }
851
885
  /** TaxCode reference. */
852
886
  export interface TaxCodeReference {
853
887
  id: string;
@@ -896,15 +930,6 @@ export interface SubscriptionReference {
896
930
  };
897
931
  };
898
932
  }
899
- /** Cost basis pinned to a specific cost basis resource of the custom currency. */
900
- export interface ChargeCostBasisPinned {
901
- /** Discriminator selecting the cost basis mode. */
902
- type: 'pinned';
903
- /** The fiat currency the charge amount is converted into for invoicing. */
904
- fiatCurrency: string;
905
- /** ID of the custom currency's cost basis resource to pin. */
906
- costBasisId: string;
907
- }
908
933
  /** App reference. */
909
934
  export interface AppReference {
910
935
  /** The ID of the app. */
@@ -1064,6 +1089,24 @@ export interface AppStripeCreateCustomerPortalSessionResult {
1064
1089
  */
1065
1090
  url: string;
1066
1091
  }
1092
+ /**
1093
+ * Fiat conversion rate a custom-currency charge is invoiced at. Present once the
1094
+ * cost basis is resolved; dynamic cost bases are exposed only after the service
1095
+ * period has started.
1096
+ */
1097
+ export interface ChargeResolvedCostBasis {
1098
+ /** The fiat currency the charge amount is converted into for invoicing. */
1099
+ fiatCurrency: string;
1100
+ /** Fiat amount per one unit of the custom currency. */
1101
+ rate: string;
1102
+ /**
1103
+ * ID of the custom currency's cost basis resource the rate was taken from. Absent
1104
+ * for manual cost bases.
1105
+ */
1106
+ costBasisId?: string;
1107
+ /** When the rate was resolved. */
1108
+ resolvedAt: Date;
1109
+ }
1067
1110
  /**
1068
1111
  * A period with defined start and end dates.
1069
1112
  *
@@ -1083,24 +1126,6 @@ export interface ClosedPeriod {
1083
1126
  */
1084
1127
  to: Date;
1085
1128
  }
1086
- /**
1087
- * Fiat conversion rate a custom-currency charge is invoiced at. Present once the
1088
- * cost basis is resolved; dynamic cost bases are exposed only after the service
1089
- * period has started.
1090
- */
1091
- export interface ChargeResolvedCostBasis {
1092
- /** The fiat currency the charge amount is converted into for invoicing. */
1093
- fiatCurrency: string;
1094
- /** Fiat amount per one unit of the custom currency. */
1095
- rate: string;
1096
- /**
1097
- * ID of the custom currency's cost basis resource the rate was taken from. Absent
1098
- * for manual cost bases.
1099
- */
1100
- costBasisId?: string;
1101
- /** When the rate was resolved. */
1102
- resolvedAt: Date;
1103
- }
1104
1129
  /** A subscription add-on event. */
1105
1130
  export interface SubscriptionAddonTimelineSegment {
1106
1131
  /** An ISO-8601 timestamp representation of the cadence start of the resource. */
@@ -1755,28 +1780,6 @@ export interface EntitlementAccessResult {
1755
1780
  */
1756
1781
  config?: string;
1757
1782
  }
1758
- /** Purchase and payment terms of the grant. */
1759
- export interface CreateCreditGrantPurchase {
1760
- /** Currency of the purchase amount. */
1761
- currency: string;
1762
- /**
1763
- * Cost basis per credit unit used to calculate the purchase amount.
1764
- *
1765
- * If `per_unit_cost_basis` is 0.50 and credit amount is
1766
- * $100.00, the total
1767
- * charge is $50.00. The value must be greater than 0. If the
1768
- * cost basis is 0, use `funding_method=none` instead.
1769
- *
1770
- * Defaults to 1.0.
1771
- */
1772
- perUnitCostBasis: string;
1773
- /**
1774
- * Controls when credits become available for consumption.
1775
- *
1776
- * Defaults to `on_creation`.
1777
- */
1778
- availabilityPolicy: 'on_creation';
1779
- }
1780
1783
  /** The entitlement template of a metered entitlement. */
1781
1784
  export interface RateCardMeteredEntitlement {
1782
1785
  /** The type of the entitlement template. */
@@ -1834,32 +1837,6 @@ export interface RecurringPeriod {
1834
1837
  /** The interval duration in ISO 8601 format. */
1835
1838
  interval: string;
1836
1839
  }
1837
- /** Purchase and payment terms of the grant. */
1838
- export interface CreditGrantPurchase {
1839
- /** Currency of the purchase amount. */
1840
- currency: string;
1841
- /**
1842
- * Cost basis per credit unit used to calculate the purchase amount.
1843
- *
1844
- * If `per_unit_cost_basis` is 0.50 and credit amount is
1845
- * $100.00, the total
1846
- * charge is $50.00. The value must be greater than 0. If the
1847
- * cost basis is 0, use `funding_method=none` instead.
1848
- *
1849
- * Defaults to 1.0.
1850
- */
1851
- perUnitCostBasis: string;
1852
- /** The purchase amount. Calculated from `per_unit_cost_basis` and credit `amount`. */
1853
- amount: string;
1854
- /**
1855
- * Controls when credits become available for consumption.
1856
- *
1857
- * Defaults to `on_creation`.
1858
- */
1859
- availabilityPolicy: 'on_creation';
1860
- /** Current payment settlement status. */
1861
- settlementStatus?: 'pending' | 'authorized' | 'settled';
1862
- }
1863
1840
  /**
1864
1841
  * Request body for updating the external payment settlement status of a credit
1865
1842
  * grant.
@@ -2775,23 +2752,9 @@ export interface ListChargesParamsFilter {
2775
2752
  featureId?: UlidFieldFilter;
2776
2753
  /** Filter charges by the key of their associated feature. */
2777
2754
  featureKey?: StringFieldFilterExact;
2778
- /**
2779
- * Filter charges by the start of their service period.
2780
- *
2781
- * Combine with `service_period_to` to match charges whose service period falls
2782
- * within a given window: `filter[service_period_from][gte]=<from>` together with
2783
- * `filter[service_period_to][lt]=<to>` returns charges whose service period lies
2784
- * within `[from, to)`.
2785
- */
2755
+ /** Filter charges by the start of their service period. */
2786
2756
  servicePeriodFrom?: DateTimeFieldFilter;
2787
- /**
2788
- * Filter charges by the end of their service period.
2789
- *
2790
- * Combine with `service_period_from` to match charges whose service period falls
2791
- * within a given window: `filter[service_period_from][gte]=<from>` together with
2792
- * `filter[service_period_to][lt]=<to>` returns charges whose service period lies
2793
- * within `[from, to)`.
2794
- */
2757
+ /** Filter charges by the end of their service period. */
2795
2758
  servicePeriodTo?: DateTimeFieldFilter;
2796
2759
  }
2797
2760
  /** Filter options for listing invoices. */
@@ -3470,70 +3433,88 @@ export interface PricePagePaginatedResponse {
3470
3433
  data: LlmCostPrice[];
3471
3434
  meta: PaginatedMeta;
3472
3435
  }
3473
- /** CreditGrant create request. */
3474
- export interface CreateCreditGrantRequest {
3436
+ /** Purchase and payment terms of the grant. */
3437
+ export interface CreateCreditGrantPurchase {
3475
3438
  /**
3476
- * Display name of the resource.
3439
+ * Fiat currency the purchase is settled in.
3477
3440
  *
3478
- * Between 1 and 256 characters.
3441
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
3442
+ * for custom-currency grants.
3479
3443
  */
3480
- name: string;
3444
+ currency: string;
3481
3445
  /**
3482
- * Optional description of the resource.
3446
+ * Fiat cost basis per credit unit of a fiat-currency grant.
3483
3447
  *
3484
- * Maximum 1024 characters.
3448
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
3449
+ * $100.00, the total
3450
+ * charge is $50.00. The value must be greater than 0. If the
3451
+ * cost basis is 0, use `funding_method=none` instead.
3452
+ *
3453
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
3454
+ * to 1.0 when neither is provided.
3485
3455
  */
3486
- description?: string;
3487
- labels?: CreateLabels;
3488
- /** Funding method of the grant. */
3489
- fundingMethod: 'none' | 'invoice' | 'external';
3490
- /** The currency of the granted credits. */
3491
- currency: CreateCurrencyCode;
3492
- /** Granted credit amount. */
3493
- amount: string;
3494
- /** Present when a funding workflow applies (funding_method is not `none`). */
3495
- purchase?: CreateCreditGrantPurchase;
3456
+ perUnitCostBasis?: string;
3496
3457
  /**
3497
- * Tax configuration for the grant.
3458
+ * Defines how custom-currency credits are priced in the purchase `currency`; the
3459
+ * resolved rate is exposed through `resolved_cost_basis`.
3498
3460
  *
3499
- * For `invoice` and `external` funding methods, tax configuration should be
3500
- * provided to ensure correct revenue recognition. When not provided, the default
3501
- * credit grant tax code is applied, if that's not set the global default taxcode
3502
- * is used.
3461
+ * Fiat grants accept only a `manual` cost basis without `fiat_currency`, where
3462
+ * `rate` is the fiat cost per credit unit. Custom-currency grants require a cost
3463
+ * basis of any type with `fiat_currency` set and equal to the purchase `currency`.
3464
+ * A `dynamic` cost basis is resolved at the grant's effective time, so the
3465
+ * currency cost basis must be effective by then. Cannot be combined with
3466
+ * `per_unit_cost_basis`.
3503
3467
  */
3504
- taxConfig?: CreateCreditGrantTaxConfig;
3505
- filters?: CreateCreditGrantFilters;
3506
- /** Draw-down priority of the grant. Lower values have higher priority. */
3507
- priority: number;
3468
+ costBasis?: CreateChargeCostBasis;
3508
3469
  /**
3509
- * The timestamp when the credit grant becomes effective.
3470
+ * Controls when credits become available for consumption.
3510
3471
  *
3511
- * Defaults to the current date and time.
3472
+ * Defaults to `on_creation`.
3512
3473
  */
3513
- effectiveAt?: Date;
3474
+ availabilityPolicy: 'on_creation';
3475
+ }
3476
+ /** Purchase and payment terms of the grant. */
3477
+ export interface CreditGrantPurchase {
3514
3478
  /**
3515
- * The duration after which the credit grant expires.
3479
+ * Fiat currency the purchase is settled in.
3516
3480
  *
3517
- * Defaults to never expiring.
3481
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
3482
+ * for custom-currency grants.
3518
3483
  */
3519
- expiresAfter?: string;
3484
+ currency: string;
3520
3485
  /**
3521
- * Idempotency key for the credit grant creation request.
3486
+ * Fiat cost basis per credit unit of a fiat-currency grant.
3522
3487
  *
3523
- * Unique per customer: reusing the same key for the same customer returns an HTTP
3524
- * 409 Conflict instead of creating a duplicate grant, which makes create requests
3525
- * safe to retry. The same key may be reused across different customers.
3488
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
3489
+ * $100.00, the total
3490
+ * charge is $50.00. The value must be greater than 0. If the
3491
+ * cost basis is 0, use `funding_method=none` instead.
3492
+ *
3493
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
3494
+ * to 1.0 when neither is provided.
3526
3495
  */
3527
- key?: string;
3496
+ perUnitCostBasis?: string;
3497
+ /**
3498
+ * The rate the purchase is settled at in the purchase `currency`. Present once the
3499
+ * cost basis is resolved.
3500
+ */
3501
+ resolvedCostBasis?: ChargeResolvedCostBasis;
3502
+ /**
3503
+ * The purchase amount, calculated from the resolved cost basis and credit
3504
+ * `amount`. Present once the cost basis is resolved.
3505
+ */
3506
+ amount?: string;
3507
+ /**
3508
+ * Controls when credits become available for consumption.
3509
+ *
3510
+ * Defaults to `on_creation`.
3511
+ */
3512
+ availabilityPolicy: 'on_creation';
3513
+ /** Current payment settlement status. */
3514
+ settlementStatus?: 'pending' | 'authorized' | 'settled';
3528
3515
  }
3529
- /**
3530
- * A credit grant allocates credits to a customer.
3531
- *
3532
- * Credits are drawn down against charges according to the settlement mode
3533
- * configured on the rate card.
3534
- */
3535
- export interface CreditGrant {
3536
- id: string;
3516
+ /** Flat fee charge create request. */
3517
+ export interface CreateChargeFlatFeeRequest {
3537
3518
  /**
3538
3519
  * Display name of the resource.
3539
3520
  *
@@ -3547,107 +3528,15 @@ export interface CreditGrant {
3547
3528
  */
3548
3529
  description?: string;
3549
3530
  labels?: Labels;
3550
- /** An ISO-8601 timestamp representation of entity creation date. */
3551
- createdAt: Date;
3552
- /** An ISO-8601 timestamp representation of entity last update date. */
3553
- updatedAt: Date;
3554
- /** An ISO-8601 timestamp representation of entity deletion date. */
3555
- deletedAt?: Date;
3556
- /** Funding method of the grant. */
3557
- fundingMethod: 'none' | 'invoice' | 'external';
3558
- /** The currency of the granted credits. */
3531
+ /** The type of the charge. */
3532
+ type: 'flat_fee';
3533
+ /** The currency of the charge. */
3559
3534
  currency: BillingCurrencyCode;
3560
- /** Granted credit amount. */
3561
- amount: string;
3562
- /** Present when a funding workflow applies (funding_method is not `none`). */
3563
- purchase?: CreditGrantPurchase;
3564
- /**
3565
- * Tax configuration for the grant.
3566
- *
3567
- * For `invoice` and `external` funding methods, tax configuration should be
3568
- * provided to ensure correct revenue recognition. When not provided, the default
3569
- * credit grant tax code is applied, if that's not set the global default taxcode
3570
- * is used.
3571
- */
3572
- taxConfig?: CreditGrantTaxConfig;
3573
- /** Available when `funding_method` is `invoice`. */
3574
- invoice?: CreditGrantInvoiceReference;
3575
- filters?: CreditGrantFilters;
3576
- /** Draw-down priority of the grant. Lower values have higher priority. */
3577
- priority: number;
3578
3535
  /**
3579
- * The timestamp when the credit grant becomes effective.
3580
- *
3581
- * Defaults to the current date and time.
3582
- */
3583
- effectiveAt?: Date;
3584
- /**
3585
- * Idempotency key for the credit grant creation request.
3586
- *
3587
- * Unique per customer: reusing the same key for the same customer returns an HTTP
3588
- * 409 Conflict instead of creating a duplicate grant, which makes create requests
3589
- * safe to retry. The same key may be reused across different customers.
3590
- */
3591
- key?: string;
3592
- /**
3593
- * The timestamp when the credit grant expires.
3594
- *
3595
- * Calculated from the grant effective time and `expires_after` if provided.
3596
- */
3597
- expiresAt?: Date;
3598
- /** Timestamp when the grant was voided. */
3599
- voidedAt?: Date;
3600
- /** Current lifecycle status of the grant. */
3601
- status: 'pending' | 'active' | 'expired' | 'voided';
3602
- }
3603
- /** Tax settings for a billing workflow. */
3604
- export interface WorkflowTaxSettings {
3605
- /**
3606
- * Enable automatic tax calculation when tax is supported by the app. For example,
3607
- * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.
3608
- */
3609
- enabled: boolean;
3610
- /**
3611
- * Enforce tax calculation when tax is supported by the app. When enabled, the
3612
- * billing system will not allow to create an invoice without tax calculation.
3613
- * Enforcement is different per apps, for example, Stripe app requires customer to
3614
- * have a tax location when starting a paid subscription.
3615
- */
3616
- enforced: boolean;
3617
- /**
3618
- * Default tax configuration to apply to the invoices for line items.
3619
- *
3620
- * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax
3621
- * config is deprecated and can no longer be added or changed: the organization
3622
- * default tax code is used instead. Existing tax-code values may still be removed,
3623
- * and `behavior` remains fully supported.
3624
- */
3625
- defaultTaxConfig?: TaxConfig;
3626
- }
3627
- /** Flat fee charge create request. */
3628
- export interface CreateChargeFlatFeeRequest {
3629
- /**
3630
- * Display name of the resource.
3631
- *
3632
- * Between 1 and 256 characters.
3633
- */
3634
- name: string;
3635
- /**
3636
- * Optional description of the resource.
3637
- *
3638
- * Maximum 1024 characters.
3639
- */
3640
- description?: string;
3641
- labels?: Labels;
3642
- /** The type of the charge. */
3643
- type: 'flat_fee';
3644
- /** The currency of the charge. */
3645
- currency: BillingCurrencyCode;
3646
- /**
3647
- * Defines how a custom-currency charge is converted into its fiat invoice
3648
- * currency; the resolved rate is exposed through `resolved_cost_basis`. Required
3649
- * when `currency` is custom and the charge settles as `credit_then_invoice`; must
3650
- * be omitted otherwise.
3536
+ * Defines how a custom-currency charge is converted into its fiat invoice
3537
+ * currency; the resolved rate is exposed through `resolved_cost_basis`. Required
3538
+ * when `currency` is custom and the charge settles as `credit_then_invoice`; must
3539
+ * be omitted otherwise.
3651
3540
  */
3652
3541
  costBasis?: ChargeCostBasis;
3653
3542
  /** The timestamp when the charge is intended to be invoiced. */
@@ -3675,6 +3564,30 @@ export interface CreateChargeFlatFeeRequest {
3675
3564
  /** The billing period the charge belongs to. */
3676
3565
  billingPeriod?: ClosedPeriod;
3677
3566
  }
3567
+ /** Tax settings for a billing workflow. */
3568
+ export interface WorkflowTaxSettings {
3569
+ /**
3570
+ * Enable automatic tax calculation when tax is supported by the app. For example,
3571
+ * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.
3572
+ */
3573
+ enabled: boolean;
3574
+ /**
3575
+ * Enforce tax calculation when tax is supported by the app. When enabled, the
3576
+ * billing system will not allow to create an invoice without tax calculation.
3577
+ * Enforcement is different per apps, for example, Stripe app requires customer to
3578
+ * have a tax location when starting a paid subscription.
3579
+ */
3580
+ enforced: boolean;
3581
+ /**
3582
+ * Default tax configuration to apply to the invoices for line items.
3583
+ *
3584
+ * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax
3585
+ * config is deprecated and can no longer be added or changed: the organization
3586
+ * default tax code is used instead. Existing tax-code values may still be removed,
3587
+ * and `behavior` remains fully supported.
3588
+ */
3589
+ defaultTaxConfig?: TaxConfig;
3590
+ }
3678
3591
  /** Page paginated response. */
3679
3592
  export interface PlanAddonPagePaginatedResponse {
3680
3593
  data: PlanAddon[];
@@ -4305,10 +4218,145 @@ export interface UpdateFeatureRequest {
4305
4218
  */
4306
4219
  unitCost?: FeatureUnitCost | null;
4307
4220
  }
4308
- /** Page paginated response. */
4309
- export interface CreditGrantPagePaginatedResponse {
4310
- data: CreditGrant[];
4311
- meta: PaginatedMeta;
4221
+ /** CreditGrant create request. */
4222
+ export interface CreateCreditGrantRequest {
4223
+ /**
4224
+ * Display name of the resource.
4225
+ *
4226
+ * Between 1 and 256 characters.
4227
+ */
4228
+ name: string;
4229
+ /**
4230
+ * Optional description of the resource.
4231
+ *
4232
+ * Maximum 1024 characters.
4233
+ */
4234
+ description?: string;
4235
+ labels?: CreateLabels;
4236
+ /** Funding method of the grant. */
4237
+ fundingMethod: 'none' | 'invoice' | 'external';
4238
+ /**
4239
+ * The fiat or custom currency of the granted credits.
4240
+ *
4241
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
4242
+ * fiat currency.
4243
+ */
4244
+ currency: CreateCurrencyCode;
4245
+ /** Granted credit amount. */
4246
+ amount: string;
4247
+ /** Present when a funding workflow applies (funding_method is not `none`). */
4248
+ purchase?: CreateCreditGrantPurchase;
4249
+ /**
4250
+ * Tax configuration for the grant.
4251
+ *
4252
+ * For `invoice` and `external` funding methods, tax configuration should be
4253
+ * provided to ensure correct revenue recognition. When not provided, the default
4254
+ * credit grant tax code is applied, if that's not set the global default taxcode
4255
+ * is used.
4256
+ */
4257
+ taxConfig?: CreateCreditGrantTaxConfig;
4258
+ filters?: CreateCreditGrantFilters;
4259
+ /** Draw-down priority of the grant. Lower values have higher priority. */
4260
+ priority: number;
4261
+ /**
4262
+ * The timestamp when the credit grant becomes effective.
4263
+ *
4264
+ * Defaults to the current date and time.
4265
+ */
4266
+ effectiveAt?: Date;
4267
+ /**
4268
+ * The duration after which the credit grant expires.
4269
+ *
4270
+ * Defaults to never expiring.
4271
+ */
4272
+ expiresAfter?: string;
4273
+ /**
4274
+ * Idempotency key for the credit grant creation request.
4275
+ *
4276
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
4277
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
4278
+ * safe to retry. The same key may be reused across different customers.
4279
+ */
4280
+ key?: string;
4281
+ }
4282
+ /**
4283
+ * A credit grant allocates credits to a customer.
4284
+ *
4285
+ * Credits are drawn down against charges according to the settlement mode
4286
+ * configured on the rate card.
4287
+ */
4288
+ export interface CreditGrant {
4289
+ id: string;
4290
+ /**
4291
+ * Display name of the resource.
4292
+ *
4293
+ * Between 1 and 256 characters.
4294
+ */
4295
+ name: string;
4296
+ /**
4297
+ * Optional description of the resource.
4298
+ *
4299
+ * Maximum 1024 characters.
4300
+ */
4301
+ description?: string;
4302
+ labels?: Labels;
4303
+ /** An ISO-8601 timestamp representation of entity creation date. */
4304
+ createdAt: Date;
4305
+ /** An ISO-8601 timestamp representation of entity last update date. */
4306
+ updatedAt: Date;
4307
+ /** An ISO-8601 timestamp representation of entity deletion date. */
4308
+ deletedAt?: Date;
4309
+ /** Funding method of the grant. */
4310
+ fundingMethod: 'none' | 'invoice' | 'external';
4311
+ /**
4312
+ * The fiat or custom currency of the granted credits.
4313
+ *
4314
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
4315
+ * fiat currency.
4316
+ */
4317
+ currency: BillingCurrencyCode;
4318
+ /** Granted credit amount. */
4319
+ amount: string;
4320
+ /** Present when a funding workflow applies (funding_method is not `none`). */
4321
+ purchase?: CreditGrantPurchase;
4322
+ /**
4323
+ * Tax configuration for the grant.
4324
+ *
4325
+ * For `invoice` and `external` funding methods, tax configuration should be
4326
+ * provided to ensure correct revenue recognition. When not provided, the default
4327
+ * credit grant tax code is applied, if that's not set the global default taxcode
4328
+ * is used.
4329
+ */
4330
+ taxConfig?: CreditGrantTaxConfig;
4331
+ /** Available when `funding_method` is `invoice`. */
4332
+ invoice?: CreditGrantInvoiceReference;
4333
+ filters?: CreditGrantFilters;
4334
+ /** Draw-down priority of the grant. Lower values have higher priority. */
4335
+ priority: number;
4336
+ /**
4337
+ * The timestamp when the credit grant becomes effective.
4338
+ *
4339
+ * Defaults to the current date and time.
4340
+ */
4341
+ effectiveAt?: Date;
4342
+ /**
4343
+ * Idempotency key for the credit grant creation request.
4344
+ *
4345
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
4346
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
4347
+ * safe to retry. The same key may be reused across different customers.
4348
+ */
4349
+ key?: string;
4350
+ /**
4351
+ * The timestamp when the credit grant expires.
4352
+ *
4353
+ * Calculated from the grant effective time and `expires_after` if provided.
4354
+ */
4355
+ expiresAt?: Date;
4356
+ /** Timestamp when the grant was voided. */
4357
+ voidedAt?: Date;
4358
+ /** Current lifecycle status of the grant. */
4359
+ status: 'pending' | 'active' | 'expired' | 'voided';
4312
4360
  }
4313
4361
  /** Page paginated response. */
4314
4362
  export interface CurrencyPagePaginatedResponse {
@@ -4704,6 +4752,11 @@ export interface UpdateInvoiceLineRateCard {
4704
4752
  /** Discount configuration from the rate card. */
4705
4753
  discounts?: UpdateDiscounts;
4706
4754
  }
4755
+ /** Page paginated response. */
4756
+ export interface CreditGrantPagePaginatedResponse {
4757
+ data: CreditGrant[];
4758
+ meta: PaginatedMeta;
4759
+ }
4707
4760
  /** Billing workflow settings. */
4708
4761
  export interface Workflow {
4709
4762
  /** The collection settings for this workflow */
@@ -6056,6 +6109,11 @@ export type SubscriptionEditTiming = 'immediate' | 'next_billing_cycle' | Date;
6056
6109
  export type InstallAppRequest = InstallAppStripeWithApiKey | InstallAppSandbox | InstallAppExternalInvoicing;
6057
6110
  /** Payment settings for a billing workflow. */
6058
6111
  export type UpdateBillingWorkflowPaymentSettings = UpdateBillingWorkflowPaymentChargeAutomaticallySettings | UpdateBillingWorkflowPaymentSendInvoiceSettings;
6112
+ /**
6113
+ * Cost basis selection for a custom-currency charge. The variant chosen fixes when
6114
+ * and how the conversion rate is determined.
6115
+ */
6116
+ export type CreateChargeCostBasis = CreateChargeCostBasisDynamic | CreateChargeCostBasisPinned | CreateChargeCostBasisManual;
6059
6117
  /**
6060
6118
  * Cost basis selection for a custom-currency charge. The variant chosen fixes when
6061
6119
  * and how the conversion rate is determined.
@@ -6338,37 +6396,15 @@ export interface AppStripeCreateCheckoutSessionTaxIdCollectionInput {
6338
6396
  */
6339
6397
  required?: 'if_supported' | 'never';
6340
6398
  }
6341
- /** Purchase and payment terms of the grant. */
6342
- export interface CreateCreditGrantPurchaseInput {
6343
- /** Currency of the purchase amount. */
6344
- currency: string;
6399
+ /** The entitlement template of a metered entitlement. */
6400
+ export interface RateCardMeteredEntitlementInput {
6401
+ /** The type of the entitlement template. */
6402
+ type: 'metered';
6345
6403
  /**
6346
- * Cost basis per credit unit used to calculate the purchase amount.
6347
- *
6348
- * If `per_unit_cost_basis` is 0.50 and credit amount is
6349
- * $100.00, the total
6350
- * charge is $50.00. The value must be greater than 0. If the
6351
- * cost basis is 0, use `funding_method=none` instead.
6352
- *
6353
- * Defaults to 1.0.
6404
+ * If soft limit is true, the subject can use the feature even if the entitlement
6405
+ * is exhausted; access remains granted.
6354
6406
  */
6355
- perUnitCostBasis?: string;
6356
- /**
6357
- * Controls when credits become available for consumption.
6358
- *
6359
- * Defaults to `on_creation`.
6360
- */
6361
- availabilityPolicy?: 'on_creation';
6362
- }
6363
- /** The entitlement template of a metered entitlement. */
6364
- export interface RateCardMeteredEntitlementInput {
6365
- /** The type of the entitlement template. */
6366
- type: 'metered';
6367
- /**
6368
- * If soft limit is true, the subject can use the feature even if the entitlement
6369
- * is exhausted; access remains granted.
6370
- */
6371
- isSoftLimit?: boolean;
6407
+ isSoftLimit?: boolean;
6372
6408
  /**
6373
6409
  * The amount of usage granted each usage period, in the feature's unit. Usage is
6374
6410
  * counted against this allowance and the balance resets every usage period. When
@@ -6382,32 +6418,6 @@ export interface RateCardMeteredEntitlementInput {
6382
6418
  */
6383
6419
  usagePeriod?: string;
6384
6420
  }
6385
- /** Purchase and payment terms of the grant. */
6386
- export interface CreditGrantPurchaseInput {
6387
- /** Currency of the purchase amount. */
6388
- currency: string;
6389
- /**
6390
- * Cost basis per credit unit used to calculate the purchase amount.
6391
- *
6392
- * If `per_unit_cost_basis` is 0.50 and credit amount is
6393
- * $100.00, the total
6394
- * charge is $50.00. The value must be greater than 0. If the
6395
- * cost basis is 0, use `funding_method=none` instead.
6396
- *
6397
- * Defaults to 1.0.
6398
- */
6399
- perUnitCostBasis?: string;
6400
- /** The purchase amount. Calculated from `per_unit_cost_basis` and credit `amount`. */
6401
- amount: string;
6402
- /**
6403
- * Controls when credits become available for consumption.
6404
- *
6405
- * Defaults to `on_creation`.
6406
- */
6407
- availabilityPolicy?: 'on_creation';
6408
- /** Current payment settlement status. */
6409
- settlementStatus?: 'pending' | 'authorized' | 'settled';
6410
- }
6411
6421
  /** Request body for voiding a credit grant. */
6412
6422
  export interface VoidCreditGrantRequestInput {
6413
6423
  /**
@@ -6544,135 +6554,85 @@ export interface UpdateBillingInvoiceWorkflowInput {
6544
6554
  /** Payment settings for this invoice. */
6545
6555
  payment?: UpdateBillingWorkflowPaymentSettingsInput;
6546
6556
  }
6547
- /** CreditGrant create request. */
6548
- export interface CreateCreditGrantRequestInput {
6557
+ /** Purchase and payment terms of the grant. */
6558
+ export interface CreateCreditGrantPurchaseInput {
6549
6559
  /**
6550
- * Display name of the resource.
6560
+ * Fiat currency the purchase is settled in.
6551
6561
  *
6552
- * Between 1 and 256 characters.
6562
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
6563
+ * for custom-currency grants.
6553
6564
  */
6554
- name: string;
6565
+ currency: string;
6555
6566
  /**
6556
- * Optional description of the resource.
6567
+ * Fiat cost basis per credit unit of a fiat-currency grant.
6557
6568
  *
6558
- * Maximum 1024 characters.
6559
- */
6560
- description?: string;
6561
- labels?: CreateLabels;
6562
- /** Funding method of the grant. */
6563
- fundingMethod: 'none' | 'invoice' | 'external';
6564
- /** The currency of the granted credits. */
6565
- currency: CreateCurrencyCode;
6566
- /** Granted credit amount. */
6567
- amount: string;
6568
- /** Present when a funding workflow applies (funding_method is not `none`). */
6569
- purchase?: CreateCreditGrantPurchaseInput;
6570
- /**
6571
- * Tax configuration for the grant.
6569
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
6570
+ * $100.00, the total
6571
+ * charge is $50.00. The value must be greater than 0. If the
6572
+ * cost basis is 0, use `funding_method=none` instead.
6572
6573
  *
6573
- * For `invoice` and `external` funding methods, tax configuration should be
6574
- * provided to ensure correct revenue recognition. When not provided, the default
6575
- * credit grant tax code is applied, if that's not set the global default taxcode
6576
- * is used.
6574
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
6575
+ * to 1.0 when neither is provided.
6577
6576
  */
6578
- taxConfig?: CreateCreditGrantTaxConfig;
6579
- filters?: CreateCreditGrantFilters;
6580
- /** Draw-down priority of the grant. Lower values have higher priority. */
6581
- priority?: number;
6582
- /**
6583
- * The timestamp when the credit grant becomes effective.
6584
- *
6585
- * Defaults to the current date and time.
6586
- */
6587
- effectiveAt?: Date;
6577
+ perUnitCostBasis?: string;
6588
6578
  /**
6589
- * The duration after which the credit grant expires.
6579
+ * Defines how custom-currency credits are priced in the purchase `currency`; the
6580
+ * resolved rate is exposed through `resolved_cost_basis`.
6590
6581
  *
6591
- * Defaults to never expiring.
6582
+ * Fiat grants accept only a `manual` cost basis without `fiat_currency`, where
6583
+ * `rate` is the fiat cost per credit unit. Custom-currency grants require a cost
6584
+ * basis of any type with `fiat_currency` set and equal to the purchase `currency`.
6585
+ * A `dynamic` cost basis is resolved at the grant's effective time, so the
6586
+ * currency cost basis must be effective by then. Cannot be combined with
6587
+ * `per_unit_cost_basis`.
6592
6588
  */
6593
- expiresAfter?: string;
6589
+ costBasis?: CreateChargeCostBasis;
6594
6590
  /**
6595
- * Idempotency key for the credit grant creation request.
6591
+ * Controls when credits become available for consumption.
6596
6592
  *
6597
- * Unique per customer: reusing the same key for the same customer returns an HTTP
6598
- * 409 Conflict instead of creating a duplicate grant, which makes create requests
6599
- * safe to retry. The same key may be reused across different customers.
6593
+ * Defaults to `on_creation`.
6600
6594
  */
6601
- key?: string;
6595
+ availabilityPolicy?: 'on_creation';
6602
6596
  }
6603
- /**
6604
- * A credit grant allocates credits to a customer.
6605
- *
6606
- * Credits are drawn down against charges according to the settlement mode
6607
- * configured on the rate card.
6608
- */
6609
- export interface CreditGrantInput {
6610
- id: string;
6597
+ /** Purchase and payment terms of the grant. */
6598
+ export interface CreditGrantPurchaseInput {
6611
6599
  /**
6612
- * Display name of the resource.
6600
+ * Fiat currency the purchase is settled in.
6613
6601
  *
6614
- * Between 1 and 256 characters.
6602
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
6603
+ * for custom-currency grants.
6615
6604
  */
6616
- name: string;
6605
+ currency: string;
6617
6606
  /**
6618
- * Optional description of the resource.
6607
+ * Fiat cost basis per credit unit of a fiat-currency grant.
6619
6608
  *
6620
- * Maximum 1024 characters.
6621
- */
6622
- description?: string;
6623
- labels?: Labels;
6624
- /** An ISO-8601 timestamp representation of entity creation date. */
6625
- createdAt: Date;
6626
- /** An ISO-8601 timestamp representation of entity last update date. */
6627
- updatedAt: Date;
6628
- /** An ISO-8601 timestamp representation of entity deletion date. */
6629
- deletedAt?: Date;
6630
- /** Funding method of the grant. */
6631
- fundingMethod: 'none' | 'invoice' | 'external';
6632
- /** The currency of the granted credits. */
6633
- currency: BillingCurrencyCode;
6634
- /** Granted credit amount. */
6635
- amount: string;
6636
- /** Present when a funding workflow applies (funding_method is not `none`). */
6637
- purchase?: CreditGrantPurchaseInput;
6638
- /**
6639
- * Tax configuration for the grant.
6609
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
6610
+ * $100.00, the total
6611
+ * charge is $50.00. The value must be greater than 0. If the
6612
+ * cost basis is 0, use `funding_method=none` instead.
6640
6613
  *
6641
- * For `invoice` and `external` funding methods, tax configuration should be
6642
- * provided to ensure correct revenue recognition. When not provided, the default
6643
- * credit grant tax code is applied, if that's not set the global default taxcode
6644
- * is used.
6614
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
6615
+ * to 1.0 when neither is provided.
6645
6616
  */
6646
- taxConfig?: CreditGrantTaxConfig;
6647
- /** Available when `funding_method` is `invoice`. */
6648
- invoice?: CreditGrantInvoiceReference;
6649
- filters?: CreditGrantFilters;
6650
- /** Draw-down priority of the grant. Lower values have higher priority. */
6651
- priority?: number;
6617
+ perUnitCostBasis?: string;
6652
6618
  /**
6653
- * The timestamp when the credit grant becomes effective.
6654
- *
6655
- * Defaults to the current date and time.
6619
+ * The rate the purchase is settled at in the purchase `currency`. Present once the
6620
+ * cost basis is resolved.
6656
6621
  */
6657
- effectiveAt?: Date;
6622
+ resolvedCostBasis?: ChargeResolvedCostBasis;
6658
6623
  /**
6659
- * Idempotency key for the credit grant creation request.
6660
- *
6661
- * Unique per customer: reusing the same key for the same customer returns an HTTP
6662
- * 409 Conflict instead of creating a duplicate grant, which makes create requests
6663
- * safe to retry. The same key may be reused across different customers.
6624
+ * The purchase amount, calculated from the resolved cost basis and credit
6625
+ * `amount`. Present once the cost basis is resolved.
6664
6626
  */
6665
- key?: string;
6627
+ amount?: string;
6666
6628
  /**
6667
- * The timestamp when the credit grant expires.
6629
+ * Controls when credits become available for consumption.
6668
6630
  *
6669
- * Calculated from the grant effective time and `expires_after` if provided.
6631
+ * Defaults to `on_creation`.
6670
6632
  */
6671
- expiresAt?: Date;
6672
- /** Timestamp when the grant was voided. */
6673
- voidedAt?: Date;
6674
- /** Current lifecycle status of the grant. */
6675
- status: 'pending' | 'active' | 'expired' | 'voided';
6633
+ availabilityPolicy?: 'on_creation';
6634
+ /** Current payment settlement status. */
6635
+ settlementStatus?: 'pending' | 'authorized' | 'settled';
6676
6636
  }
6677
6637
  /** Tax settings for a billing workflow. */
6678
6638
  export interface WorkflowTaxSettingsInput {
@@ -6890,10 +6850,145 @@ export interface UpdateInvoiceWorkflowSettingsInput {
6890
6850
  */
6891
6851
  workflow: UpdateBillingInvoiceWorkflowInput;
6892
6852
  }
6893
- /** Page paginated response. */
6894
- export interface CreditGrantPagePaginatedResponseInput {
6895
- data: CreditGrantInput[];
6896
- meta: PaginatedMeta;
6853
+ /** CreditGrant create request. */
6854
+ export interface CreateCreditGrantRequestInput {
6855
+ /**
6856
+ * Display name of the resource.
6857
+ *
6858
+ * Between 1 and 256 characters.
6859
+ */
6860
+ name: string;
6861
+ /**
6862
+ * Optional description of the resource.
6863
+ *
6864
+ * Maximum 1024 characters.
6865
+ */
6866
+ description?: string;
6867
+ labels?: CreateLabels;
6868
+ /** Funding method of the grant. */
6869
+ fundingMethod: 'none' | 'invoice' | 'external';
6870
+ /**
6871
+ * The fiat or custom currency of the granted credits.
6872
+ *
6873
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
6874
+ * fiat currency.
6875
+ */
6876
+ currency: CreateCurrencyCode;
6877
+ /** Granted credit amount. */
6878
+ amount: string;
6879
+ /** Present when a funding workflow applies (funding_method is not `none`). */
6880
+ purchase?: CreateCreditGrantPurchaseInput;
6881
+ /**
6882
+ * Tax configuration for the grant.
6883
+ *
6884
+ * For `invoice` and `external` funding methods, tax configuration should be
6885
+ * provided to ensure correct revenue recognition. When not provided, the default
6886
+ * credit grant tax code is applied, if that's not set the global default taxcode
6887
+ * is used.
6888
+ */
6889
+ taxConfig?: CreateCreditGrantTaxConfig;
6890
+ filters?: CreateCreditGrantFilters;
6891
+ /** Draw-down priority of the grant. Lower values have higher priority. */
6892
+ priority?: number;
6893
+ /**
6894
+ * The timestamp when the credit grant becomes effective.
6895
+ *
6896
+ * Defaults to the current date and time.
6897
+ */
6898
+ effectiveAt?: Date;
6899
+ /**
6900
+ * The duration after which the credit grant expires.
6901
+ *
6902
+ * Defaults to never expiring.
6903
+ */
6904
+ expiresAfter?: string;
6905
+ /**
6906
+ * Idempotency key for the credit grant creation request.
6907
+ *
6908
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
6909
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
6910
+ * safe to retry. The same key may be reused across different customers.
6911
+ */
6912
+ key?: string;
6913
+ }
6914
+ /**
6915
+ * A credit grant allocates credits to a customer.
6916
+ *
6917
+ * Credits are drawn down against charges according to the settlement mode
6918
+ * configured on the rate card.
6919
+ */
6920
+ export interface CreditGrantInput {
6921
+ id: string;
6922
+ /**
6923
+ * Display name of the resource.
6924
+ *
6925
+ * Between 1 and 256 characters.
6926
+ */
6927
+ name: string;
6928
+ /**
6929
+ * Optional description of the resource.
6930
+ *
6931
+ * Maximum 1024 characters.
6932
+ */
6933
+ description?: string;
6934
+ labels?: Labels;
6935
+ /** An ISO-8601 timestamp representation of entity creation date. */
6936
+ createdAt: Date;
6937
+ /** An ISO-8601 timestamp representation of entity last update date. */
6938
+ updatedAt: Date;
6939
+ /** An ISO-8601 timestamp representation of entity deletion date. */
6940
+ deletedAt?: Date;
6941
+ /** Funding method of the grant. */
6942
+ fundingMethod: 'none' | 'invoice' | 'external';
6943
+ /**
6944
+ * The fiat or custom currency of the granted credits.
6945
+ *
6946
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
6947
+ * fiat currency.
6948
+ */
6949
+ currency: BillingCurrencyCode;
6950
+ /** Granted credit amount. */
6951
+ amount: string;
6952
+ /** Present when a funding workflow applies (funding_method is not `none`). */
6953
+ purchase?: CreditGrantPurchaseInput;
6954
+ /**
6955
+ * Tax configuration for the grant.
6956
+ *
6957
+ * For `invoice` and `external` funding methods, tax configuration should be
6958
+ * provided to ensure correct revenue recognition. When not provided, the default
6959
+ * credit grant tax code is applied, if that's not set the global default taxcode
6960
+ * is used.
6961
+ */
6962
+ taxConfig?: CreditGrantTaxConfig;
6963
+ /** Available when `funding_method` is `invoice`. */
6964
+ invoice?: CreditGrantInvoiceReference;
6965
+ filters?: CreditGrantFilters;
6966
+ /** Draw-down priority of the grant. Lower values have higher priority. */
6967
+ priority?: number;
6968
+ /**
6969
+ * The timestamp when the credit grant becomes effective.
6970
+ *
6971
+ * Defaults to the current date and time.
6972
+ */
6973
+ effectiveAt?: Date;
6974
+ /**
6975
+ * Idempotency key for the credit grant creation request.
6976
+ *
6977
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
6978
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
6979
+ * safe to retry. The same key may be reused across different customers.
6980
+ */
6981
+ key?: string;
6982
+ /**
6983
+ * The timestamp when the credit grant expires.
6984
+ *
6985
+ * Calculated from the grant effective time and `expires_after` if provided.
6986
+ */
6987
+ expiresAt?: Date;
6988
+ /** Timestamp when the grant was voided. */
6989
+ voidedAt?: Date;
6990
+ /** Current lifecycle status of the grant. */
6991
+ status: 'pending' | 'active' | 'expired' | 'voided';
6897
6992
  }
6898
6993
  /** Bad Request. */
6899
6994
  export interface BadRequestInput extends BaseErrorInput {
@@ -7205,6 +7300,11 @@ export interface CreateChargeUsageBasedRequestInput {
7205
7300
  /** The billing period the charge belongs to. */
7206
7301
  billingPeriod?: ClosedPeriod;
7207
7302
  }
7303
+ /** Page paginated response. */
7304
+ export interface CreditGrantPagePaginatedResponseInput {
7305
+ data: CreditGrantInput[];
7306
+ meta: PaginatedMeta;
7307
+ }
7208
7308
  /** Billing workflow settings. */
7209
7309
  export interface WorkflowInput {
7210
7310
  /** The collection settings for this workflow */