@openmeter/client 1.0.0-beta-a175676db126 → 1.0.0-beta-32d2b94f6086

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.
@@ -3470,70 +3447,88 @@ export interface PricePagePaginatedResponse {
3470
3447
  data: LlmCostPrice[];
3471
3448
  meta: PaginatedMeta;
3472
3449
  }
3473
- /** CreditGrant create request. */
3474
- export interface CreateCreditGrantRequest {
3450
+ /** Purchase and payment terms of the grant. */
3451
+ export interface CreateCreditGrantPurchase {
3475
3452
  /**
3476
- * Display name of the resource.
3453
+ * Fiat currency the purchase is settled in.
3477
3454
  *
3478
- * Between 1 and 256 characters.
3455
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
3456
+ * for custom-currency grants.
3479
3457
  */
3480
- name: string;
3458
+ currency: string;
3481
3459
  /**
3482
- * Optional description of the resource.
3460
+ * Fiat cost basis per credit unit of a fiat-currency grant.
3483
3461
  *
3484
- * Maximum 1024 characters.
3462
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
3463
+ * $100.00, the total
3464
+ * charge is $50.00. The value must be greater than 0. If the
3465
+ * cost basis is 0, use `funding_method=none` instead.
3466
+ *
3467
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
3468
+ * to 1.0 when neither is provided.
3485
3469
  */
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;
3470
+ perUnitCostBasis?: string;
3496
3471
  /**
3497
- * Tax configuration for the grant.
3472
+ * Defines how custom-currency credits are priced in the purchase `currency`; the
3473
+ * resolved rate is exposed through `resolved_cost_basis`.
3498
3474
  *
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.
3475
+ * Fiat grants accept only a `manual` cost basis without `fiat_currency`, where
3476
+ * `rate` is the fiat cost per credit unit. Custom-currency grants require a cost
3477
+ * basis of any type with `fiat_currency` set and equal to the purchase `currency`.
3478
+ * A `dynamic` cost basis is resolved at the grant's effective time, so the
3479
+ * currency cost basis must be effective by then. Cannot be combined with
3480
+ * `per_unit_cost_basis`.
3503
3481
  */
3504
- taxConfig?: CreateCreditGrantTaxConfig;
3505
- filters?: CreateCreditGrantFilters;
3506
- /** Draw-down priority of the grant. Lower values have higher priority. */
3507
- priority: number;
3482
+ costBasis?: CreateChargeCostBasis;
3508
3483
  /**
3509
- * The timestamp when the credit grant becomes effective.
3484
+ * Controls when credits become available for consumption.
3510
3485
  *
3511
- * Defaults to the current date and time.
3486
+ * Defaults to `on_creation`.
3512
3487
  */
3513
- effectiveAt?: Date;
3488
+ availabilityPolicy: 'on_creation';
3489
+ }
3490
+ /** Purchase and payment terms of the grant. */
3491
+ export interface CreditGrantPurchase {
3514
3492
  /**
3515
- * The duration after which the credit grant expires.
3493
+ * Fiat currency the purchase is settled in.
3516
3494
  *
3517
- * Defaults to never expiring.
3495
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
3496
+ * for custom-currency grants.
3518
3497
  */
3519
- expiresAfter?: string;
3498
+ currency: string;
3520
3499
  /**
3521
- * Idempotency key for the credit grant creation request.
3500
+ * Fiat cost basis per credit unit of a fiat-currency grant.
3522
3501
  *
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.
3502
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
3503
+ * $100.00, the total
3504
+ * charge is $50.00. The value must be greater than 0. If the
3505
+ * cost basis is 0, use `funding_method=none` instead.
3506
+ *
3507
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
3508
+ * to 1.0 when neither is provided.
3526
3509
  */
3527
- key?: string;
3510
+ perUnitCostBasis?: string;
3511
+ /**
3512
+ * The rate the purchase is settled at in the purchase `currency`. Present once the
3513
+ * cost basis is resolved.
3514
+ */
3515
+ resolvedCostBasis?: ChargeResolvedCostBasis;
3516
+ /**
3517
+ * The purchase amount, calculated from the resolved cost basis and credit
3518
+ * `amount`. Present once the cost basis is resolved.
3519
+ */
3520
+ amount?: string;
3521
+ /**
3522
+ * Controls when credits become available for consumption.
3523
+ *
3524
+ * Defaults to `on_creation`.
3525
+ */
3526
+ availabilityPolicy: 'on_creation';
3527
+ /** Current payment settlement status. */
3528
+ settlementStatus?: 'pending' | 'authorized' | 'settled';
3528
3529
  }
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;
3530
+ /** Flat fee charge create request. */
3531
+ export interface CreateChargeFlatFeeRequest {
3537
3532
  /**
3538
3533
  * Display name of the resource.
3539
3534
  *
@@ -3547,107 +3542,15 @@ export interface CreditGrant {
3547
3542
  */
3548
3543
  description?: string;
3549
3544
  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. */
3545
+ /** The type of the charge. */
3546
+ type: 'flat_fee';
3547
+ /** The currency of the charge. */
3559
3548
  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
3549
  /**
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.
3550
+ * Defines how a custom-currency charge is converted into its fiat invoice
3551
+ * currency; the resolved rate is exposed through `resolved_cost_basis`. Required
3552
+ * when `currency` is custom and the charge settles as `credit_then_invoice`; must
3553
+ * be omitted otherwise.
3651
3554
  */
3652
3555
  costBasis?: ChargeCostBasis;
3653
3556
  /** The timestamp when the charge is intended to be invoiced. */
@@ -3675,6 +3578,30 @@ export interface CreateChargeFlatFeeRequest {
3675
3578
  /** The billing period the charge belongs to. */
3676
3579
  billingPeriod?: ClosedPeriod;
3677
3580
  }
3581
+ /** Tax settings for a billing workflow. */
3582
+ export interface WorkflowTaxSettings {
3583
+ /**
3584
+ * Enable automatic tax calculation when tax is supported by the app. For example,
3585
+ * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.
3586
+ */
3587
+ enabled: boolean;
3588
+ /**
3589
+ * Enforce tax calculation when tax is supported by the app. When enabled, the
3590
+ * billing system will not allow to create an invoice without tax calculation.
3591
+ * Enforcement is different per apps, for example, Stripe app requires customer to
3592
+ * have a tax location when starting a paid subscription.
3593
+ */
3594
+ enforced: boolean;
3595
+ /**
3596
+ * Default tax configuration to apply to the invoices for line items.
3597
+ *
3598
+ * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax
3599
+ * config is deprecated and can no longer be added or changed: the organization
3600
+ * default tax code is used instead. Existing tax-code values may still be removed,
3601
+ * and `behavior` remains fully supported.
3602
+ */
3603
+ defaultTaxConfig?: TaxConfig;
3604
+ }
3678
3605
  /** Page paginated response. */
3679
3606
  export interface PlanAddonPagePaginatedResponse {
3680
3607
  data: PlanAddon[];
@@ -4305,10 +4232,145 @@ export interface UpdateFeatureRequest {
4305
4232
  */
4306
4233
  unitCost?: FeatureUnitCost | null;
4307
4234
  }
4308
- /** Page paginated response. */
4309
- export interface CreditGrantPagePaginatedResponse {
4310
- data: CreditGrant[];
4311
- meta: PaginatedMeta;
4235
+ /** CreditGrant create request. */
4236
+ export interface CreateCreditGrantRequest {
4237
+ /**
4238
+ * Display name of the resource.
4239
+ *
4240
+ * Between 1 and 256 characters.
4241
+ */
4242
+ name: string;
4243
+ /**
4244
+ * Optional description of the resource.
4245
+ *
4246
+ * Maximum 1024 characters.
4247
+ */
4248
+ description?: string;
4249
+ labels?: CreateLabels;
4250
+ /** Funding method of the grant. */
4251
+ fundingMethod: 'none' | 'invoice' | 'external';
4252
+ /**
4253
+ * The fiat or custom currency of the granted credits.
4254
+ *
4255
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
4256
+ * fiat currency.
4257
+ */
4258
+ currency: CreateCurrencyCode;
4259
+ /** Granted credit amount. */
4260
+ amount: string;
4261
+ /** Present when a funding workflow applies (funding_method is not `none`). */
4262
+ purchase?: CreateCreditGrantPurchase;
4263
+ /**
4264
+ * Tax configuration for the grant.
4265
+ *
4266
+ * For `invoice` and `external` funding methods, tax configuration should be
4267
+ * provided to ensure correct revenue recognition. When not provided, the default
4268
+ * credit grant tax code is applied, if that's not set the global default taxcode
4269
+ * is used.
4270
+ */
4271
+ taxConfig?: CreateCreditGrantTaxConfig;
4272
+ filters?: CreateCreditGrantFilters;
4273
+ /** Draw-down priority of the grant. Lower values have higher priority. */
4274
+ priority: number;
4275
+ /**
4276
+ * The timestamp when the credit grant becomes effective.
4277
+ *
4278
+ * Defaults to the current date and time.
4279
+ */
4280
+ effectiveAt?: Date;
4281
+ /**
4282
+ * The duration after which the credit grant expires.
4283
+ *
4284
+ * Defaults to never expiring.
4285
+ */
4286
+ expiresAfter?: string;
4287
+ /**
4288
+ * Idempotency key for the credit grant creation request.
4289
+ *
4290
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
4291
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
4292
+ * safe to retry. The same key may be reused across different customers.
4293
+ */
4294
+ key?: string;
4295
+ }
4296
+ /**
4297
+ * A credit grant allocates credits to a customer.
4298
+ *
4299
+ * Credits are drawn down against charges according to the settlement mode
4300
+ * configured on the rate card.
4301
+ */
4302
+ export interface CreditGrant {
4303
+ id: string;
4304
+ /**
4305
+ * Display name of the resource.
4306
+ *
4307
+ * Between 1 and 256 characters.
4308
+ */
4309
+ name: string;
4310
+ /**
4311
+ * Optional description of the resource.
4312
+ *
4313
+ * Maximum 1024 characters.
4314
+ */
4315
+ description?: string;
4316
+ labels?: Labels;
4317
+ /** An ISO-8601 timestamp representation of entity creation date. */
4318
+ createdAt: Date;
4319
+ /** An ISO-8601 timestamp representation of entity last update date. */
4320
+ updatedAt: Date;
4321
+ /** An ISO-8601 timestamp representation of entity deletion date. */
4322
+ deletedAt?: Date;
4323
+ /** Funding method of the grant. */
4324
+ fundingMethod: 'none' | 'invoice' | 'external';
4325
+ /**
4326
+ * The fiat or custom currency of the granted credits.
4327
+ *
4328
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
4329
+ * fiat currency.
4330
+ */
4331
+ currency: BillingCurrencyCode;
4332
+ /** Granted credit amount. */
4333
+ amount: string;
4334
+ /** Present when a funding workflow applies (funding_method is not `none`). */
4335
+ purchase?: CreditGrantPurchase;
4336
+ /**
4337
+ * Tax configuration for the grant.
4338
+ *
4339
+ * For `invoice` and `external` funding methods, tax configuration should be
4340
+ * provided to ensure correct revenue recognition. When not provided, the default
4341
+ * credit grant tax code is applied, if that's not set the global default taxcode
4342
+ * is used.
4343
+ */
4344
+ taxConfig?: CreditGrantTaxConfig;
4345
+ /** Available when `funding_method` is `invoice`. */
4346
+ invoice?: CreditGrantInvoiceReference;
4347
+ filters?: CreditGrantFilters;
4348
+ /** Draw-down priority of the grant. Lower values have higher priority. */
4349
+ priority: number;
4350
+ /**
4351
+ * The timestamp when the credit grant becomes effective.
4352
+ *
4353
+ * Defaults to the current date and time.
4354
+ */
4355
+ effectiveAt?: Date;
4356
+ /**
4357
+ * Idempotency key for the credit grant creation request.
4358
+ *
4359
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
4360
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
4361
+ * safe to retry. The same key may be reused across different customers.
4362
+ */
4363
+ key?: string;
4364
+ /**
4365
+ * The timestamp when the credit grant expires.
4366
+ *
4367
+ * Calculated from the grant effective time and `expires_after` if provided.
4368
+ */
4369
+ expiresAt?: Date;
4370
+ /** Timestamp when the grant was voided. */
4371
+ voidedAt?: Date;
4372
+ /** Current lifecycle status of the grant. */
4373
+ status: 'pending' | 'active' | 'expired' | 'voided';
4312
4374
  }
4313
4375
  /** Page paginated response. */
4314
4376
  export interface CurrencyPagePaginatedResponse {
@@ -4704,6 +4766,11 @@ export interface UpdateInvoiceLineRateCard {
4704
4766
  /** Discount configuration from the rate card. */
4705
4767
  discounts?: UpdateDiscounts;
4706
4768
  }
4769
+ /** Page paginated response. */
4770
+ export interface CreditGrantPagePaginatedResponse {
4771
+ data: CreditGrant[];
4772
+ meta: PaginatedMeta;
4773
+ }
4707
4774
  /** Billing workflow settings. */
4708
4775
  export interface Workflow {
4709
4776
  /** The collection settings for this workflow */
@@ -6056,6 +6123,11 @@ export type SubscriptionEditTiming = 'immediate' | 'next_billing_cycle' | Date;
6056
6123
  export type InstallAppRequest = InstallAppStripeWithApiKey | InstallAppSandbox | InstallAppExternalInvoicing;
6057
6124
  /** Payment settings for a billing workflow. */
6058
6125
  export type UpdateBillingWorkflowPaymentSettings = UpdateBillingWorkflowPaymentChargeAutomaticallySettings | UpdateBillingWorkflowPaymentSendInvoiceSettings;
6126
+ /**
6127
+ * Cost basis selection for a custom-currency charge. The variant chosen fixes when
6128
+ * and how the conversion rate is determined.
6129
+ */
6130
+ export type CreateChargeCostBasis = CreateChargeCostBasisDynamic | CreateChargeCostBasisPinned | CreateChargeCostBasisManual;
6059
6131
  /**
6060
6132
  * Cost basis selection for a custom-currency charge. The variant chosen fixes when
6061
6133
  * and how the conversion rate is determined.
@@ -6338,28 +6410,6 @@ export interface AppStripeCreateCheckoutSessionTaxIdCollectionInput {
6338
6410
  */
6339
6411
  required?: 'if_supported' | 'never';
6340
6412
  }
6341
- /** Purchase and payment terms of the grant. */
6342
- export interface CreateCreditGrantPurchaseInput {
6343
- /** Currency of the purchase amount. */
6344
- currency: string;
6345
- /**
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.
6354
- */
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
6413
  /** The entitlement template of a metered entitlement. */
6364
6414
  export interface RateCardMeteredEntitlementInput {
6365
6415
  /** The type of the entitlement template. */
@@ -6382,32 +6432,6 @@ export interface RateCardMeteredEntitlementInput {
6382
6432
  */
6383
6433
  usagePeriod?: string;
6384
6434
  }
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
6435
  /** Request body for voiding a credit grant. */
6412
6436
  export interface VoidCreditGrantRequestInput {
6413
6437
  /**
@@ -6544,135 +6568,85 @@ export interface UpdateBillingInvoiceWorkflowInput {
6544
6568
  /** Payment settings for this invoice. */
6545
6569
  payment?: UpdateBillingWorkflowPaymentSettingsInput;
6546
6570
  }
6547
- /** CreditGrant create request. */
6548
- export interface CreateCreditGrantRequestInput {
6549
- /**
6550
- * Display name of the resource.
6551
- *
6552
- * Between 1 and 256 characters.
6553
- */
6554
- name: string;
6571
+ /** Purchase and payment terms of the grant. */
6572
+ export interface CreateCreditGrantPurchaseInput {
6555
6573
  /**
6556
- * Optional description of the resource.
6574
+ * Fiat currency the purchase is settled in.
6557
6575
  *
6558
- * Maximum 1024 characters.
6576
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
6577
+ * for custom-currency grants.
6559
6578
  */
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;
6579
+ currency: string;
6570
6580
  /**
6571
- * Tax configuration for the grant.
6581
+ * Fiat cost basis per credit unit of a fiat-currency grant.
6572
6582
  *
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.
6577
- */
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.
6583
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
6584
+ * $100.00, the total
6585
+ * charge is $50.00. The value must be greater than 0. If the
6586
+ * cost basis is 0, use `funding_method=none` instead.
6584
6587
  *
6585
- * Defaults to the current date and time.
6588
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
6589
+ * to 1.0 when neither is provided.
6586
6590
  */
6587
- effectiveAt?: Date;
6591
+ perUnitCostBasis?: string;
6588
6592
  /**
6589
- * The duration after which the credit grant expires.
6593
+ * Defines how custom-currency credits are priced in the purchase `currency`; the
6594
+ * resolved rate is exposed through `resolved_cost_basis`.
6590
6595
  *
6591
- * Defaults to never expiring.
6596
+ * Fiat grants accept only a `manual` cost basis without `fiat_currency`, where
6597
+ * `rate` is the fiat cost per credit unit. Custom-currency grants require a cost
6598
+ * basis of any type with `fiat_currency` set and equal to the purchase `currency`.
6599
+ * A `dynamic` cost basis is resolved at the grant's effective time, so the
6600
+ * currency cost basis must be effective by then. Cannot be combined with
6601
+ * `per_unit_cost_basis`.
6592
6602
  */
6593
- expiresAfter?: string;
6603
+ costBasis?: CreateChargeCostBasis;
6594
6604
  /**
6595
- * Idempotency key for the credit grant creation request.
6605
+ * Controls when credits become available for consumption.
6596
6606
  *
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.
6607
+ * Defaults to `on_creation`.
6600
6608
  */
6601
- key?: string;
6609
+ availabilityPolicy?: 'on_creation';
6602
6610
  }
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;
6611
+ /** Purchase and payment terms of the grant. */
6612
+ export interface CreditGrantPurchaseInput {
6611
6613
  /**
6612
- * Display name of the resource.
6614
+ * Fiat currency the purchase is settled in.
6613
6615
  *
6614
- * Between 1 and 256 characters.
6616
+ * Must equal the grant `currency` for fiat grants and `cost_basis.fiat_currency`
6617
+ * for custom-currency grants.
6615
6618
  */
6616
- name: string;
6619
+ currency: string;
6617
6620
  /**
6618
- * Optional description of the resource.
6621
+ * Fiat cost basis per credit unit of a fiat-currency grant.
6619
6622
  *
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.
6623
+ * If `per_unit_cost_basis` is 0.50 and credit amount is
6624
+ * $100.00, the total
6625
+ * charge is $50.00. The value must be greater than 0. If the
6626
+ * cost basis is 0, use `funding_method=none` instead.
6640
6627
  *
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.
6628
+ * Only applies to fiat grants and cannot be combined with `cost_basis`. Defaults
6629
+ * to 1.0 when neither is provided.
6645
6630
  */
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;
6631
+ perUnitCostBasis?: string;
6652
6632
  /**
6653
- * The timestamp when the credit grant becomes effective.
6654
- *
6655
- * Defaults to the current date and time.
6633
+ * The rate the purchase is settled at in the purchase `currency`. Present once the
6634
+ * cost basis is resolved.
6656
6635
  */
6657
- effectiveAt?: Date;
6636
+ resolvedCostBasis?: ChargeResolvedCostBasis;
6658
6637
  /**
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.
6638
+ * The purchase amount, calculated from the resolved cost basis and credit
6639
+ * `amount`. Present once the cost basis is resolved.
6664
6640
  */
6665
- key?: string;
6641
+ amount?: string;
6666
6642
  /**
6667
- * The timestamp when the credit grant expires.
6643
+ * Controls when credits become available for consumption.
6668
6644
  *
6669
- * Calculated from the grant effective time and `expires_after` if provided.
6645
+ * Defaults to `on_creation`.
6670
6646
  */
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';
6647
+ availabilityPolicy?: 'on_creation';
6648
+ /** Current payment settlement status. */
6649
+ settlementStatus?: 'pending' | 'authorized' | 'settled';
6676
6650
  }
6677
6651
  /** Tax settings for a billing workflow. */
6678
6652
  export interface WorkflowTaxSettingsInput {
@@ -6890,10 +6864,145 @@ export interface UpdateInvoiceWorkflowSettingsInput {
6890
6864
  */
6891
6865
  workflow: UpdateBillingInvoiceWorkflowInput;
6892
6866
  }
6893
- /** Page paginated response. */
6894
- export interface CreditGrantPagePaginatedResponseInput {
6895
- data: CreditGrantInput[];
6896
- meta: PaginatedMeta;
6867
+ /** CreditGrant create request. */
6868
+ export interface CreateCreditGrantRequestInput {
6869
+ /**
6870
+ * Display name of the resource.
6871
+ *
6872
+ * Between 1 and 256 characters.
6873
+ */
6874
+ name: string;
6875
+ /**
6876
+ * Optional description of the resource.
6877
+ *
6878
+ * Maximum 1024 characters.
6879
+ */
6880
+ description?: string;
6881
+ labels?: CreateLabels;
6882
+ /** Funding method of the grant. */
6883
+ fundingMethod: 'none' | 'invoice' | 'external';
6884
+ /**
6885
+ * The fiat or custom currency of the granted credits.
6886
+ *
6887
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
6888
+ * fiat currency.
6889
+ */
6890
+ currency: CreateCurrencyCode;
6891
+ /** Granted credit amount. */
6892
+ amount: string;
6893
+ /** Present when a funding workflow applies (funding_method is not `none`). */
6894
+ purchase?: CreateCreditGrantPurchaseInput;
6895
+ /**
6896
+ * Tax configuration for the grant.
6897
+ *
6898
+ * For `invoice` and `external` funding methods, tax configuration should be
6899
+ * provided to ensure correct revenue recognition. When not provided, the default
6900
+ * credit grant tax code is applied, if that's not set the global default taxcode
6901
+ * is used.
6902
+ */
6903
+ taxConfig?: CreateCreditGrantTaxConfig;
6904
+ filters?: CreateCreditGrantFilters;
6905
+ /** Draw-down priority of the grant. Lower values have higher priority. */
6906
+ priority?: number;
6907
+ /**
6908
+ * The timestamp when the credit grant becomes effective.
6909
+ *
6910
+ * Defaults to the current date and time.
6911
+ */
6912
+ effectiveAt?: Date;
6913
+ /**
6914
+ * The duration after which the credit grant expires.
6915
+ *
6916
+ * Defaults to never expiring.
6917
+ */
6918
+ expiresAfter?: string;
6919
+ /**
6920
+ * Idempotency key for the credit grant creation request.
6921
+ *
6922
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
6923
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
6924
+ * safe to retry. The same key may be reused across different customers.
6925
+ */
6926
+ key?: string;
6927
+ }
6928
+ /**
6929
+ * A credit grant allocates credits to a customer.
6930
+ *
6931
+ * Credits are drawn down against charges according to the settlement mode
6932
+ * configured on the rate card.
6933
+ */
6934
+ export interface CreditGrantInput {
6935
+ id: string;
6936
+ /**
6937
+ * Display name of the resource.
6938
+ *
6939
+ * Between 1 and 256 characters.
6940
+ */
6941
+ name: string;
6942
+ /**
6943
+ * Optional description of the resource.
6944
+ *
6945
+ * Maximum 1024 characters.
6946
+ */
6947
+ description?: string;
6948
+ labels?: Labels;
6949
+ /** An ISO-8601 timestamp representation of entity creation date. */
6950
+ createdAt: Date;
6951
+ /** An ISO-8601 timestamp representation of entity last update date. */
6952
+ updatedAt: Date;
6953
+ /** An ISO-8601 timestamp representation of entity deletion date. */
6954
+ deletedAt?: Date;
6955
+ /** Funding method of the grant. */
6956
+ fundingMethod: 'none' | 'invoice' | 'external';
6957
+ /**
6958
+ * The fiat or custom currency of the granted credits.
6959
+ *
6960
+ * Funded custom-currency grants must define `purchase.cost_basis` to settle in a
6961
+ * fiat currency.
6962
+ */
6963
+ currency: BillingCurrencyCode;
6964
+ /** Granted credit amount. */
6965
+ amount: string;
6966
+ /** Present when a funding workflow applies (funding_method is not `none`). */
6967
+ purchase?: CreditGrantPurchaseInput;
6968
+ /**
6969
+ * Tax configuration for the grant.
6970
+ *
6971
+ * For `invoice` and `external` funding methods, tax configuration should be
6972
+ * provided to ensure correct revenue recognition. When not provided, the default
6973
+ * credit grant tax code is applied, if that's not set the global default taxcode
6974
+ * is used.
6975
+ */
6976
+ taxConfig?: CreditGrantTaxConfig;
6977
+ /** Available when `funding_method` is `invoice`. */
6978
+ invoice?: CreditGrantInvoiceReference;
6979
+ filters?: CreditGrantFilters;
6980
+ /** Draw-down priority of the grant. Lower values have higher priority. */
6981
+ priority?: number;
6982
+ /**
6983
+ * The timestamp when the credit grant becomes effective.
6984
+ *
6985
+ * Defaults to the current date and time.
6986
+ */
6987
+ effectiveAt?: Date;
6988
+ /**
6989
+ * Idempotency key for the credit grant creation request.
6990
+ *
6991
+ * Unique per customer: reusing the same key for the same customer returns an HTTP
6992
+ * 409 Conflict instead of creating a duplicate grant, which makes create requests
6993
+ * safe to retry. The same key may be reused across different customers.
6994
+ */
6995
+ key?: string;
6996
+ /**
6997
+ * The timestamp when the credit grant expires.
6998
+ *
6999
+ * Calculated from the grant effective time and `expires_after` if provided.
7000
+ */
7001
+ expiresAt?: Date;
7002
+ /** Timestamp when the grant was voided. */
7003
+ voidedAt?: Date;
7004
+ /** Current lifecycle status of the grant. */
7005
+ status: 'pending' | 'active' | 'expired' | 'voided';
6897
7006
  }
6898
7007
  /** Bad Request. */
6899
7008
  export interface BadRequestInput extends BaseErrorInput {
@@ -7205,6 +7314,11 @@ export interface CreateChargeUsageBasedRequestInput {
7205
7314
  /** The billing period the charge belongs to. */
7206
7315
  billingPeriod?: ClosedPeriod;
7207
7316
  }
7317
+ /** Page paginated response. */
7318
+ export interface CreditGrantPagePaginatedResponseInput {
7319
+ data: CreditGrantInput[];
7320
+ meta: PaginatedMeta;
7321
+ }
7208
7322
  /** Billing workflow settings. */
7209
7323
  export interface WorkflowInput {
7210
7324
  /** The collection settings for this workflow */