forked from orbcorp/orb-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbetaexternalplanid.go
More file actions
1307 lines (1161 loc) · 94.8 KB
/
betaexternalplanid.go
File metadata and controls
1307 lines (1161 loc) · 94.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package orb
import (
"context"
"errors"
"fmt"
"net/http"
"github.com/orbcorp/orb-go/internal/apijson"
"github.com/orbcorp/orb-go/internal/param"
"github.com/orbcorp/orb-go/internal/requestconfig"
"github.com/orbcorp/orb-go/option"
"github.com/orbcorp/orb-go/shared"
)
// BetaExternalPlanIDService contains methods and other services that help with
// interacting with the orb API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewBetaExternalPlanIDService] method instead.
type BetaExternalPlanIDService struct {
Options []option.RequestOption
}
// NewBetaExternalPlanIDService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewBetaExternalPlanIDService(opts ...option.RequestOption) (r *BetaExternalPlanIDService) {
r = &BetaExternalPlanIDService{}
r.Options = opts
return
}
// This API endpoint is in beta and its interface may change. It is recommended for
// use only in test mode.
//
// This endpoint allows the creation of a new plan version for an existing plan.
func (r *BetaExternalPlanIDService) NewPlanVersion(ctx context.Context, externalPlanID string, body BetaExternalPlanIDNewPlanVersionParams, opts ...option.RequestOption) (res *PlanVersion, err error) {
opts = append(r.Options[:], opts...)
if externalPlanID == "" {
err = errors.New("missing required external_plan_id parameter")
return
}
path := fmt.Sprintf("plans/external_plan_id/%s/versions", externalPlanID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// This API endpoint is in beta and its interface may change. It is recommended for
// use only in test mode.
//
// This endpoint is used to fetch a plan version. It returns the phases, prices,
// and adjustments present on this version of the plan.
func (r *BetaExternalPlanIDService) FetchPlanVersion(ctx context.Context, externalPlanID string, version string, opts ...option.RequestOption) (res *PlanVersion, err error) {
opts = append(r.Options[:], opts...)
if externalPlanID == "" {
err = errors.New("missing required external_plan_id parameter")
return
}
if version == "" {
err = errors.New("missing required version parameter")
return
}
path := fmt.Sprintf("plans/external_plan_id/%s/versions/%s", externalPlanID, version)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// This API endpoint is in beta and its interface may change. It is recommended for
// use only in test mode.
//
// This endpoint allows setting the default version of a plan.
func (r *BetaExternalPlanIDService) SetDefaultPlanVersion(ctx context.Context, externalPlanID string, body BetaExternalPlanIDSetDefaultPlanVersionParams, opts ...option.RequestOption) (res *Plan, err error) {
opts = append(r.Options[:], opts...)
if externalPlanID == "" {
err = errors.New("missing required external_plan_id parameter")
return
}
path := fmt.Sprintf("plans/external_plan_id/%s/set_default_version", externalPlanID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
type BetaExternalPlanIDNewPlanVersionParams struct {
// New version number.
Version param.Field[int64] `json:"version,required"`
// Additional adjustments to be added to the plan.
AddAdjustments param.Field[[]BetaExternalPlanIDNewPlanVersionParamsAddAdjustment] `json:"add_adjustments"`
// Additional prices to be added to the plan.
AddPrices param.Field[[]BetaExternalPlanIDNewPlanVersionParamsAddPrice] `json:"add_prices"`
// Adjustments to be removed from the plan.
RemoveAdjustments param.Field[[]BetaExternalPlanIDNewPlanVersionParamsRemoveAdjustment] `json:"remove_adjustments"`
// Prices to be removed from the plan.
RemovePrices param.Field[[]BetaExternalPlanIDNewPlanVersionParamsRemovePrice] `json:"remove_prices"`
// Adjustments to be replaced with additional adjustments on the plan.
ReplaceAdjustments param.Field[[]BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustment] `json:"replace_adjustments"`
// Prices to be replaced with additional prices on the plan.
ReplacePrices param.Field[[]BetaExternalPlanIDNewPlanVersionParamsReplacePrice] `json:"replace_prices"`
// Set this new plan version as the default
SetAsDefault param.Field[bool] `json:"set_as_default"`
}
func (r BetaExternalPlanIDNewPlanVersionParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BetaExternalPlanIDNewPlanVersionParamsAddAdjustment struct {
// The definition of a new adjustment to create and add to the plan.
Adjustment param.Field[BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentUnion] `json:"adjustment,required"`
// The phase to add this adjustment to.
PlanPhaseOrder param.Field[int64] `json:"plan_phase_order"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddAdjustment) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The definition of a new adjustment to create and add to the plan.
type BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustment struct {
AdjustmentType param.Field[BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType] `json:"adjustment_type,required"`
AmountDiscount param.Field[string] `json:"amount_discount"`
// If set, the adjustment will apply to every price on the subscription.
AppliesToAll param.Field[BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAppliesToAll] `json:"applies_to_all"`
AppliesToItemIDs param.Field[interface{}] `json:"applies_to_item_ids"`
AppliesToPriceIDs param.Field[interface{}] `json:"applies_to_price_ids"`
// If set, only prices in the specified currency will have the adjustment applied.
Currency param.Field[string] `json:"currency"`
Filters param.Field[interface{}] `json:"filters"`
// When false, this adjustment will be applied to a single price. Otherwise, it
// will be applied at the invoice level, possibly to multiple prices.
IsInvoiceLevel param.Field[bool] `json:"is_invoice_level"`
// The item ID that revenue from this minimum will be attributed to.
ItemID param.Field[string] `json:"item_id"`
MaximumAmount param.Field[string] `json:"maximum_amount"`
MinimumAmount param.Field[string] `json:"minimum_amount"`
PercentageDiscount param.Field[float64] `json:"percentage_discount"`
// If set, only prices of the specified type will have the adjustment applied.
PriceType param.Field[BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType] `json:"price_type"`
UsageDiscount param.Field[float64] `json:"usage_discount"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustment) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustment) ImplementsBetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentUnion() {
}
// The definition of a new adjustment to create and add to the plan.
//
// Satisfied by [shared.NewPercentageDiscountParam],
// [shared.NewUsageDiscountParam], [shared.NewAmountDiscountParam],
// [shared.NewMinimumParam], [shared.NewMaximumParam],
// [BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustment].
type BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentUnion interface {
ImplementsBetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentUnion()
}
type BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType string
const (
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypePercentageDiscount BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType = "percentage_discount"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeUsageDiscount BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType = "usage_discount"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeAmountDiscount BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType = "amount_discount"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeMinimum BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType = "minimum"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeMaximum BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType = "maximum"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypePercentageDiscount, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeUsageDiscount, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeAmountDiscount, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeMinimum, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAdjustmentTypeMaximum:
return true
}
return false
}
// If set, the adjustment will apply to every price on the subscription.
type BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAppliesToAll bool
const (
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAppliesToAllTrue BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAppliesToAll = true
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAppliesToAll) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentAppliesToAllTrue:
return true
}
return false
}
// If set, only prices of the specified type will have the adjustment applied.
type BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType string
const (
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeUsage BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType = "usage"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeFixedInAdvance BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType = "fixed_in_advance"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeFixedInArrears BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType = "fixed_in_arrears"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeFixed BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType = "fixed"
BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeInArrears BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType = "in_arrears"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeUsage, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeFixedInAdvance, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeFixedInArrears, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeFixed, BetaExternalPlanIDNewPlanVersionParamsAddAdjustmentsAdjustmentPriceTypeInArrears:
return true
}
return false
}
type BetaExternalPlanIDNewPlanVersionParamsAddPrice struct {
// The allocation price to add to the plan.
AllocationPrice param.Field[shared.NewAllocationPriceParam] `json:"allocation_price"`
// The phase to add this price to.
PlanPhaseOrder param.Field[int64] `json:"plan_phase_order"`
// New plan price request body params.
Price param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceUnion] `json:"price"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// New plan price request body params.
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPrice struct {
// The cadence to bill for this price on.
Cadence param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence] `json:"cadence,required"`
// The id of the item the price will be associated with.
ItemID param.Field[string] `json:"item_id,required"`
// The pricing model type
ModelType param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType] `json:"model_type,required"`
// The name of the price.
Name param.Field[string] `json:"name,required"`
// The id of the billable metric for the price. Only needed if the price is
// usage-based.
BillableMetricID param.Field[string] `json:"billable_metric_id"`
// If the Price represents a fixed cost, the price will be billed in-advance if
// this is true, and in-arrears if this is false.
BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
// For custom cadence: specifies the duration of the billing period in days or
// months.
BillingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"billing_cycle_configuration"`
// Configuration for bulk pricing
BulkConfig param.Field[shared.BulkConfigParam] `json:"bulk_config"`
BulkWithProrationConfig param.Field[interface{}] `json:"bulk_with_proration_config"`
// The per unit conversion rate of the price currency to the invoicing currency.
ConversionRate param.Field[float64] `json:"conversion_rate"`
ConversionRateConfig param.Field[interface{}] `json:"conversion_rate_config"`
CumulativeGroupedBulkConfig param.Field[interface{}] `json:"cumulative_grouped_bulk_config"`
// An ISO 4217 currency string, or custom pricing unit identifier, in which this
// price is billed.
Currency param.Field[string] `json:"currency"`
// For dimensional price: specifies a price group and dimension values
DimensionalPriceConfiguration param.Field[shared.NewDimensionalPriceConfigurationParam] `json:"dimensional_price_configuration"`
// An alias for the price.
ExternalPriceID param.Field[string] `json:"external_price_id"`
// If the Price represents a fixed cost, this represents the quantity of units
// applied.
FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
GroupedAllocationConfig param.Field[interface{}] `json:"grouped_allocation_config"`
GroupedTieredConfig param.Field[interface{}] `json:"grouped_tiered_config"`
GroupedTieredPackageConfig param.Field[interface{}] `json:"grouped_tiered_package_config"`
GroupedWithMeteredMinimumConfig param.Field[interface{}] `json:"grouped_with_metered_minimum_config"`
GroupedWithMinMaxThresholdsConfig param.Field[interface{}] `json:"grouped_with_min_max_thresholds_config"`
GroupedWithProratedMinimumConfig param.Field[interface{}] `json:"grouped_with_prorated_minimum_config"`
// The property used to group this price on an invoice
InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
// Within each billing cycle, specifies the cadence at which invoices are produced.
// If unspecified, a single invoice is produced per billing cycle.
InvoicingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"invoicing_cycle_configuration"`
// Configuration for matrix pricing
MatrixConfig param.Field[shared.MatrixConfigParam] `json:"matrix_config"`
// Configuration for matrix_with_allocation pricing
MatrixWithAllocationConfig param.Field[shared.MatrixWithAllocationConfigParam] `json:"matrix_with_allocation_config"`
MatrixWithDisplayNameConfig param.Field[interface{}] `json:"matrix_with_display_name_config"`
MaxGroupTieredPackageConfig param.Field[interface{}] `json:"max_group_tiered_package_config"`
Metadata param.Field[interface{}] `json:"metadata"`
MinimumConfig param.Field[interface{}] `json:"minimum_config"`
// Configuration for package pricing
PackageConfig param.Field[shared.PackageConfigParam] `json:"package_config"`
PackageWithAllocationConfig param.Field[interface{}] `json:"package_with_allocation_config"`
// A transient ID that can be used to reference this price when adding adjustments
// in the same API call.
ReferenceID param.Field[string] `json:"reference_id"`
ScalableMatrixWithTieredPricingConfig param.Field[interface{}] `json:"scalable_matrix_with_tiered_pricing_config"`
ScalableMatrixWithUnitPricingConfig param.Field[interface{}] `json:"scalable_matrix_with_unit_pricing_config"`
ThresholdTotalAmountConfig param.Field[interface{}] `json:"threshold_total_amount_config"`
// Configuration for tiered pricing
TieredConfig param.Field[shared.TieredConfigParam] `json:"tiered_config"`
TieredPackageConfig param.Field[interface{}] `json:"tiered_package_config"`
TieredPackageWithMinimumConfig param.Field[interface{}] `json:"tiered_package_with_minimum_config"`
TieredWithMinimumConfig param.Field[interface{}] `json:"tiered_with_minimum_config"`
TieredWithProrationConfig param.Field[interface{}] `json:"tiered_with_proration_config"`
// Configuration for unit pricing
UnitConfig param.Field[shared.UnitConfigParam] `json:"unit_config"`
UnitWithPercentConfig param.Field[interface{}] `json:"unit_with_percent_config"`
UnitWithProrationConfig param.Field[interface{}] `json:"unit_with_proration_config"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPrice) ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceUnion() {
}
// New plan price request body params.
//
// Satisfied by [shared.NewPlanUnitPriceParam], [shared.NewPlanTieredPriceParam],
// [shared.NewPlanBulkPriceParam], [shared.NewPlanPackagePriceParam],
// [shared.NewPlanMatrixPriceParam],
// [shared.NewPlanThresholdTotalAmountPriceParam],
// [shared.NewPlanTieredPackagePriceParam],
// [shared.NewPlanTieredWithMinimumPriceParam],
// [shared.NewPlanGroupedTieredPriceParam],
// [shared.NewPlanTieredPackageWithMinimumPriceParam],
// [shared.NewPlanPackageWithAllocationPriceParam],
// [shared.NewPlanUnitWithPercentPriceParam],
// [shared.NewPlanMatrixWithAllocationPriceParam],
// [BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPrice],
// [shared.NewPlanUnitWithProrationPriceParam],
// [shared.NewPlanGroupedAllocationPriceParam],
// [shared.NewPlanBulkWithProrationPriceParam],
// [shared.NewPlanGroupedWithProratedMinimumPriceParam],
// [shared.NewPlanGroupedWithMeteredMinimumPriceParam],
// [BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPrice],
// [shared.NewPlanMatrixWithDisplayNamePriceParam],
// [shared.NewPlanGroupedTieredPackagePriceParam],
// [shared.NewPlanMaxGroupTieredPackagePriceParam],
// [shared.NewPlanScalableMatrixWithUnitPricingPriceParam],
// [shared.NewPlanScalableMatrixWithTieredPricingPriceParam],
// [shared.NewPlanCumulativeGroupedBulkPriceParam],
// [shared.NewPlanMinimumCompositePriceParam],
// [BetaExternalPlanIDNewPlanVersionParamsAddPricesPrice].
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceUnion interface {
ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceUnion()
}
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPrice struct {
// The cadence to bill for this price on.
Cadence param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence] `json:"cadence,required"`
// The id of the item the price will be associated with.
ItemID param.Field[string] `json:"item_id,required"`
// The pricing model type
ModelType param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceModelType] `json:"model_type,required"`
// The name of the price.
Name param.Field[string] `json:"name,required"`
// Configuration for tiered_with_proration pricing
TieredWithProrationConfig param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceTieredWithProrationConfig] `json:"tiered_with_proration_config,required"`
// The id of the billable metric for the price. Only needed if the price is
// usage-based.
BillableMetricID param.Field[string] `json:"billable_metric_id"`
// If the Price represents a fixed cost, the price will be billed in-advance if
// this is true, and in-arrears if this is false.
BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
// For custom cadence: specifies the duration of the billing period in days or
// months.
BillingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"billing_cycle_configuration"`
// The per unit conversion rate of the price currency to the invoicing currency.
ConversionRate param.Field[float64] `json:"conversion_rate"`
// The configuration for the rate of the price currency to the invoicing currency.
ConversionRateConfig param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigUnion] `json:"conversion_rate_config"`
// An ISO 4217 currency string, or custom pricing unit identifier, in which this
// price is billed.
Currency param.Field[string] `json:"currency"`
// For dimensional price: specifies a price group and dimension values
DimensionalPriceConfiguration param.Field[shared.NewDimensionalPriceConfigurationParam] `json:"dimensional_price_configuration"`
// An alias for the price.
ExternalPriceID param.Field[string] `json:"external_price_id"`
// If the Price represents a fixed cost, this represents the quantity of units
// applied.
FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
// The property used to group this price on an invoice
InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
// Within each billing cycle, specifies the cadence at which invoices are produced.
// If unspecified, a single invoice is produced per billing cycle.
InvoicingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"invoicing_cycle_configuration"`
// User-specified key/value pairs for the resource. Individual keys can be removed
// by setting the value to `null`, and the entire metadata mapping can be cleared
// by setting `metadata` to `null`.
Metadata param.Field[map[string]string] `json:"metadata"`
// A transient ID that can be used to reference this price when adding adjustments
// in the same API call.
ReferenceID param.Field[string] `json:"reference_id"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPrice) ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceUnion() {
}
// The cadence to bill for this price on.
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceAnnual BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence = "annual"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceSemiAnnual BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence = "semi_annual"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceMonthly BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence = "monthly"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceQuarterly BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence = "quarterly"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceOneTime BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence = "one_time"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceCustom BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence = "custom"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadence) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceAnnual, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceSemiAnnual, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceMonthly, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceQuarterly, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceOneTime, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceCadenceCustom:
return true
}
return false
}
// The pricing model type
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceModelType string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceModelTypeTieredWithProration BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceModelType = "tiered_with_proration"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceModelType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceModelTypeTieredWithProration:
return true
}
return false
}
// Configuration for tiered_with_proration pricing
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceTieredWithProrationConfig struct {
// Tiers for rating based on total usage quantities into the specified tier with
// proration
Tiers param.Field[[]BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier] `json:"tiers,required"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceTieredWithProrationConfig) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Configuration for a single tiered with proration tier
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier struct {
// Inclusive tier starting value
TierLowerBound param.Field[string] `json:"tier_lower_bound,required"`
// Amount per unit
UnitAmount param.Field[string] `json:"unit_amount,required"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfig struct {
ConversionRateType param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateType] `json:"conversion_rate_type,required"`
TieredConfig param.Field[shared.ConversionRateTieredConfigParam] `json:"tiered_config"`
UnitConfig param.Field[shared.ConversionRateUnitConfigParam] `json:"unit_config"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfig) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfig) ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigUnion() {
}
// Satisfied by [shared.UnitConversionRateConfigParam],
// [shared.TieredConversionRateConfigParam],
// [BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfig].
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigUnion interface {
ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigUnion()
}
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateType string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateTypeUnit BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateType = "unit"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateTypeTiered BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateType = "tiered"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateTypeUnit, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanTieredWithProrationPriceConversionRateConfigConversionRateTypeTiered:
return true
}
return false
}
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPrice struct {
// The cadence to bill for this price on.
Cadence param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence] `json:"cadence,required"`
// Configuration for grouped_with_min_max_thresholds pricing
GroupedWithMinMaxThresholdsConfig param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig] `json:"grouped_with_min_max_thresholds_config,required"`
// The id of the item the price will be associated with.
ItemID param.Field[string] `json:"item_id,required"`
// The pricing model type
ModelType param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceModelType] `json:"model_type,required"`
// The name of the price.
Name param.Field[string] `json:"name,required"`
// The id of the billable metric for the price. Only needed if the price is
// usage-based.
BillableMetricID param.Field[string] `json:"billable_metric_id"`
// If the Price represents a fixed cost, the price will be billed in-advance if
// this is true, and in-arrears if this is false.
BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
// For custom cadence: specifies the duration of the billing period in days or
// months.
BillingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"billing_cycle_configuration"`
// The per unit conversion rate of the price currency to the invoicing currency.
ConversionRate param.Field[float64] `json:"conversion_rate"`
// The configuration for the rate of the price currency to the invoicing currency.
ConversionRateConfig param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigUnion] `json:"conversion_rate_config"`
// An ISO 4217 currency string, or custom pricing unit identifier, in which this
// price is billed.
Currency param.Field[string] `json:"currency"`
// For dimensional price: specifies a price group and dimension values
DimensionalPriceConfiguration param.Field[shared.NewDimensionalPriceConfigurationParam] `json:"dimensional_price_configuration"`
// An alias for the price.
ExternalPriceID param.Field[string] `json:"external_price_id"`
// If the Price represents a fixed cost, this represents the quantity of units
// applied.
FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
// The property used to group this price on an invoice
InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
// Within each billing cycle, specifies the cadence at which invoices are produced.
// If unspecified, a single invoice is produced per billing cycle.
InvoicingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"invoicing_cycle_configuration"`
// User-specified key/value pairs for the resource. Individual keys can be removed
// by setting the value to `null`, and the entire metadata mapping can be cleared
// by setting `metadata` to `null`.
Metadata param.Field[map[string]string] `json:"metadata"`
// A transient ID that can be used to reference this price when adding adjustments
// in the same API call.
ReferenceID param.Field[string] `json:"reference_id"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPrice) ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceUnion() {
}
// The cadence to bill for this price on.
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceAnnual BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence = "annual"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceSemiAnnual BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence = "semi_annual"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceMonthly BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence = "monthly"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceQuarterly BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence = "quarterly"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceOneTime BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence = "one_time"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceCustom BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence = "custom"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadence) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceAnnual, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceSemiAnnual, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceMonthly, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceQuarterly, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceOneTime, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceCadenceCustom:
return true
}
return false
}
// Configuration for grouped_with_min_max_thresholds pricing
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig struct {
// The event property used to group before applying thresholds
GroupingKey param.Field[string] `json:"grouping_key,required"`
// The maximum amount to charge each group
MaximumCharge param.Field[string] `json:"maximum_charge,required"`
// The minimum amount to charge each group, regardless of usage
MinimumCharge param.Field[string] `json:"minimum_charge,required"`
// The base price charged per group
PerUnitRate param.Field[string] `json:"per_unit_rate,required"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The pricing model type
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceModelType string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceModelTypeGroupedWithMinMaxThresholds BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceModelType = "grouped_with_min_max_thresholds"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceModelType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceModelTypeGroupedWithMinMaxThresholds:
return true
}
return false
}
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig struct {
ConversionRateType param.Field[BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateType] `json:"conversion_rate_type,required"`
TieredConfig param.Field[shared.ConversionRateTieredConfigParam] `json:"tiered_config"`
UnitConfig param.Field[shared.ConversionRateUnitConfigParam] `json:"unit_config"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig) ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigUnion() {
}
// Satisfied by [shared.UnitConversionRateConfigParam],
// [shared.TieredConversionRateConfigParam],
// [BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig].
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigUnion interface {
ImplementsBetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigUnion()
}
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateType string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateTypeUnit BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateType = "unit"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateTypeTiered BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateType = "tiered"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateTypeUnit, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfigConversionRateTypeTiered:
return true
}
return false
}
// The cadence to bill for this price on.
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceAnnual BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence = "annual"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceSemiAnnual BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence = "semi_annual"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceMonthly BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence = "monthly"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceQuarterly BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence = "quarterly"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceOneTime BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence = "one_time"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceCustom BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence = "custom"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadence) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceAnnual, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceSemiAnnual, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceMonthly, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceQuarterly, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceOneTime, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceCadenceCustom:
return true
}
return false
}
// The pricing model type
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType string
const (
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeUnit BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "unit"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTiered BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "tiered"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeBulk BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "bulk"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypePackage BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "package"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMatrix BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "matrix"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeThresholdTotalAmount BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "threshold_total_amount"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredPackage BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "tiered_package"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredWithMinimum BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "tiered_with_minimum"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedTiered BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "grouped_tiered"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredPackageWithMinimum BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "tiered_package_with_minimum"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypePackageWithAllocation BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "package_with_allocation"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeUnitWithPercent BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "unit_with_percent"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMatrixWithAllocation BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "matrix_with_allocation"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredWithProration BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "tiered_with_proration"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeUnitWithProration BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "unit_with_proration"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedAllocation BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "grouped_allocation"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeBulkWithProration BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "bulk_with_proration"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedWithProratedMinimum BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "grouped_with_prorated_minimum"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedWithMeteredMinimum BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "grouped_with_metered_minimum"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedWithMinMaxThresholds BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "grouped_with_min_max_thresholds"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMatrixWithDisplayName BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "matrix_with_display_name"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedTieredPackage BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "grouped_tiered_package"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMaxGroupTieredPackage BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "max_group_tiered_package"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeScalableMatrixWithUnitPricing BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "scalable_matrix_with_unit_pricing"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeScalableMatrixWithTieredPricing BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "scalable_matrix_with_tiered_pricing"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeCumulativeGroupedBulk BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "cumulative_grouped_bulk"
BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMinimum BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType = "minimum"
)
func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeUnit, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTiered, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeBulk, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypePackage, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMatrix, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeThresholdTotalAmount, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredPackage, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredWithMinimum, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedTiered, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredPackageWithMinimum, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypePackageWithAllocation, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeUnitWithPercent, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMatrixWithAllocation, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeTieredWithProration, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeUnitWithProration, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedAllocation, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeBulkWithProration, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedWithProratedMinimum, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedWithMeteredMinimum, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedWithMinMaxThresholds, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMatrixWithDisplayName, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeGroupedTieredPackage, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMaxGroupTieredPackage, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeScalableMatrixWithUnitPricing, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeScalableMatrixWithTieredPricing, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeCumulativeGroupedBulk, BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceModelTypeMinimum:
return true
}
return false
}
type BetaExternalPlanIDNewPlanVersionParamsRemoveAdjustment struct {
// The id of the adjustment to remove from on the plan.
AdjustmentID param.Field[string] `json:"adjustment_id,required"`
// The phase to remove this adjustment from.
PlanPhaseOrder param.Field[int64] `json:"plan_phase_order"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsRemoveAdjustment) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BetaExternalPlanIDNewPlanVersionParamsRemovePrice struct {
// The id of the price to remove from the plan.
PriceID param.Field[string] `json:"price_id,required"`
// The phase to remove this price from.
PlanPhaseOrder param.Field[int64] `json:"plan_phase_order"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsRemovePrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustment struct {
// The definition of a new adjustment to create and add to the plan.
Adjustment param.Field[BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentUnion] `json:"adjustment,required"`
// The id of the adjustment on the plan to replace in the plan.
ReplacesAdjustmentID param.Field[string] `json:"replaces_adjustment_id,required"`
// The phase to replace this adjustment from.
PlanPhaseOrder param.Field[int64] `json:"plan_phase_order"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustment) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The definition of a new adjustment to create and add to the plan.
type BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustment struct {
AdjustmentType param.Field[BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType] `json:"adjustment_type,required"`
AmountDiscount param.Field[string] `json:"amount_discount"`
// If set, the adjustment will apply to every price on the subscription.
AppliesToAll param.Field[BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAppliesToAll] `json:"applies_to_all"`
AppliesToItemIDs param.Field[interface{}] `json:"applies_to_item_ids"`
AppliesToPriceIDs param.Field[interface{}] `json:"applies_to_price_ids"`
// If set, only prices in the specified currency will have the adjustment applied.
Currency param.Field[string] `json:"currency"`
Filters param.Field[interface{}] `json:"filters"`
// When false, this adjustment will be applied to a single price. Otherwise, it
// will be applied at the invoice level, possibly to multiple prices.
IsInvoiceLevel param.Field[bool] `json:"is_invoice_level"`
// The item ID that revenue from this minimum will be attributed to.
ItemID param.Field[string] `json:"item_id"`
MaximumAmount param.Field[string] `json:"maximum_amount"`
MinimumAmount param.Field[string] `json:"minimum_amount"`
PercentageDiscount param.Field[float64] `json:"percentage_discount"`
// If set, only prices of the specified type will have the adjustment applied.
PriceType param.Field[BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType] `json:"price_type"`
UsageDiscount param.Field[float64] `json:"usage_discount"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustment) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustment) ImplementsBetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentUnion() {
}
// The definition of a new adjustment to create and add to the plan.
//
// Satisfied by [shared.NewPercentageDiscountParam],
// [shared.NewUsageDiscountParam], [shared.NewAmountDiscountParam],
// [shared.NewMinimumParam], [shared.NewMaximumParam],
// [BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustment].
type BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentUnion interface {
ImplementsBetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentUnion()
}
type BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType string
const (
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypePercentageDiscount BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType = "percentage_discount"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeUsageDiscount BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType = "usage_discount"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeAmountDiscount BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType = "amount_discount"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeMinimum BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType = "minimum"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeMaximum BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType = "maximum"
)
func (r BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypePercentageDiscount, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeUsageDiscount, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeAmountDiscount, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeMinimum, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAdjustmentTypeMaximum:
return true
}
return false
}
// If set, the adjustment will apply to every price on the subscription.
type BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAppliesToAll bool
const (
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAppliesToAllTrue BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAppliesToAll = true
)
func (r BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAppliesToAll) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentAppliesToAllTrue:
return true
}
return false
}
// If set, only prices of the specified type will have the adjustment applied.
type BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType string
const (
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeUsage BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType = "usage"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeFixedInAdvance BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType = "fixed_in_advance"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeFixedInArrears BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType = "fixed_in_arrears"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeFixed BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType = "fixed"
BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeInArrears BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType = "in_arrears"
)
func (r BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceType) IsKnown() bool {
switch r {
case BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeUsage, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeFixedInAdvance, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeFixedInArrears, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeFixed, BetaExternalPlanIDNewPlanVersionParamsReplaceAdjustmentsAdjustmentPriceTypeInArrears:
return true
}
return false
}
type BetaExternalPlanIDNewPlanVersionParamsReplacePrice struct {
// The id of the price on the plan to replace in the plan.
ReplacesPriceID param.Field[string] `json:"replaces_price_id,required"`
// The allocation price to add to the plan.
AllocationPrice param.Field[shared.NewAllocationPriceParam] `json:"allocation_price"`
// The phase to replace this price from.
PlanPhaseOrder param.Field[int64] `json:"plan_phase_order"`
// New plan price request body params.
Price param.Field[BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceUnion] `json:"price"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsReplacePrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// New plan price request body params.
type BetaExternalPlanIDNewPlanVersionParamsReplacePricesPrice struct {
// The cadence to bill for this price on.
Cadence param.Field[BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceCadence] `json:"cadence,required"`
// The id of the item the price will be associated with.
ItemID param.Field[string] `json:"item_id,required"`
// The pricing model type
ModelType param.Field[BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceModelType] `json:"model_type,required"`
// The name of the price.
Name param.Field[string] `json:"name,required"`
// The id of the billable metric for the price. Only needed if the price is
// usage-based.
BillableMetricID param.Field[string] `json:"billable_metric_id"`
// If the Price represents a fixed cost, the price will be billed in-advance if
// this is true, and in-arrears if this is false.
BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
// For custom cadence: specifies the duration of the billing period in days or
// months.
BillingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"billing_cycle_configuration"`
// Configuration for bulk pricing
BulkConfig param.Field[shared.BulkConfigParam] `json:"bulk_config"`
BulkWithProrationConfig param.Field[interface{}] `json:"bulk_with_proration_config"`
// The per unit conversion rate of the price currency to the invoicing currency.
ConversionRate param.Field[float64] `json:"conversion_rate"`
ConversionRateConfig param.Field[interface{}] `json:"conversion_rate_config"`
CumulativeGroupedBulkConfig param.Field[interface{}] `json:"cumulative_grouped_bulk_config"`
// An ISO 4217 currency string, or custom pricing unit identifier, in which this
// price is billed.
Currency param.Field[string] `json:"currency"`
// For dimensional price: specifies a price group and dimension values
DimensionalPriceConfiguration param.Field[shared.NewDimensionalPriceConfigurationParam] `json:"dimensional_price_configuration"`
// An alias for the price.
ExternalPriceID param.Field[string] `json:"external_price_id"`
// If the Price represents a fixed cost, this represents the quantity of units
// applied.
FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
GroupedAllocationConfig param.Field[interface{}] `json:"grouped_allocation_config"`
GroupedTieredConfig param.Field[interface{}] `json:"grouped_tiered_config"`
GroupedTieredPackageConfig param.Field[interface{}] `json:"grouped_tiered_package_config"`
GroupedWithMeteredMinimumConfig param.Field[interface{}] `json:"grouped_with_metered_minimum_config"`
GroupedWithMinMaxThresholdsConfig param.Field[interface{}] `json:"grouped_with_min_max_thresholds_config"`
GroupedWithProratedMinimumConfig param.Field[interface{}] `json:"grouped_with_prorated_minimum_config"`
// The property used to group this price on an invoice
InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
// Within each billing cycle, specifies the cadence at which invoices are produced.
// If unspecified, a single invoice is produced per billing cycle.
InvoicingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"invoicing_cycle_configuration"`
// Configuration for matrix pricing
MatrixConfig param.Field[shared.MatrixConfigParam] `json:"matrix_config"`
// Configuration for matrix_with_allocation pricing
MatrixWithAllocationConfig param.Field[shared.MatrixWithAllocationConfigParam] `json:"matrix_with_allocation_config"`
MatrixWithDisplayNameConfig param.Field[interface{}] `json:"matrix_with_display_name_config"`
MaxGroupTieredPackageConfig param.Field[interface{}] `json:"max_group_tiered_package_config"`
Metadata param.Field[interface{}] `json:"metadata"`
MinimumConfig param.Field[interface{}] `json:"minimum_config"`
// Configuration for package pricing
PackageConfig param.Field[shared.PackageConfigParam] `json:"package_config"`
PackageWithAllocationConfig param.Field[interface{}] `json:"package_with_allocation_config"`
// A transient ID that can be used to reference this price when adding adjustments
// in the same API call.
ReferenceID param.Field[string] `json:"reference_id"`
ScalableMatrixWithTieredPricingConfig param.Field[interface{}] `json:"scalable_matrix_with_tiered_pricing_config"`
ScalableMatrixWithUnitPricingConfig param.Field[interface{}] `json:"scalable_matrix_with_unit_pricing_config"`
ThresholdTotalAmountConfig param.Field[interface{}] `json:"threshold_total_amount_config"`
// Configuration for tiered pricing
TieredConfig param.Field[shared.TieredConfigParam] `json:"tiered_config"`
TieredPackageConfig param.Field[interface{}] `json:"tiered_package_config"`
TieredPackageWithMinimumConfig param.Field[interface{}] `json:"tiered_package_with_minimum_config"`
TieredWithMinimumConfig param.Field[interface{}] `json:"tiered_with_minimum_config"`
TieredWithProrationConfig param.Field[interface{}] `json:"tiered_with_proration_config"`
// Configuration for unit pricing
UnitConfig param.Field[shared.UnitConfigParam] `json:"unit_config"`
UnitWithPercentConfig param.Field[interface{}] `json:"unit_with_percent_config"`
UnitWithProrationConfig param.Field[interface{}] `json:"unit_with_proration_config"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsReplacePricesPrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BetaExternalPlanIDNewPlanVersionParamsReplacePricesPrice) ImplementsBetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceUnion() {
}
// New plan price request body params.
//
// Satisfied by [shared.NewPlanUnitPriceParam], [shared.NewPlanTieredPriceParam],
// [shared.NewPlanBulkPriceParam], [shared.NewPlanPackagePriceParam],
// [shared.NewPlanMatrixPriceParam],
// [shared.NewPlanThresholdTotalAmountPriceParam],
// [shared.NewPlanTieredPackagePriceParam],
// [shared.NewPlanTieredWithMinimumPriceParam],
// [shared.NewPlanGroupedTieredPriceParam],
// [shared.NewPlanTieredPackageWithMinimumPriceParam],
// [shared.NewPlanPackageWithAllocationPriceParam],
// [shared.NewPlanUnitWithPercentPriceParam],
// [shared.NewPlanMatrixWithAllocationPriceParam],
// [BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanTieredWithProrationPrice],
// [shared.NewPlanUnitWithProrationPriceParam],
// [shared.NewPlanGroupedAllocationPriceParam],
// [shared.NewPlanBulkWithProrationPriceParam],
// [shared.NewPlanGroupedWithProratedMinimumPriceParam],
// [shared.NewPlanGroupedWithMeteredMinimumPriceParam],
// [BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanGroupedWithMinMaxThresholdsPrice],
// [shared.NewPlanMatrixWithDisplayNamePriceParam],
// [shared.NewPlanGroupedTieredPackagePriceParam],
// [shared.NewPlanMaxGroupTieredPackagePriceParam],
// [shared.NewPlanScalableMatrixWithUnitPricingPriceParam],
// [shared.NewPlanScalableMatrixWithTieredPricingPriceParam],
// [shared.NewPlanCumulativeGroupedBulkPriceParam],
// [shared.NewPlanMinimumCompositePriceParam],
// [BetaExternalPlanIDNewPlanVersionParamsReplacePricesPrice].
type BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceUnion interface {
ImplementsBetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceUnion()
}
type BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanTieredWithProrationPrice struct {
// The cadence to bill for this price on.
Cadence param.Field[BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanTieredWithProrationPriceCadence] `json:"cadence,required"`
// The id of the item the price will be associated with.
ItemID param.Field[string] `json:"item_id,required"`
// The pricing model type
ModelType param.Field[BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanTieredWithProrationPriceModelType] `json:"model_type,required"`
// The name of the price.
Name param.Field[string] `json:"name,required"`
// Configuration for tiered_with_proration pricing
TieredWithProrationConfig param.Field[BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanTieredWithProrationPriceTieredWithProrationConfig] `json:"tiered_with_proration_config,required"`
// The id of the billable metric for the price. Only needed if the price is
// usage-based.
BillableMetricID param.Field[string] `json:"billable_metric_id"`
// If the Price represents a fixed cost, the price will be billed in-advance if
// this is true, and in-arrears if this is false.
BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
// For custom cadence: specifies the duration of the billing period in days or
// months.
BillingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"billing_cycle_configuration"`
// The per unit conversion rate of the price currency to the invoicing currency.
ConversionRate param.Field[float64] `json:"conversion_rate"`
// The configuration for the rate of the price currency to the invoicing currency.
ConversionRateConfig param.Field[BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanTieredWithProrationPriceConversionRateConfigUnion] `json:"conversion_rate_config"`
// An ISO 4217 currency string, or custom pricing unit identifier, in which this
// price is billed.
Currency param.Field[string] `json:"currency"`
// For dimensional price: specifies a price group and dimension values
DimensionalPriceConfiguration param.Field[shared.NewDimensionalPriceConfigurationParam] `json:"dimensional_price_configuration"`
// An alias for the price.
ExternalPriceID param.Field[string] `json:"external_price_id"`
// If the Price represents a fixed cost, this represents the quantity of units
// applied.
FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
// The property used to group this price on an invoice
InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
// Within each billing cycle, specifies the cadence at which invoices are produced.
// If unspecified, a single invoice is produced per billing cycle.
InvoicingCycleConfiguration param.Field[shared.NewBillingCycleConfigurationParam] `json:"invoicing_cycle_configuration"`
// User-specified key/value pairs for the resource. Individual keys can be removed
// by setting the value to `null`, and the entire metadata mapping can be cleared
// by setting `metadata` to `null`.
Metadata param.Field[map[string]string] `json:"metadata"`
// A transient ID that can be used to reference this price when adding adjustments
// in the same API call.
ReferenceID param.Field[string] `json:"reference_id"`
}
func (r BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanTieredWithProrationPrice) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}