orb-billing 1.37.4 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/core.d.ts +5 -0
- package/core.d.ts.map +1 -1
- package/core.js +10 -1
- package/core.js.map +1 -1
- package/core.mjs +8 -0
- package/core.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/customers/costs.d.ts +548 -12
- package/resources/customers/costs.d.ts.map +1 -1
- package/resources/customers/costs.js.map +1 -1
- package/resources/customers/costs.mjs.map +1 -1
- package/resources/customers/credits/credits.d.ts +13 -0
- package/resources/customers/credits/credits.d.ts.map +1 -1
- package/resources/customers/credits/credits.js +5 -0
- package/resources/customers/credits/credits.js.map +1 -1
- package/resources/customers/credits/credits.mjs +5 -0
- package/resources/customers/credits/credits.mjs.map +1 -1
- package/resources/customers/credits/index.d.ts +1 -0
- package/resources/customers/credits/index.d.ts.map +1 -1
- package/resources/customers/credits/index.js +5 -1
- package/resources/customers/credits/index.js.map +1 -1
- package/resources/customers/credits/index.mjs +1 -0
- package/resources/customers/credits/index.mjs.map +1 -1
- package/resources/customers/credits/top-ups.d.ts +399 -0
- package/resources/customers/credits/top-ups.d.ts.map +1 -0
- package/resources/customers/credits/top-ups.js +102 -0
- package/resources/customers/credits/top-ups.js.map +1 -0
- package/resources/customers/credits/top-ups.mjs +73 -0
- package/resources/customers/credits/top-ups.mjs.map +1 -0
- package/resources/customers/customers.d.ts +10 -0
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/subscriptions.d.ts +273 -5
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs.map +1 -1
- package/src/core.ts +11 -0
- package/src/resources/customers/costs.ts +586 -32
- package/src/resources/customers/credits/credits.ts +13 -0
- package/src/resources/customers/credits/index.ts +13 -0
- package/src/resources/customers/credits/top-ups.ts +542 -0
- package/src/resources/customers/customers.ts +12 -0
- package/src/resources/subscriptions.ts +283 -6
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -326,7 +326,7 @@ export interface CostListResponse {
|
|
|
326
326
|
|
|
327
327
|
export namespace CostListResponse {
|
|
328
328
|
export interface Data {
|
|
329
|
-
per_price_costs: Array<Data.PerPriceCost>;
|
|
329
|
+
per_price_costs: Array<Data.PerPriceCost | Data.PerPriceCostV2>;
|
|
330
330
|
|
|
331
331
|
/**
|
|
332
332
|
* Total costs for the timeframe, excluding any minimums and discounts.
|
|
@@ -625,34 +625,598 @@ export namespace CostListResponse {
|
|
|
625
625
|
total: string;
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
+
|
|
629
|
+
export interface PerPriceCostV2 {
|
|
630
|
+
/**
|
|
631
|
+
* The Price resource represents a price that can be billed on a subscription,
|
|
632
|
+
* resulting in a charge on an invoice in the form of an invoice line item. Prices
|
|
633
|
+
* take a quantity and determine an amount to bill.
|
|
634
|
+
*
|
|
635
|
+
* Orb supports a few different pricing models out of the box. Each of these models
|
|
636
|
+
* is serialized differently in a given Price object. The model_type field
|
|
637
|
+
* determines the key for the configuration object that is present.
|
|
638
|
+
*
|
|
639
|
+
* ## Unit pricing
|
|
640
|
+
*
|
|
641
|
+
* With unit pricing, each unit costs a fixed amount.
|
|
642
|
+
*
|
|
643
|
+
* ```json
|
|
644
|
+
* {
|
|
645
|
+
* ...
|
|
646
|
+
* "model_type": "unit",
|
|
647
|
+
* "unit_config": {
|
|
648
|
+
* "unit_amount": "0.50"
|
|
649
|
+
* }
|
|
650
|
+
* ...
|
|
651
|
+
* }
|
|
652
|
+
* ```
|
|
653
|
+
*
|
|
654
|
+
* ## Tiered pricing
|
|
655
|
+
*
|
|
656
|
+
* In tiered pricing, the cost of a given unit depends on the tier range that it
|
|
657
|
+
* falls into, where each tier range is defined by an upper and lower bound. For
|
|
658
|
+
* example, the first ten units may cost $0.50 each and all units thereafter may
|
|
659
|
+
* cost $0.10 each.
|
|
660
|
+
*
|
|
661
|
+
* ```json
|
|
662
|
+
* {
|
|
663
|
+
* ...
|
|
664
|
+
* "model_type": "tiered",
|
|
665
|
+
* "tiered_config": {
|
|
666
|
+
* "tiers": [
|
|
667
|
+
* {
|
|
668
|
+
* "first_unit": 1,
|
|
669
|
+
* "last_unit": 10,
|
|
670
|
+
* "unit_amount": "0.50"
|
|
671
|
+
* },
|
|
672
|
+
* {
|
|
673
|
+
* "first_unit": 11,
|
|
674
|
+
* "last_unit": null,
|
|
675
|
+
* "unit_amount": "0.10"
|
|
676
|
+
* }
|
|
677
|
+
* ]
|
|
678
|
+
* }
|
|
679
|
+
* ...
|
|
680
|
+
* ```
|
|
681
|
+
*
|
|
682
|
+
* ## Bulk pricing
|
|
683
|
+
*
|
|
684
|
+
* Bulk pricing applies when the number of units determine the cost of all units.
|
|
685
|
+
* For example, if you've bought less than 10 units, they may each be $0.50 for a
|
|
686
|
+
* total of $5.00. Once you've bought more than 10 units, all units may now be
|
|
687
|
+
* priced at $0.40 (i.e. 101 units total would be $40.40).
|
|
688
|
+
*
|
|
689
|
+
* ```json
|
|
690
|
+
* {
|
|
691
|
+
* ...
|
|
692
|
+
* "model_type": "bulk",
|
|
693
|
+
* "bulk_config": {
|
|
694
|
+
* "tiers": [
|
|
695
|
+
* {
|
|
696
|
+
* "maximum_units": 10,
|
|
697
|
+
* "unit_amount": "0.50"
|
|
698
|
+
* },
|
|
699
|
+
* {
|
|
700
|
+
* "maximum_units": 1000,
|
|
701
|
+
* "unit_amount": "0.40"
|
|
702
|
+
* }
|
|
703
|
+
* ]
|
|
704
|
+
* }
|
|
705
|
+
* ...
|
|
706
|
+
* }
|
|
707
|
+
* ```
|
|
708
|
+
*
|
|
709
|
+
* ## Package pricing
|
|
710
|
+
*
|
|
711
|
+
* Package pricing defines the size or granularity of a unit for billing purposes.
|
|
712
|
+
* For example, if the package size is set to 5, then 4 units will be billed as 5
|
|
713
|
+
* and 6 units will be billed at 10.
|
|
714
|
+
*
|
|
715
|
+
* ```json
|
|
716
|
+
* {
|
|
717
|
+
* ...
|
|
718
|
+
* "model_type": "package",
|
|
719
|
+
* "package_config": {
|
|
720
|
+
* "package_amount": "0.80",
|
|
721
|
+
* "package_size": 10
|
|
722
|
+
* }
|
|
723
|
+
* ...
|
|
724
|
+
* }
|
|
725
|
+
* ```
|
|
726
|
+
*
|
|
727
|
+
* ## BPS pricing
|
|
728
|
+
*
|
|
729
|
+
* BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
|
|
730
|
+
* percent (the number of basis points to charge), as well as a cap per event to
|
|
731
|
+
* assess. For example, this would allow you to assess a fee of 0.25% on every
|
|
732
|
+
* payment you process, with a maximum charge of $25 per payment.
|
|
733
|
+
*
|
|
734
|
+
* ```json
|
|
735
|
+
* {
|
|
736
|
+
* ...
|
|
737
|
+
* "model_type": "bps",
|
|
738
|
+
* "bps_config": {
|
|
739
|
+
* "bps": 125,
|
|
740
|
+
* "per_unit_maximum": "11.00"
|
|
741
|
+
* }
|
|
742
|
+
* ...
|
|
743
|
+
* }
|
|
744
|
+
* ```
|
|
745
|
+
*
|
|
746
|
+
* ## Bulk BPS pricing
|
|
747
|
+
*
|
|
748
|
+
* Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
|
|
749
|
+
* total quantity across all events. Similar to bulk pricing, the BPS parameters of
|
|
750
|
+
* a given event depends on the tier range that the billing period falls into. Each
|
|
751
|
+
* tier range is defined by an upper bound. For example, after $1.5M of payment
|
|
752
|
+
* volume is reached, each individual payment may have a lower cap or a smaller
|
|
753
|
+
* take-rate.
|
|
754
|
+
*
|
|
755
|
+
* ```json
|
|
756
|
+
* ...
|
|
757
|
+
* "model_type": "bulk_bps",
|
|
758
|
+
* "bulk_bps_config": {
|
|
759
|
+
* "tiers": [
|
|
760
|
+
* {
|
|
761
|
+
* "maximum_amount": "1000000.00",
|
|
762
|
+
* "bps": 125,
|
|
763
|
+
* "per_unit_maximum": "19.00"
|
|
764
|
+
* },
|
|
765
|
+
* {
|
|
766
|
+
* "maximum_amount": null,
|
|
767
|
+
* "bps": 115,
|
|
768
|
+
* "per_unit_maximum": "4.00"
|
|
769
|
+
* }
|
|
770
|
+
* ]
|
|
771
|
+
* }
|
|
772
|
+
* ...
|
|
773
|
+
* }
|
|
774
|
+
* ```
|
|
775
|
+
*
|
|
776
|
+
* ## Tiered BPS pricing
|
|
777
|
+
*
|
|
778
|
+
* Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
|
|
779
|
+
* event's applicable parameter is a function of its marginal addition to the
|
|
780
|
+
* period total. Similar to tiered pricing, the BPS parameters of a given event
|
|
781
|
+
* depends on the tier range that it falls into, where each tier range is defined
|
|
782
|
+
* by an upper and lower bound. For example, the first few payments may have a 0.8
|
|
783
|
+
* BPS take-rate and all payments after a specific volume may incur a take-rate of
|
|
784
|
+
* 0.5 BPS each.
|
|
785
|
+
*
|
|
786
|
+
* ```json
|
|
787
|
+
* ...
|
|
788
|
+
* "model_type": "tiered_bps",
|
|
789
|
+
* "tiered_bps_config": {
|
|
790
|
+
* "tiers": [
|
|
791
|
+
* {
|
|
792
|
+
* "minimum_amount": "0",
|
|
793
|
+
* "maximum_amount": "1000000.00",
|
|
794
|
+
* "bps": 125,
|
|
795
|
+
* "per_unit_maximum": "19.00"
|
|
796
|
+
* },
|
|
797
|
+
* {
|
|
798
|
+
* "minimum_amount": "1000000.00",
|
|
799
|
+
* "maximum_amount": null,
|
|
800
|
+
* "bps": 115,
|
|
801
|
+
* "per_unit_maximum": "4.00"
|
|
802
|
+
* }
|
|
803
|
+
* ]
|
|
804
|
+
* }
|
|
805
|
+
* ...
|
|
806
|
+
* }
|
|
807
|
+
* ```
|
|
808
|
+
*
|
|
809
|
+
* ## Matrix pricing
|
|
810
|
+
*
|
|
811
|
+
* Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
|
|
812
|
+
* `dimensions` defines the two event property values evaluated in this pricing
|
|
813
|
+
* model. In a one-dimensional matrix, the second value is `null`. Every
|
|
814
|
+
* configuration has a list of `matrix_values` which give the unit prices for
|
|
815
|
+
* specified property values. In a one-dimensional matrix, the matrix values will
|
|
816
|
+
* have `dimension_values` where the second value of the pair is null. If an event
|
|
817
|
+
* does not match any of the dimension values in the matrix, it will resort to the
|
|
818
|
+
* `default_unit_amount`.
|
|
819
|
+
*
|
|
820
|
+
* ```json
|
|
821
|
+
* {
|
|
822
|
+
* "model_type": "matrix"
|
|
823
|
+
* "matrix_config": {
|
|
824
|
+
* "default_unit_amount": "3.00",
|
|
825
|
+
* "dimensions": [
|
|
826
|
+
* "cluster_name",
|
|
827
|
+
* "region"
|
|
828
|
+
* ],
|
|
829
|
+
* "matrix_values": [
|
|
830
|
+
* {
|
|
831
|
+
* "dimension_values": [
|
|
832
|
+
* "alpha",
|
|
833
|
+
* "west"
|
|
834
|
+
* ],
|
|
835
|
+
* "unit_amount": "2.00"
|
|
836
|
+
* },
|
|
837
|
+
* ...
|
|
838
|
+
* ]
|
|
839
|
+
* }
|
|
840
|
+
* }
|
|
841
|
+
* ```
|
|
842
|
+
*
|
|
843
|
+
* ### Fixed fees
|
|
844
|
+
*
|
|
845
|
+
* Fixed fees are prices that are applied independent of usage quantities, and
|
|
846
|
+
* follow unit pricing. They also have an additional parameter
|
|
847
|
+
* `fixed_price_quantity`. If the Price represents a fixed cost, this represents
|
|
848
|
+
* the quantity of units applied.
|
|
849
|
+
*
|
|
850
|
+
* ```json
|
|
851
|
+
* {
|
|
852
|
+
* ...
|
|
853
|
+
* "id": "price_id",
|
|
854
|
+
* "model_type": "unit",
|
|
855
|
+
* "unit_config": {
|
|
856
|
+
* "unit_amount": "2.00"
|
|
857
|
+
* },
|
|
858
|
+
* "fixed_price_quantity": 3.0
|
|
859
|
+
* ...
|
|
860
|
+
* }
|
|
861
|
+
* ```
|
|
862
|
+
*/
|
|
863
|
+
price: PricesAPI.Price;
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* Price's contributions for the timeframe, excluding any minimums and discounts.
|
|
867
|
+
*/
|
|
868
|
+
subtotal: string;
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Price's contributions for the timeframe, including minimums and discounts.
|
|
872
|
+
*/
|
|
873
|
+
total: string;
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* If a `group_by` attribute is passed in, array of costs per `grouping_key`,
|
|
877
|
+
* `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`.
|
|
878
|
+
*/
|
|
879
|
+
price_groups?: Array<PerPriceCostV2.PriceGroup> | null;
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* The price's quantity for the timeframe
|
|
883
|
+
*/
|
|
884
|
+
quantity?: number | null;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
export namespace PerPriceCostV2 {
|
|
888
|
+
export interface PriceGroup {
|
|
889
|
+
/**
|
|
890
|
+
* Grouping key to break down a single price's costs
|
|
891
|
+
*/
|
|
892
|
+
grouping_key: string;
|
|
893
|
+
|
|
894
|
+
grouping_value: string | null;
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* If the price is a matrix price, this is the second dimension key
|
|
898
|
+
*/
|
|
899
|
+
secondary_grouping_key: string | null;
|
|
900
|
+
|
|
901
|
+
secondary_grouping_value: string | null;
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Total costs for this group for the timeframe. Note that this does not account
|
|
905
|
+
* for any minimums or discounts.
|
|
906
|
+
*/
|
|
907
|
+
total: string;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
628
910
|
}
|
|
629
911
|
}
|
|
630
912
|
|
|
631
|
-
export interface CostListByExternalIDResponse {
|
|
632
|
-
data: Array<CostListByExternalIDResponse.Data>;
|
|
633
|
-
}
|
|
913
|
+
export interface CostListByExternalIDResponse {
|
|
914
|
+
data: Array<CostListByExternalIDResponse.Data>;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
export namespace CostListByExternalIDResponse {
|
|
918
|
+
export interface Data {
|
|
919
|
+
per_price_costs: Array<Data.PerPriceCost | Data.PerPriceCostV2>;
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Total costs for the timeframe, excluding any minimums and discounts.
|
|
923
|
+
*/
|
|
924
|
+
subtotal: string;
|
|
925
|
+
|
|
926
|
+
timeframe_end: string;
|
|
927
|
+
|
|
928
|
+
timeframe_start: string;
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* Total costs for the timeframe, including any minimums and discounts.
|
|
932
|
+
*/
|
|
933
|
+
total: string;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
export namespace Data {
|
|
937
|
+
export interface PerPriceCost {
|
|
938
|
+
/**
|
|
939
|
+
* The Price resource represents a price that can be billed on a subscription,
|
|
940
|
+
* resulting in a charge on an invoice in the form of an invoice line item. Prices
|
|
941
|
+
* take a quantity and determine an amount to bill.
|
|
942
|
+
*
|
|
943
|
+
* Orb supports a few different pricing models out of the box. Each of these models
|
|
944
|
+
* is serialized differently in a given Price object. The model_type field
|
|
945
|
+
* determines the key for the configuration object that is present.
|
|
946
|
+
*
|
|
947
|
+
* ## Unit pricing
|
|
948
|
+
*
|
|
949
|
+
* With unit pricing, each unit costs a fixed amount.
|
|
950
|
+
*
|
|
951
|
+
* ```json
|
|
952
|
+
* {
|
|
953
|
+
* ...
|
|
954
|
+
* "model_type": "unit",
|
|
955
|
+
* "unit_config": {
|
|
956
|
+
* "unit_amount": "0.50"
|
|
957
|
+
* }
|
|
958
|
+
* ...
|
|
959
|
+
* }
|
|
960
|
+
* ```
|
|
961
|
+
*
|
|
962
|
+
* ## Tiered pricing
|
|
963
|
+
*
|
|
964
|
+
* In tiered pricing, the cost of a given unit depends on the tier range that it
|
|
965
|
+
* falls into, where each tier range is defined by an upper and lower bound. For
|
|
966
|
+
* example, the first ten units may cost $0.50 each and all units thereafter may
|
|
967
|
+
* cost $0.10 each.
|
|
968
|
+
*
|
|
969
|
+
* ```json
|
|
970
|
+
* {
|
|
971
|
+
* ...
|
|
972
|
+
* "model_type": "tiered",
|
|
973
|
+
* "tiered_config": {
|
|
974
|
+
* "tiers": [
|
|
975
|
+
* {
|
|
976
|
+
* "first_unit": 1,
|
|
977
|
+
* "last_unit": 10,
|
|
978
|
+
* "unit_amount": "0.50"
|
|
979
|
+
* },
|
|
980
|
+
* {
|
|
981
|
+
* "first_unit": 11,
|
|
982
|
+
* "last_unit": null,
|
|
983
|
+
* "unit_amount": "0.10"
|
|
984
|
+
* }
|
|
985
|
+
* ]
|
|
986
|
+
* }
|
|
987
|
+
* ...
|
|
988
|
+
* ```
|
|
989
|
+
*
|
|
990
|
+
* ## Bulk pricing
|
|
991
|
+
*
|
|
992
|
+
* Bulk pricing applies when the number of units determine the cost of all units.
|
|
993
|
+
* For example, if you've bought less than 10 units, they may each be $0.50 for a
|
|
994
|
+
* total of $5.00. Once you've bought more than 10 units, all units may now be
|
|
995
|
+
* priced at $0.40 (i.e. 101 units total would be $40.40).
|
|
996
|
+
*
|
|
997
|
+
* ```json
|
|
998
|
+
* {
|
|
999
|
+
* ...
|
|
1000
|
+
* "model_type": "bulk",
|
|
1001
|
+
* "bulk_config": {
|
|
1002
|
+
* "tiers": [
|
|
1003
|
+
* {
|
|
1004
|
+
* "maximum_units": 10,
|
|
1005
|
+
* "unit_amount": "0.50"
|
|
1006
|
+
* },
|
|
1007
|
+
* {
|
|
1008
|
+
* "maximum_units": 1000,
|
|
1009
|
+
* "unit_amount": "0.40"
|
|
1010
|
+
* }
|
|
1011
|
+
* ]
|
|
1012
|
+
* }
|
|
1013
|
+
* ...
|
|
1014
|
+
* }
|
|
1015
|
+
* ```
|
|
1016
|
+
*
|
|
1017
|
+
* ## Package pricing
|
|
1018
|
+
*
|
|
1019
|
+
* Package pricing defines the size or granularity of a unit for billing purposes.
|
|
1020
|
+
* For example, if the package size is set to 5, then 4 units will be billed as 5
|
|
1021
|
+
* and 6 units will be billed at 10.
|
|
1022
|
+
*
|
|
1023
|
+
* ```json
|
|
1024
|
+
* {
|
|
1025
|
+
* ...
|
|
1026
|
+
* "model_type": "package",
|
|
1027
|
+
* "package_config": {
|
|
1028
|
+
* "package_amount": "0.80",
|
|
1029
|
+
* "package_size": 10
|
|
1030
|
+
* }
|
|
1031
|
+
* ...
|
|
1032
|
+
* }
|
|
1033
|
+
* ```
|
|
1034
|
+
*
|
|
1035
|
+
* ## BPS pricing
|
|
1036
|
+
*
|
|
1037
|
+
* BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
|
|
1038
|
+
* percent (the number of basis points to charge), as well as a cap per event to
|
|
1039
|
+
* assess. For example, this would allow you to assess a fee of 0.25% on every
|
|
1040
|
+
* payment you process, with a maximum charge of $25 per payment.
|
|
1041
|
+
*
|
|
1042
|
+
* ```json
|
|
1043
|
+
* {
|
|
1044
|
+
* ...
|
|
1045
|
+
* "model_type": "bps",
|
|
1046
|
+
* "bps_config": {
|
|
1047
|
+
* "bps": 125,
|
|
1048
|
+
* "per_unit_maximum": "11.00"
|
|
1049
|
+
* }
|
|
1050
|
+
* ...
|
|
1051
|
+
* }
|
|
1052
|
+
* ```
|
|
1053
|
+
*
|
|
1054
|
+
* ## Bulk BPS pricing
|
|
1055
|
+
*
|
|
1056
|
+
* Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
|
|
1057
|
+
* total quantity across all events. Similar to bulk pricing, the BPS parameters of
|
|
1058
|
+
* a given event depends on the tier range that the billing period falls into. Each
|
|
1059
|
+
* tier range is defined by an upper bound. For example, after $1.5M of payment
|
|
1060
|
+
* volume is reached, each individual payment may have a lower cap or a smaller
|
|
1061
|
+
* take-rate.
|
|
1062
|
+
*
|
|
1063
|
+
* ```json
|
|
1064
|
+
* ...
|
|
1065
|
+
* "model_type": "bulk_bps",
|
|
1066
|
+
* "bulk_bps_config": {
|
|
1067
|
+
* "tiers": [
|
|
1068
|
+
* {
|
|
1069
|
+
* "maximum_amount": "1000000.00",
|
|
1070
|
+
* "bps": 125,
|
|
1071
|
+
* "per_unit_maximum": "19.00"
|
|
1072
|
+
* },
|
|
1073
|
+
* {
|
|
1074
|
+
* "maximum_amount": null,
|
|
1075
|
+
* "bps": 115,
|
|
1076
|
+
* "per_unit_maximum": "4.00"
|
|
1077
|
+
* }
|
|
1078
|
+
* ]
|
|
1079
|
+
* }
|
|
1080
|
+
* ...
|
|
1081
|
+
* }
|
|
1082
|
+
* ```
|
|
1083
|
+
*
|
|
1084
|
+
* ## Tiered BPS pricing
|
|
1085
|
+
*
|
|
1086
|
+
* Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
|
|
1087
|
+
* event's applicable parameter is a function of its marginal addition to the
|
|
1088
|
+
* period total. Similar to tiered pricing, the BPS parameters of a given event
|
|
1089
|
+
* depends on the tier range that it falls into, where each tier range is defined
|
|
1090
|
+
* by an upper and lower bound. For example, the first few payments may have a 0.8
|
|
1091
|
+
* BPS take-rate and all payments after a specific volume may incur a take-rate of
|
|
1092
|
+
* 0.5 BPS each.
|
|
1093
|
+
*
|
|
1094
|
+
* ```json
|
|
1095
|
+
* ...
|
|
1096
|
+
* "model_type": "tiered_bps",
|
|
1097
|
+
* "tiered_bps_config": {
|
|
1098
|
+
* "tiers": [
|
|
1099
|
+
* {
|
|
1100
|
+
* "minimum_amount": "0",
|
|
1101
|
+
* "maximum_amount": "1000000.00",
|
|
1102
|
+
* "bps": 125,
|
|
1103
|
+
* "per_unit_maximum": "19.00"
|
|
1104
|
+
* },
|
|
1105
|
+
* {
|
|
1106
|
+
* "minimum_amount": "1000000.00",
|
|
1107
|
+
* "maximum_amount": null,
|
|
1108
|
+
* "bps": 115,
|
|
1109
|
+
* "per_unit_maximum": "4.00"
|
|
1110
|
+
* }
|
|
1111
|
+
* ]
|
|
1112
|
+
* }
|
|
1113
|
+
* ...
|
|
1114
|
+
* }
|
|
1115
|
+
* ```
|
|
1116
|
+
*
|
|
1117
|
+
* ## Matrix pricing
|
|
1118
|
+
*
|
|
1119
|
+
* Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
|
|
1120
|
+
* `dimensions` defines the two event property values evaluated in this pricing
|
|
1121
|
+
* model. In a one-dimensional matrix, the second value is `null`. Every
|
|
1122
|
+
* configuration has a list of `matrix_values` which give the unit prices for
|
|
1123
|
+
* specified property values. In a one-dimensional matrix, the matrix values will
|
|
1124
|
+
* have `dimension_values` where the second value of the pair is null. If an event
|
|
1125
|
+
* does not match any of the dimension values in the matrix, it will resort to the
|
|
1126
|
+
* `default_unit_amount`.
|
|
1127
|
+
*
|
|
1128
|
+
* ```json
|
|
1129
|
+
* {
|
|
1130
|
+
* "model_type": "matrix"
|
|
1131
|
+
* "matrix_config": {
|
|
1132
|
+
* "default_unit_amount": "3.00",
|
|
1133
|
+
* "dimensions": [
|
|
1134
|
+
* "cluster_name",
|
|
1135
|
+
* "region"
|
|
1136
|
+
* ],
|
|
1137
|
+
* "matrix_values": [
|
|
1138
|
+
* {
|
|
1139
|
+
* "dimension_values": [
|
|
1140
|
+
* "alpha",
|
|
1141
|
+
* "west"
|
|
1142
|
+
* ],
|
|
1143
|
+
* "unit_amount": "2.00"
|
|
1144
|
+
* },
|
|
1145
|
+
* ...
|
|
1146
|
+
* ]
|
|
1147
|
+
* }
|
|
1148
|
+
* }
|
|
1149
|
+
* ```
|
|
1150
|
+
*
|
|
1151
|
+
* ### Fixed fees
|
|
1152
|
+
*
|
|
1153
|
+
* Fixed fees are prices that are applied independent of usage quantities, and
|
|
1154
|
+
* follow unit pricing. They also have an additional parameter
|
|
1155
|
+
* `fixed_price_quantity`. If the Price represents a fixed cost, this represents
|
|
1156
|
+
* the quantity of units applied.
|
|
1157
|
+
*
|
|
1158
|
+
* ```json
|
|
1159
|
+
* {
|
|
1160
|
+
* ...
|
|
1161
|
+
* "id": "price_id",
|
|
1162
|
+
* "model_type": "unit",
|
|
1163
|
+
* "unit_config": {
|
|
1164
|
+
* "unit_amount": "2.00"
|
|
1165
|
+
* },
|
|
1166
|
+
* "fixed_price_quantity": 3.0
|
|
1167
|
+
* ...
|
|
1168
|
+
* }
|
|
1169
|
+
* ```
|
|
1170
|
+
*/
|
|
1171
|
+
price: PricesAPI.Price;
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Price's contributions for the timeframe, excluding any minimums and discounts.
|
|
1175
|
+
*/
|
|
1176
|
+
subtotal: string;
|
|
634
1177
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
1178
|
+
/**
|
|
1179
|
+
* Price's contributions for the timeframe, including minimums and discounts.
|
|
1180
|
+
*/
|
|
1181
|
+
total: string;
|
|
638
1182
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
1183
|
+
/**
|
|
1184
|
+
* If a `group_by` attribute is passed in, array of costs per `grouping_key`,
|
|
1185
|
+
* `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`.
|
|
1186
|
+
*/
|
|
1187
|
+
price_groups?: Array<PerPriceCost.PriceGroup> | null;
|
|
643
1188
|
|
|
644
|
-
|
|
1189
|
+
/**
|
|
1190
|
+
* The price's quantity for the timeframe
|
|
1191
|
+
*/
|
|
1192
|
+
quantity?: number | null;
|
|
1193
|
+
}
|
|
645
1194
|
|
|
646
|
-
|
|
1195
|
+
export namespace PerPriceCost {
|
|
1196
|
+
export interface PriceGroup {
|
|
1197
|
+
/**
|
|
1198
|
+
* Grouping key to break down a single price's costs
|
|
1199
|
+
*/
|
|
1200
|
+
grouping_key: string;
|
|
647
1201
|
|
|
648
|
-
|
|
649
|
-
* Total costs for the timeframe, including any minimums and discounts.
|
|
650
|
-
*/
|
|
651
|
-
total: string;
|
|
652
|
-
}
|
|
1202
|
+
grouping_value: string | null;
|
|
653
1203
|
|
|
654
|
-
|
|
655
|
-
|
|
1204
|
+
/**
|
|
1205
|
+
* If the price is a matrix price, this is the second dimension key
|
|
1206
|
+
*/
|
|
1207
|
+
secondary_grouping_key: string | null;
|
|
1208
|
+
|
|
1209
|
+
secondary_grouping_value: string | null;
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Total costs for this group for the timeframe. Note that this does not account
|
|
1213
|
+
* for any minimums or discounts.
|
|
1214
|
+
*/
|
|
1215
|
+
total: string;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
export interface PerPriceCostV2 {
|
|
656
1220
|
/**
|
|
657
1221
|
* The Price resource represents a price that can be billed on a subscription,
|
|
658
1222
|
* resulting in a charge on an invoice in the form of an invoice line item. Prices
|
|
@@ -902,7 +1466,7 @@ export namespace CostListByExternalIDResponse {
|
|
|
902
1466
|
* If a `group_by` attribute is passed in, array of costs per `grouping_key`,
|
|
903
1467
|
* `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`.
|
|
904
1468
|
*/
|
|
905
|
-
price_groups?: Array<
|
|
1469
|
+
price_groups?: Array<PerPriceCostV2.PriceGroup> | null;
|
|
906
1470
|
|
|
907
1471
|
/**
|
|
908
1472
|
* The price's quantity for the timeframe
|
|
@@ -910,7 +1474,7 @@ export namespace CostListByExternalIDResponse {
|
|
|
910
1474
|
quantity?: number | null;
|
|
911
1475
|
}
|
|
912
1476
|
|
|
913
|
-
export namespace
|
|
1477
|
+
export namespace PerPriceCostV2 {
|
|
914
1478
|
export interface PriceGroup {
|
|
915
1479
|
/**
|
|
916
1480
|
* Grouping key to break down a single price's costs
|
|
@@ -937,11 +1501,6 @@ export namespace CostListByExternalIDResponse {
|
|
|
937
1501
|
}
|
|
938
1502
|
|
|
939
1503
|
export interface CostListParams {
|
|
940
|
-
/**
|
|
941
|
-
* Groups per-price costs by the key provided.
|
|
942
|
-
*/
|
|
943
|
-
group_by?: string | null;
|
|
944
|
-
|
|
945
1504
|
/**
|
|
946
1505
|
* Costs returned are exclusive of `timeframe_end`.
|
|
947
1506
|
*/
|
|
@@ -962,11 +1521,6 @@ export interface CostListParams {
|
|
|
962
1521
|
}
|
|
963
1522
|
|
|
964
1523
|
export interface CostListByExternalIDParams {
|
|
965
|
-
/**
|
|
966
|
-
* Groups per-price costs by the key provided.
|
|
967
|
-
*/
|
|
968
|
-
group_by?: string | null;
|
|
969
|
-
|
|
970
1524
|
/**
|
|
971
1525
|
* Costs returned are exclusive of `timeframe_end`.
|
|
972
1526
|
*/
|
|
@@ -5,10 +5,12 @@ import { APIResource } from "../../../resource";
|
|
|
5
5
|
import { isRequestOptions } from "../../../core";
|
|
6
6
|
import * as CreditsAPI from "./credits";
|
|
7
7
|
import * as LedgerAPI from "./ledger";
|
|
8
|
+
import * as TopUpsAPI from "./top-ups";
|
|
8
9
|
import { Page, type PageParams } from "../../../pagination";
|
|
9
10
|
|
|
10
11
|
export class Credits extends APIResource {
|
|
11
12
|
ledger: LedgerAPI.Ledger = new LedgerAPI.Ledger(this._client);
|
|
13
|
+
topUps: TopUpsAPI.TopUps = new TopUpsAPI.TopUps(this._client);
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Returns a paginated list of unexpired, non-zero credit blocks for a customer.
|
|
@@ -120,4 +122,15 @@ export namespace Credits {
|
|
|
120
122
|
export import LedgerCreateEntryParams = LedgerAPI.LedgerCreateEntryParams;
|
|
121
123
|
export import LedgerCreateEntryByExternalIDParams = LedgerAPI.LedgerCreateEntryByExternalIDParams;
|
|
122
124
|
export import LedgerListByExternalIDParams = LedgerAPI.LedgerListByExternalIDParams;
|
|
125
|
+
export import TopUps = TopUpsAPI.TopUps;
|
|
126
|
+
export import TopUpCreateResponse = TopUpsAPI.TopUpCreateResponse;
|
|
127
|
+
export import TopUpListResponse = TopUpsAPI.TopUpListResponse;
|
|
128
|
+
export import TopUpCreateByExternalIDResponse = TopUpsAPI.TopUpCreateByExternalIDResponse;
|
|
129
|
+
export import TopUpListByExternalIDResponse = TopUpsAPI.TopUpListByExternalIDResponse;
|
|
130
|
+
export import TopUpListResponsesPage = TopUpsAPI.TopUpListResponsesPage;
|
|
131
|
+
export import TopUpListByExternalIDResponsesPage = TopUpsAPI.TopUpListByExternalIDResponsesPage;
|
|
132
|
+
export import TopUpCreateParams = TopUpsAPI.TopUpCreateParams;
|
|
133
|
+
export import TopUpListParams = TopUpsAPI.TopUpListParams;
|
|
134
|
+
export import TopUpCreateByExternalIDParams = TopUpsAPI.TopUpCreateByExternalIDParams;
|
|
135
|
+
export import TopUpListByExternalIDParams = TopUpsAPI.TopUpListByExternalIDParams;
|
|
123
136
|
}
|