orb-billing 0.1.0.pre.alpha.37 → 0.1.0.pre.alpha.39
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.
- checksums.yaml +4 -4
- data/README.md +29 -5
- data/lib/orb/client.rb +4 -0
- data/lib/orb/internal/page.rb +6 -2
- data/lib/orb/internal/transport/base_client.rb +3 -3
- data/lib/orb/internal/transport/pooled_net_requester.rb +2 -2
- data/lib/orb/internal/type/array_of.rb +5 -3
- data/lib/orb/internal/type/base_model.rb +19 -16
- data/lib/orb/internal/type/base_page.rb +4 -1
- data/lib/orb/internal/type/{boolean_model.rb → boolean.rb} +2 -2
- data/lib/orb/internal/type/converter.rb +26 -23
- data/lib/orb/internal/type/enum.rb +10 -8
- data/lib/orb/internal/type/hash_of.rb +3 -1
- data/lib/orb/internal/util.rb +29 -50
- data/lib/orb/models/alert.rb +10 -10
- data/lib/orb/models/alert_create_for_customer_params.rb +3 -3
- data/lib/orb/models/alert_create_for_external_customer_params.rb +3 -3
- data/lib/orb/models/alert_create_for_subscription_params.rb +3 -3
- data/lib/orb/models/alert_list_params.rb +5 -5
- data/lib/orb/models/alert_update_params.rb +3 -3
- data/lib/orb/models/amount_discount.rb +1 -1
- data/lib/orb/models/billable_metric.rb +7 -7
- data/lib/orb/models/coupon.rb +7 -7
- data/lib/orb/models/coupon_create_params.rb +2 -2
- data/lib/orb/models/coupon_list_params.rb +3 -3
- data/lib/orb/models/coupons/subscription_list_params.rb +1 -1
- data/lib/orb/models/credit_note.rb +1 -1
- data/lib/orb/models/credit_note_list_params.rb +5 -5
- data/lib/orb/models/customer.rb +237 -237
- data/lib/orb/models/customer_create_params.rb +229 -229
- data/lib/orb/models/customer_list_params.rb +5 -5
- data/lib/orb/models/customer_update_by_external_id_params.rb +230 -230
- data/lib/orb/models/customer_update_params.rb +230 -230
- data/lib/orb/models/customers/balance_transaction_create_response.rb +2 -2
- data/lib/orb/models/customers/balance_transaction_list_params.rb +5 -5
- data/lib/orb/models/customers/balance_transaction_list_response.rb +2 -2
- data/lib/orb/models/customers/cost_list_by_external_id_params.rb +6 -6
- data/lib/orb/models/customers/cost_list_params.rb +6 -6
- data/lib/orb/models/customers/credit_list_by_external_id_params.rb +3 -3
- data/lib/orb/models/customers/credit_list_params.rb +3 -3
- data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +22 -22
- data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +22 -22
- data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +22 -22
- data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +22 -22
- data/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rb +5 -5
- data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +22 -22
- data/lib/orb/models/customers/credits/ledger_list_params.rb +5 -5
- data/lib/orb/models/customers/credits/ledger_list_response.rb +22 -22
- data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +10 -10
- data/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rb +9 -9
- data/lib/orb/models/customers/credits/top_up_create_params.rb +10 -10
- data/lib/orb/models/customers/credits/top_up_create_response.rb +9 -9
- data/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rb +1 -1
- data/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rb +9 -9
- data/lib/orb/models/customers/credits/top_up_list_params.rb +1 -1
- data/lib/orb/models/customers/credits/top_up_list_response.rb +9 -9
- data/lib/orb/models/dimensional_price_group.rb +7 -7
- data/lib/orb/models/dimensional_price_group_create_params.rb +2 -2
- data/lib/orb/models/dimensional_price_group_list_params.rb +1 -1
- data/lib/orb/models/evaluate_price_group.rb +1 -1
- data/lib/orb/models/event_ingest_params.rb +8 -8
- data/lib/orb/models/event_ingest_response.rb +4 -4
- data/lib/orb/models/event_search_params.rb +5 -5
- data/lib/orb/models/event_search_response.rb +9 -9
- data/lib/orb/models/event_update_params.rb +4 -4
- data/lib/orb/models/events/backfill_close_response.rb +8 -8
- data/lib/orb/models/events/backfill_create_params.rb +12 -12
- data/lib/orb/models/events/backfill_create_response.rb +8 -8
- data/lib/orb/models/events/backfill_fetch_response.rb +8 -8
- data/lib/orb/models/events/backfill_list_params.rb +1 -1
- data/lib/orb/models/events/backfill_list_response.rb +8 -8
- data/lib/orb/models/events/backfill_revert_response.rb +8 -8
- data/lib/orb/models/events/event_volumes.rb +1 -1
- data/lib/orb/models/events/volume_list_params.rb +7 -7
- data/lib/orb/models/invoice.rb +278 -278
- data/lib/orb/models/invoice_create_params.rb +13 -12
- data/lib/orb/models/invoice_fetch_upcoming_response.rb +274 -274
- data/lib/orb/models/invoice_issue_params.rb +5 -5
- data/lib/orb/models/invoice_line_item_create_params.rb +1 -1
- data/lib/orb/models/invoice_line_item_create_response.rb +32 -32
- data/lib/orb/models/invoice_list_params.rb +13 -13
- data/lib/orb/models/invoice_update_params.rb +2 -2
- data/lib/orb/models/item.rb +2 -2
- data/lib/orb/models/item_list_params.rb +1 -1
- data/lib/orb/models/metric_create_params.rb +2 -2
- data/lib/orb/models/metric_list_params.rb +5 -5
- data/lib/orb/models/metric_update_params.rb +2 -2
- data/lib/orb/models/pagination_metadata.rb +1 -1
- data/lib/orb/models/percentage_discount.rb +2 -2
- data/lib/orb/models/plan.rb +40 -40
- data/lib/orb/models/plan_create_params.rb +292 -292
- data/lib/orb/models/plan_list_params.rb +5 -5
- data/lib/orb/models/plan_update_params.rb +4 -4
- data/lib/orb/models/plans/external_plan_id_update_params.rb +4 -4
- data/lib/orb/models/price.rb +186 -186
- data/lib/orb/models/price_create_params.rb +21 -21
- data/lib/orb/models/price_evaluate_params.rb +4 -4
- data/lib/orb/models/price_list_params.rb +1 -1
- data/lib/orb/models/price_update_params.rb +2 -2
- data/lib/orb/models/prices/external_price_id_update_params.rb +2 -2
- data/lib/orb/models/subscription.rb +120 -93
- data/lib/orb/models/subscription_cancel_params.rb +4 -4
- data/lib/orb/models/subscription_cancel_response.rb +156 -78
- data/lib/orb/models/subscription_change_apply_params.rb +33 -0
- data/lib/orb/models/subscription_change_apply_response.rb +1372 -0
- data/lib/orb/models/subscription_change_cancel_params.rb +19 -0
- data/lib/orb/models/subscription_change_cancel_response.rb +1372 -0
- data/lib/orb/models/subscription_change_retrieve_params.rb +19 -0
- data/lib/orb/models/subscription_change_retrieve_response.rb +1372 -0
- data/lib/orb/models/subscription_create_params.rb +705 -705
- data/lib/orb/models/subscription_create_response.rb +156 -78
- data/lib/orb/models/subscription_fetch_costs_params.rb +6 -6
- data/lib/orb/models/subscription_fetch_schedule_params.rb +5 -5
- data/lib/orb/models/subscription_fetch_schedule_response.rb +2 -2
- data/lib/orb/models/subscription_fetch_usage_params.rb +8 -8
- data/lib/orb/models/subscription_list_params.rb +5 -5
- data/lib/orb/models/subscription_price_intervals_params.rb +358 -358
- data/lib/orb/models/subscription_price_intervals_response.rb +158 -78
- data/lib/orb/models/subscription_schedule_plan_change_params.rb +715 -715
- data/lib/orb/models/subscription_schedule_plan_change_response.rb +158 -78
- data/lib/orb/models/subscription_trigger_phase_params.rb +4 -4
- data/lib/orb/models/subscription_trigger_phase_response.rb +158 -78
- data/lib/orb/models/subscription_unschedule_cancellation_response.rb +158 -78
- data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +159 -79
- data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +158 -78
- data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +9 -9
- data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +158 -78
- data/lib/orb/models/subscription_update_params.rb +11 -11
- data/lib/orb/models/subscription_update_trial_params.rb +4 -4
- data/lib/orb/models/subscription_update_trial_response.rb +158 -78
- data/lib/orb/models/trial_discount.rb +1 -1
- data/lib/orb/models/usage_discount.rb +2 -2
- data/lib/orb/request_options.rb +7 -7
- data/lib/orb/resources/alerts.rb +40 -35
- data/lib/orb/resources/coupons/subscriptions.rb +3 -3
- data/lib/orb/resources/coupons.rb +9 -9
- data/lib/orb/resources/credit_notes.rb +10 -5
- data/lib/orb/resources/customers/balance_transactions.rb +28 -23
- data/lib/orb/resources/customers/costs.rb +232 -232
- data/lib/orb/resources/customers/credits/ledger.rb +348 -338
- data/lib/orb/resources/customers/credits/top_ups.rb +12 -12
- data/lib/orb/resources/customers/credits.rb +8 -8
- data/lib/orb/resources/customers.rb +61 -56
- data/lib/orb/resources/dimensional_price_groups.rb +6 -6
- data/lib/orb/resources/events/backfills.rb +49 -49
- data/lib/orb/resources/events/volume.rb +10 -10
- data/lib/orb/resources/events.rb +295 -295
- data/lib/orb/resources/invoice_line_items.rb +1 -1
- data/lib/orb/resources/invoices.rb +40 -31
- data/lib/orb/resources/items.rb +1 -1
- data/lib/orb/resources/metrics.rb +13 -8
- data/lib/orb/resources/plans/external_plan_id.rb +14 -14
- data/lib/orb/resources/plans.rb +24 -19
- data/lib/orb/resources/prices/external_price_id.rb +4 -4
- data/lib/orb/resources/prices.rb +30 -30
- data/lib/orb/resources/subscription_changes.rb +87 -0
- data/lib/orb/resources/subscriptions.rb +817 -807
- data/lib/orb/resources/top_level.rb +4 -4
- data/lib/orb/version.rb +1 -1
- data/lib/orb.rb +8 -1
- data/rbi/lib/orb/client.rbi +5 -4
- data/rbi/lib/orb/errors.rbi +3 -6
- data/rbi/lib/orb/internal/page.rbi +3 -6
- data/rbi/lib/orb/internal/transport/base_client.rbi +13 -27
- data/rbi/lib/orb/internal/transport/pooled_net_requester.rbi +7 -13
- data/rbi/lib/orb/internal/type/array_of.rbi +10 -18
- data/rbi/lib/orb/internal/type/base_model.rbi +45 -64
- data/rbi/lib/orb/internal/type/base_page.rbi +5 -10
- data/rbi/lib/orb/internal/type/{boolean_model.rbi → boolean.rbi} +5 -9
- data/rbi/lib/orb/internal/type/converter.rbi +25 -31
- data/rbi/lib/orb/internal/type/enum.rbi +14 -20
- data/rbi/lib/orb/internal/type/hash_of.rbi +8 -16
- data/rbi/lib/orb/internal/type/request_parameters.rbi +1 -2
- data/rbi/lib/orb/internal/type/union.rbi +10 -20
- data/rbi/lib/orb/internal/type/unknown.rbi +4 -8
- data/rbi/lib/orb/internal/util.rbi +40 -72
- data/rbi/lib/orb/internal.rbi +1 -1
- data/rbi/lib/orb/models/alert.rbi +21 -33
- data/rbi/lib/orb/models/alert_create_for_customer_params.rbi +8 -13
- data/rbi/lib/orb/models/alert_create_for_external_customer_params.rbi +8 -13
- data/rbi/lib/orb/models/alert_create_for_subscription_params.rbi +8 -13
- data/rbi/lib/orb/models/alert_disable_params.rbi +2 -4
- data/rbi/lib/orb/models/alert_enable_params.rbi +2 -4
- data/rbi/lib/orb/models/alert_list_params.rbi +3 -6
- data/rbi/lib/orb/models/alert_retrieve_params.rbi +2 -4
- data/rbi/lib/orb/models/alert_update_params.rbi +7 -11
- data/rbi/lib/orb/models/amount_discount.rbi +4 -7
- data/rbi/lib/orb/models/billable_metric.rbi +10 -13
- data/rbi/lib/orb/models/billing_cycle_relative_date.rbi +1 -2
- data/rbi/lib/orb/models/coupon.rbi +9 -11
- data/rbi/lib/orb/models/coupon_archive_params.rbi +2 -4
- data/rbi/lib/orb/models/coupon_create_params.rbi +8 -14
- data/rbi/lib/orb/models/coupon_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/coupon_list_params.rbi +3 -4
- data/rbi/lib/orb/models/coupons/subscription_list_params.rbi +3 -5
- data/rbi/lib/orb/models/credit_note.rbi +22 -45
- data/rbi/lib/orb/models/credit_note_create_params.rbi +5 -10
- data/rbi/lib/orb/models/credit_note_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/credit_note_list_params.rbi +3 -6
- data/rbi/lib/orb/models/customer.rbi +256 -281
- data/rbi/lib/orb/models/customer_create_params.rbi +251 -276
- data/rbi/lib/orb/models/customer_delete_params.rbi +2 -4
- data/rbi/lib/orb/models/customer_fetch_by_external_id_params.rbi +2 -4
- data/rbi/lib/orb/models/customer_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/customer_list_params.rbi +3 -6
- data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rbi +2 -4
- data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_params.rbi +2 -4
- data/rbi/lib/orb/models/customer_update_by_external_id_params.rbi +252 -277
- data/rbi/lib/orb/models/customer_update_params.rbi +252 -277
- data/rbi/lib/orb/models/customers/balance_transaction_create_params.rbi +3 -6
- data/rbi/lib/orb/models/customers/balance_transaction_create_response.rbi +10 -19
- data/rbi/lib/orb/models/customers/balance_transaction_list_params.rbi +3 -6
- data/rbi/lib/orb/models/customers/balance_transaction_list_response.rbi +10 -19
- data/rbi/lib/orb/models/customers/cost_list_by_external_id_params.rbi +8 -10
- data/rbi/lib/orb/models/customers/cost_list_by_external_id_response.rbi +6 -12
- data/rbi/lib/orb/models/customers/cost_list_params.rbi +8 -10
- data/rbi/lib/orb/models/customers/cost_list_response.rbi +6 -12
- data/rbi/lib/orb/models/customers/credit_list_by_external_id_params.rbi +3 -4
- data/rbi/lib/orb/models/customers/credit_list_by_external_id_response.rbi +2 -4
- data/rbi/lib/orb/models/customers/credit_list_params.rbi +3 -4
- data/rbi/lib/orb/models/customers/credit_list_response.rbi +2 -4
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +26 -33
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +79 -136
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_params.rbi +26 -33
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_response.rbi +78 -135
- data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rbi +5 -10
- data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +79 -136
- data/rbi/lib/orb/models/customers/credits/ledger_list_params.rbi +5 -10
- data/rbi/lib/orb/models/customers/credits/ledger_list_response.rbi +74 -131
- data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +13 -19
- data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rbi +12 -18
- data/rbi/lib/orb/models/customers/credits/top_up_create_params.rbi +13 -19
- data/rbi/lib/orb/models/customers/credits/top_up_create_response.rbi +12 -18
- data/rbi/lib/orb/models/customers/credits/top_up_delete_by_external_id_params.rbi +2 -4
- data/rbi/lib/orb/models/customers/credits/top_up_delete_params.rbi +2 -4
- data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rbi +3 -5
- data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rbi +12 -18
- data/rbi/lib/orb/models/customers/credits/top_up_list_params.rbi +3 -5
- data/rbi/lib/orb/models/customers/credits/top_up_list_response.rbi +12 -18
- data/rbi/lib/orb/models/dimensional_price_group.rbi +8 -9
- data/rbi/lib/orb/models/dimensional_price_group_create_params.rbi +4 -7
- data/rbi/lib/orb/models/dimensional_price_group_list_params.rbi +3 -5
- data/rbi/lib/orb/models/dimensional_price_group_retrieve_params.rbi +2 -4
- data/rbi/lib/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rbi +2 -4
- data/rbi/lib/orb/models/dimensional_price_groups.rbi +2 -4
- data/rbi/lib/orb/models/discount.rbi +1 -2
- data/rbi/lib/orb/models/evaluate_price_group.rbi +3 -6
- data/rbi/lib/orb/models/event_deprecate_params.rbi +2 -4
- data/rbi/lib/orb/models/event_deprecate_response.rbi +2 -4
- data/rbi/lib/orb/models/event_ingest_params.rbi +10 -13
- data/rbi/lib/orb/models/event_ingest_response.rbi +10 -16
- data/rbi/lib/orb/models/event_search_params.rbi +7 -9
- data/rbi/lib/orb/models/event_search_response.rbi +11 -14
- data/rbi/lib/orb/models/event_update_params.rbi +5 -6
- data/rbi/lib/orb/models/event_update_response.rbi +2 -4
- data/rbi/lib/orb/models/events/backfill_close_params.rbi +2 -4
- data/rbi/lib/orb/models/events/backfill_close_response.rbi +10 -14
- data/rbi/lib/orb/models/events/backfill_create_params.rbi +13 -16
- data/rbi/lib/orb/models/events/backfill_create_response.rbi +10 -14
- data/rbi/lib/orb/models/events/backfill_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/events/backfill_fetch_response.rbi +10 -14
- data/rbi/lib/orb/models/events/backfill_list_params.rbi +3 -5
- data/rbi/lib/orb/models/events/backfill_list_response.rbi +10 -14
- data/rbi/lib/orb/models/events/backfill_revert_params.rbi +2 -4
- data/rbi/lib/orb/models/events/backfill_revert_response.rbi +10 -14
- data/rbi/lib/orb/models/events/event_volumes.rbi +5 -9
- data/rbi/lib/orb/models/events/volume_list_params.rbi +9 -11
- data/rbi/lib/orb/models/invoice.rbi +388 -465
- data/rbi/lib/orb/models/invoice_create_params.rbi +19 -26
- data/rbi/lib/orb/models/invoice_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/invoice_fetch_upcoming_params.rbi +2 -4
- data/rbi/lib/orb/models/invoice_fetch_upcoming_response.rbi +381 -460
- data/rbi/lib/orb/models/invoice_issue_params.rbi +6 -8
- data/rbi/lib/orb/models/invoice_level_discount.rbi +1 -2
- data/rbi/lib/orb/models/invoice_line_item_create_params.rbi +3 -5
- data/rbi/lib/orb/models/invoice_line_item_create_response.rbi +101 -143
- data/rbi/lib/orb/models/invoice_list_params.rbi +8 -13
- data/rbi/lib/orb/models/invoice_mark_paid_params.rbi +2 -4
- data/rbi/lib/orb/models/invoice_pay_params.rbi +2 -4
- data/rbi/lib/orb/models/invoice_update_params.rbi +4 -6
- data/rbi/lib/orb/models/invoice_void_params.rbi +2 -4
- data/rbi/lib/orb/models/item.rbi +7 -12
- data/rbi/lib/orb/models/item_create_params.rbi +2 -4
- data/rbi/lib/orb/models/item_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/item_list_params.rbi +3 -5
- data/rbi/lib/orb/models/item_update_params.rbi +5 -10
- data/rbi/lib/orb/models/metric_create_params.rbi +4 -6
- data/rbi/lib/orb/models/metric_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/metric_list_params.rbi +3 -6
- data/rbi/lib/orb/models/metric_update_params.rbi +4 -6
- data/rbi/lib/orb/models/pagination_metadata.rbi +2 -4
- data/rbi/lib/orb/models/percentage_discount.rbi +5 -8
- data/rbi/lib/orb/models/plan.rbi +180 -219
- data/rbi/lib/orb/models/plan_create_params.rbi +670 -951
- data/rbi/lib/orb/models/plan_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/plan_list_params.rbi +4 -8
- data/rbi/lib/orb/models/plan_update_params.rbi +6 -8
- data/rbi/lib/orb/models/plans/external_plan_id_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/plans/external_plan_id_update_params.rbi +6 -8
- data/rbi/lib/orb/models/price.rbi +827 -1494
- data/rbi/lib/orb/models/price_create_params.rbi +60 -101
- data/rbi/lib/orb/models/price_evaluate_params.rbi +6 -9
- data/rbi/lib/orb/models/price_evaluate_response.rbi +2 -4
- data/rbi/lib/orb/models/price_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/price_list_params.rbi +3 -5
- data/rbi/lib/orb/models/price_update_params.rbi +4 -6
- data/rbi/lib/orb/models/prices/external_price_id_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/prices/external_price_id_update_params.rbi +4 -6
- data/rbi/lib/orb/models/subscription.rbi +167 -187
- data/rbi/lib/orb/models/subscription_cancel_params.rbi +5 -7
- data/rbi/lib/orb/models/subscription_cancel_response.rbi +224 -178
- data/rbi/lib/orb/models/subscription_change_apply_params.rbi +40 -0
- data/rbi/lib/orb/models/subscription_change_apply_response.rbi +1554 -0
- data/rbi/lib/orb/models/subscription_change_cancel_params.rbi +18 -0
- data/rbi/lib/orb/models/subscription_change_cancel_response.rbi +1565 -0
- data/rbi/lib/orb/models/subscription_change_retrieve_params.rbi +18 -0
- data/rbi/lib/orb/models/subscription_change_retrieve_response.rbi +1581 -0
- data/rbi/lib/orb/models/subscription_create_params.rbi +1372 -1968
- data/rbi/lib/orb/models/subscription_create_response.rbi +224 -178
- data/rbi/lib/orb/models/subscription_fetch_costs_params.rbi +8 -10
- data/rbi/lib/orb/models/subscription_fetch_costs_response.rbi +6 -12
- data/rbi/lib/orb/models/subscription_fetch_params.rbi +2 -4
- data/rbi/lib/orb/models/subscription_fetch_schedule_params.rbi +3 -6
- data/rbi/lib/orb/models/subscription_fetch_schedule_response.rbi +6 -10
- data/rbi/lib/orb/models/subscription_fetch_usage_params.rbi +12 -17
- data/rbi/lib/orb/models/subscription_list_params.rbi +4 -8
- data/rbi/lib/orb/models/subscription_price_intervals_params.rbi +772 -1124
- data/rbi/lib/orb/models/subscription_price_intervals_response.rbi +228 -178
- data/rbi/lib/orb/models/subscription_schedule_plan_change_params.rbi +1396 -1993
- data/rbi/lib/orb/models/subscription_schedule_plan_change_response.rbi +238 -182
- data/rbi/lib/orb/models/subscription_trigger_phase_params.rbi +5 -7
- data/rbi/lib/orb/models/subscription_trigger_phase_response.rbi +224 -178
- data/rbi/lib/orb/models/subscription_unschedule_cancellation_params.rbi +2 -4
- data/rbi/lib/orb/models/subscription_unschedule_cancellation_response.rbi +238 -182
- data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rbi +2 -4
- data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +265 -199
- data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_params.rbi +2 -4
- data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +264 -198
- data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_params.rbi +11 -15
- data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_response.rbi +238 -182
- data/rbi/lib/orb/models/subscription_update_params.rbi +12 -15
- data/rbi/lib/orb/models/subscription_update_trial_params.rbi +6 -9
- data/rbi/lib/orb/models/subscription_update_trial_response.rbi +224 -178
- data/rbi/lib/orb/models/subscription_usage.rbi +24 -43
- data/rbi/lib/orb/models/subscriptions.rbi +2 -4
- data/rbi/lib/orb/models/top_level_ping_params.rbi +2 -4
- data/rbi/lib/orb/models/top_level_ping_response.rbi +2 -4
- data/rbi/lib/orb/models/trial_discount.rbi +4 -8
- data/rbi/lib/orb/models/usage_discount.rbi +5 -8
- data/rbi/lib/orb/request_options.rbi +9 -11
- data/rbi/lib/orb/resources/alerts.rbi +44 -60
- data/rbi/lib/orb/resources/coupons/subscriptions.rbi +6 -9
- data/rbi/lib/orb/resources/coupons.rbi +18 -25
- data/rbi/lib/orb/resources/credit_notes.rbi +9 -15
- data/rbi/lib/orb/resources/customers/balance_transactions.rbi +26 -31
- data/rbi/lib/orb/resources/customers/costs.rbi +241 -246
- data/rbi/lib/orb/resources/customers/credits/ledger.rbi +387 -396
- data/rbi/lib/orb/resources/customers/credits/top_ups.rbi +29 -40
- data/rbi/lib/orb/resources/customers/credits.rbi +15 -20
- data/rbi/lib/orb/resources/customers.rbi +407 -417
- data/rbi/lib/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rbi +2 -4
- data/rbi/lib/orb/resources/dimensional_price_groups.rbi +13 -19
- data/rbi/lib/orb/resources/events/backfills.rbi +61 -69
- data/rbi/lib/orb/resources/events/volume.rbi +19 -22
- data/rbi/lib/orb/resources/events.rbi +311 -319
- data/rbi/lib/orb/resources/invoice_line_items.rbi +4 -7
- data/rbi/lib/orb/resources/invoices.rbi +62 -76
- data/rbi/lib/orb/resources/items.rbi +7 -14
- data/rbi/lib/orb/resources/metrics.rbi +17 -25
- data/rbi/lib/orb/resources/plans/external_plan_id.rbi +21 -25
- data/rbi/lib/orb/resources/plans.rbi +63 -71
- data/rbi/lib/orb/resources/prices/external_price_id.rbi +9 -13
- data/rbi/lib/orb/resources/prices.rbi +77 -87
- data/rbi/lib/orb/resources/subscription_changes.rbi +61 -0
- data/rbi/lib/orb/resources/subscriptions.rbi +933 -963
- data/rbi/lib/orb/resources/top_level.rbi +6 -8
- data/rbi/lib/orb/version.rbi +1 -1
- data/sig/orb/client.rbs +2 -0
- data/sig/orb/internal/type/array_of.rbs +2 -2
- data/sig/orb/internal/type/{boolean_model.rbs → boolean.rbs} +1 -1
- data/sig/orb/internal/util.rbs +5 -5
- data/sig/orb/models/subscription.rbs +14 -0
- data/sig/orb/models/subscription_cancel_response.rbs +47 -2
- data/sig/orb/models/subscription_change_apply_params.rbs +24 -0
- data/sig/orb/models/subscription_change_apply_response.rbs +784 -0
- data/sig/orb/models/subscription_change_cancel_params.rbs +15 -0
- data/sig/orb/models/subscription_change_cancel_response.rbs +784 -0
- data/sig/orb/models/subscription_change_retrieve_params.rbs +15 -0
- data/sig/orb/models/subscription_change_retrieve_response.rbs +784 -0
- data/sig/orb/models/subscription_create_response.rbs +47 -2
- data/sig/orb/models/subscription_price_intervals_response.rbs +47 -2
- data/sig/orb/models/subscription_schedule_plan_change_response.rbs +47 -2
- data/sig/orb/models/subscription_trigger_phase_response.rbs +47 -2
- data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +47 -2
- data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +47 -2
- data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +47 -2
- data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +47 -2
- data/sig/orb/models/subscription_update_trial_response.rbs +47 -2
- data/sig/orb/resources/customers.rbs +2 -2
- data/sig/orb/resources/subscription_changes.rbs +24 -0
- data/sig/orb/version.rbs +1 -1
- metadata +26 -5
@@ -4,261 +4,261 @@ module Orb
|
|
4
4
|
module Resources
|
5
5
|
class Subscriptions
|
6
6
|
# A subscription represents the purchase of a plan by a customer. The customer is
|
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
|
-
#
|
7
|
+
# identified by either the `customer_id` or the `external_customer_id`, and
|
8
|
+
# exactly one of these fields must be provided.
|
9
|
+
#
|
10
|
+
# By default, subscriptions begin on the day that they're created and renew
|
11
|
+
# automatically for each billing cycle at the cadence that's configured in the
|
12
|
+
# plan definition.
|
13
|
+
#
|
14
|
+
# The default configuration for subscriptions in Orb is **In-advance billing** and
|
15
|
+
# **Beginning of month alignment** (see
|
16
|
+
# [Subscription](/core-concepts##subscription) for more details).
|
17
|
+
#
|
18
|
+
# In order to change the alignment behavior, Orb also supports billing
|
19
|
+
# subscriptions on the day of the month they are created. If
|
20
|
+
# `align_billing_with_subscription_start_date = true` is specified, subscriptions
|
21
|
+
# have billing cycles that are aligned with their `start_date`. For example, a
|
22
|
+
# subscription that begins on January 15th will have a billing cycle from January
|
23
|
+
# 15th to February 15th. Every subsequent billing cycle will continue to start and
|
24
|
+
# invoice on the 15th.
|
25
|
+
#
|
26
|
+
# If the "day" value is greater than the number of days in the month, the next
|
27
|
+
# billing cycle will start at the end of the month. For example, if the start_date
|
28
|
+
# is January 31st, the next billing cycle will start on February 28th.
|
29
|
+
#
|
30
|
+
# If a customer was created with a currency, Orb only allows subscribing the
|
31
|
+
# customer to a plan with a matching `invoicing_currency`. If the customer does
|
32
|
+
# not have a currency set, on subscription creation, we set the customer's
|
33
|
+
# currency to be the `invoicing_currency` of the plan.
|
34
|
+
#
|
35
|
+
# ## Customize your customer's subscriptions
|
36
|
+
#
|
37
|
+
# Prices and adjustments in a plan can be added, removed, or replaced for the
|
38
|
+
# subscription being created. This is useful when a customer has prices that
|
39
|
+
# differ from the default prices for a specific plan.
|
40
|
+
#
|
41
|
+
# <Note>
|
42
|
+
# This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
|
43
|
+
# Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
|
44
|
+
# </Note>
|
45
|
+
#
|
46
|
+
# ### Adding Prices
|
47
|
+
#
|
48
|
+
# To add prices, provide a list of objects with the key `add_prices`. An object in
|
49
|
+
# the list must specify an existing add-on price with a `price_id` or
|
50
|
+
# `external_price_id` field, or create a new add-on price by including an object
|
51
|
+
# with the key `price`, identical to what would be used in the request body for
|
52
|
+
# the [create price endpoint](/api-reference/price/create-price). See the
|
53
|
+
# [Price resource](/product-catalog/price-configuration) for the specification of
|
54
|
+
# different price model configurations possible in this object.
|
55
|
+
#
|
56
|
+
# If the plan has phases, each object in the list must include a number with
|
57
|
+
# `plan_phase_order` key to indicate which phase the price should be added to.
|
58
|
+
#
|
59
|
+
# An object in the list can specify an optional `start_date` and optional
|
60
|
+
# `end_date`. This is equivalent to creating a price interval with the
|
61
|
+
# [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
|
62
|
+
# If unspecified, the start or end date of the phase or subscription will be used.
|
63
|
+
#
|
64
|
+
# An object in the list can specify an optional `minimum_amount`,
|
65
|
+
# `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
66
|
+
# to this price.
|
67
|
+
#
|
68
|
+
# Additionally, an object in the list can specify an optional `reference_id`. This
|
69
|
+
# ID can be used to reference this price when
|
70
|
+
# [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
71
|
+
# is _transient_ and cannot be used to refer to the price in future API calls.
|
72
|
+
#
|
73
|
+
# ### Removing Prices
|
74
|
+
#
|
75
|
+
# To remove prices, provide a list of objects with the key `remove_prices`. An
|
76
|
+
# object in the list must specify a plan price with either a `price_id` or
|
77
|
+
# `external_price_id` field.
|
78
|
+
#
|
79
|
+
# ### Replacing Prices
|
80
|
+
#
|
81
|
+
# To replace prices, provide a list of objects with the key `replace_prices`. An
|
82
|
+
# object in the list must specify a plan price to replace with the
|
83
|
+
# `replaces_price_id` key, and it must specify a price to replace it with by
|
84
|
+
# either referencing an existing add-on price with a `price_id` or
|
85
|
+
# `external_price_id` field, or by creating a new add-on price by including an
|
86
|
+
# object with the key `price`, identical to what would be used in the request body
|
87
|
+
# for the [create price endpoint](/api-reference/price/create-price). See the
|
88
|
+
# [Price resource](/product-catalog/price-configuration) for the specification of
|
89
|
+
# different price model configurations possible in this object.
|
90
|
+
#
|
91
|
+
# For fixed fees, an object in the list can supply a `fixed_price_quantity`
|
92
|
+
# instead of a `price`, `price_id`, or `external_price_id` field. This will update
|
93
|
+
# only the quantity for the price, similar to the
|
94
|
+
# [Update price quantity](/api-reference/subscription/update-price-quantity)
|
95
|
+
# endpoint.
|
96
|
+
#
|
97
|
+
# The replacement price will have the same phase, if applicable, and the same
|
98
|
+
# start and end dates as the price it replaces.
|
99
|
+
#
|
100
|
+
# An object in the list can specify an optional `minimum_amount`,
|
101
|
+
# `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
102
|
+
# to this price.
|
103
|
+
#
|
104
|
+
# Additionally, an object in the list can specify an optional `reference_id`. This
|
105
|
+
# ID can be used to reference the replacement price when
|
106
|
+
# [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
107
|
+
# is _transient_ and cannot be used to refer to the price in future API calls.
|
108
|
+
#
|
109
|
+
# ### Adding adjustments
|
110
|
+
#
|
111
|
+
# To add adjustments, provide a list of objects with the key `add_adjustments`. An
|
112
|
+
# object in the list must include an object with the key `adjustment`, identical
|
113
|
+
# to the adjustment object in the
|
114
|
+
# [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
|
115
|
+
#
|
116
|
+
# If the plan has phases, each object in the list must include a number with
|
117
|
+
# `plan_phase_order` key to indicate which phase the adjustment should be added
|
118
|
+
# to.
|
119
|
+
#
|
120
|
+
# An object in the list can specify an optional `start_date` and optional
|
121
|
+
# `end_date`. If unspecified, the start or end date of the phase or subscription
|
122
|
+
# will be used.
|
123
|
+
#
|
124
|
+
# ### Removing adjustments
|
125
|
+
#
|
126
|
+
# To remove adjustments, provide a list of objects with the key
|
127
|
+
# `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
|
128
|
+
# with the ID of the adjustment to be removed.
|
129
|
+
#
|
130
|
+
# ### Replacing adjustments
|
131
|
+
#
|
132
|
+
# To replace adjustments, provide a list of objects with the key
|
133
|
+
# `replace_adjustments`. An object in the list must specify a plan adjustment to
|
134
|
+
# replace with the `replaces_adjustment_id` key, and it must specify an adjustment
|
135
|
+
# to replace it with by including an object with the key `adjustment`, identical
|
136
|
+
# to the adjustment object in the
|
137
|
+
# [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
|
138
|
+
#
|
139
|
+
# The replacement adjustment will have the same phase, if applicable, and the same
|
140
|
+
# start and end dates as the adjustment it replaces.
|
141
|
+
#
|
142
|
+
# ## Price overrides (DEPRECATED)
|
143
|
+
#
|
144
|
+
# <Note>
|
145
|
+
# Price overrides are being phased out in favor adding/removing/replacing prices. (See
|
146
|
+
# [Customize your customer's subscriptions](/api-reference/subscription/create-subscription))
|
147
|
+
# </Note>
|
148
|
+
#
|
149
|
+
# Price overrides are used to update some or all prices in a plan for the specific
|
150
|
+
# subscription being created. This is useful when a new customer has negotiated a
|
151
|
+
# rate that is unique to the customer.
|
152
|
+
#
|
153
|
+
# To override prices, provide a list of objects with the key `price_overrides`.
|
154
|
+
# The price object in the list of overrides is expected to contain the existing
|
155
|
+
# price id, the `model_type` and configuration. (See the
|
156
|
+
# [Price resource](/product-catalog/price-configuration) for the specification of
|
157
|
+
# different price model configurations.) The numerical values can be updated, but
|
158
|
+
# the billable metric, cadence, type, and name of a price can not be overridden.
|
159
|
+
#
|
160
|
+
# ### Maximums and Minimums
|
161
|
+
#
|
162
|
+
# Minimums and maximums, much like price overrides, can be useful when a new
|
163
|
+
# customer has negotiated a new or different minimum or maximum spend cap than the
|
164
|
+
# default for a given price. If one exists for a price and null is provided for
|
165
|
+
# the minimum/maximum override on creation, then there will be no minimum/maximum
|
166
|
+
# on the new subscription. If no value is provided, then the default price maximum
|
167
|
+
# or minimum is used.
|
168
|
+
#
|
169
|
+
# To add a minimum for a specific price, add `minimum_amount` to the specific
|
170
|
+
# price in the `price_overrides` object.
|
171
|
+
#
|
172
|
+
# To add a maximum for a specific price, add `maximum_amount` to the specific
|
173
|
+
# price in the `price_overrides` object.
|
174
|
+
#
|
175
|
+
# ### Minimum override example
|
176
|
+
#
|
177
|
+
# Price minimum override example:
|
178
|
+
#
|
179
|
+
# ```json
|
180
|
+
# {
|
181
|
+
# ...
|
182
|
+
# "id": "price_id",
|
183
|
+
# "model_type": "unit",
|
184
|
+
# "unit_config": {
|
185
|
+
# "unit_amount": "0.50"
|
186
|
+
# },
|
187
|
+
# "minimum_amount": "100.00"
|
188
|
+
# ...
|
189
|
+
# }
|
190
|
+
# ```
|
191
|
+
#
|
192
|
+
# Removing an existing minimum example
|
193
|
+
#
|
194
|
+
# ```json
|
195
|
+
# {
|
196
|
+
# ...
|
197
|
+
# "id": "price_id",
|
198
|
+
# "model_type": "unit",
|
199
|
+
# "unit_config": {
|
200
|
+
# "unit_amount": "0.50"
|
201
|
+
# },
|
202
|
+
# "minimum_amount": null
|
203
|
+
# ...
|
204
|
+
# }
|
205
|
+
# ```
|
206
|
+
#
|
207
|
+
# ### Discounts
|
208
|
+
#
|
209
|
+
# Discounts, like price overrides, can be useful when a new customer has
|
210
|
+
# negotiated a new or different discount than the default for a price. If a
|
211
|
+
# discount exists for a price and a null discount is provided on creation, then
|
212
|
+
# there will be no discount on the new subscription.
|
213
|
+
#
|
214
|
+
# To add a discount for a specific price, add `discount` to the price in the
|
215
|
+
# `price_overrides` object. Discount should be a dictionary of the format:
|
216
|
+
#
|
217
|
+
# ```ts
|
218
|
+
# {
|
219
|
+
# "discount_type": "amount" | "percentage" | "usage",
|
220
|
+
# "amount_discount": string,
|
221
|
+
# "percentage_discount": string,
|
222
|
+
# "usage_discount": string
|
223
|
+
# }
|
224
|
+
# ```
|
225
|
+
#
|
226
|
+
# where either `amount_discount`, `percentage_discount`, or `usage_discount` is
|
227
|
+
# provided.
|
228
|
+
#
|
229
|
+
# Price discount example
|
230
|
+
#
|
231
|
+
# ```json
|
232
|
+
# {
|
233
|
+
# ...
|
234
|
+
# "id": "price_id",
|
235
|
+
# "model_type": "unit",
|
236
|
+
# "unit_config": {
|
237
|
+
# "unit_amount": "0.50"
|
238
|
+
# },
|
239
|
+
# "discount": {"discount_type": "amount", "amount_discount": "175"},
|
240
|
+
# }
|
241
|
+
# ```
|
242
|
+
#
|
243
|
+
# Removing an existing discount example
|
244
|
+
#
|
245
|
+
# ```json
|
246
|
+
# {
|
247
|
+
# "customer_id": "customer_id",
|
248
|
+
# "plan_id": "plan_id",
|
249
|
+
# "discount": null,
|
250
|
+
# "price_overrides": [ ... ]
|
251
|
+
# ...
|
252
|
+
# }
|
253
|
+
# ```
|
254
|
+
#
|
255
|
+
# ## Threshold Billing
|
256
|
+
#
|
257
|
+
# Orb supports invoicing for a subscription when a preconfigured usage threshold
|
258
|
+
# is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is
|
259
|
+
# specified in the subscription's invoicing currency, when creating a
|
260
|
+
# subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit
|
261
|
+
# $10.00 for a subscription that invoices in USD.
|
262
262
|
#
|
263
263
|
# @overload create(add_adjustments: nil, add_prices: nil, align_billing_with_subscription_start_date: nil, auto_collection: nil, aws_region: nil, billing_cycle_anchor_configuration: nil, coupon_redemption_code: nil, credits_overage_rate: nil, customer_id: nil, default_invoice_memo: nil, end_date: nil, external_customer_id: nil, external_marketplace: nil, external_marketplace_reporting_id: nil, external_plan_id: nil, filter: nil, initial_phase_order: nil, invoicing_threshold: nil, metadata: nil, net_terms: nil, per_credit_overage_amount: nil, plan_id: nil, plan_version_number: nil, price_overrides: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, start_date: nil, trial_duration_days: nil, usage_customer_ids: nil, request_options: {})
|
264
264
|
#
|
@@ -310,8 +310,8 @@ module Orb
|
|
310
310
|
end
|
311
311
|
|
312
312
|
# This endpoint can be used to update the `metadata`, `net terms`,
|
313
|
-
#
|
314
|
-
#
|
313
|
+
# `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
|
314
|
+
# on a subscription.
|
315
315
|
#
|
316
316
|
# @overload update(subscription_id, auto_collection: nil, default_invoice_memo: nil, invoicing_threshold: nil, metadata: nil, net_terms: nil, request_options: {})
|
317
317
|
#
|
@@ -338,14 +338,14 @@ module Orb
|
|
338
338
|
end
|
339
339
|
|
340
340
|
# This endpoint returns a list of all subscriptions for an account as a
|
341
|
-
#
|
342
|
-
#
|
343
|
-
#
|
341
|
+
# [paginated](/api-reference/pagination) list, ordered starting from the most
|
342
|
+
# recently created subscription. For a full discussion of the subscription
|
343
|
+
# resource, see [Subscription](/core-concepts##subscription).
|
344
344
|
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
#
|
345
|
+
# Subscriptions can be filtered for a specific customer by using either the
|
346
|
+
# customer_id or external_customer_id query parameters. To filter subscriptions
|
347
|
+
# for multiple customers, use the customer_id[] or external_customer_id[] query
|
348
|
+
# parameters.
|
349
349
|
#
|
350
350
|
# @overload list(created_at_gt: nil, created_at_gte: nil, created_at_lt: nil, created_at_lte: nil, cursor: nil, customer_id: nil, external_customer_id: nil, limit: nil, status: nil, request_options: {})
|
351
351
|
#
|
@@ -368,7 +368,12 @@ module Orb
|
|
368
368
|
@client.request(
|
369
369
|
method: :get,
|
370
370
|
path: "subscriptions",
|
371
|
-
query: parsed
|
371
|
+
query: parsed.transform_keys(
|
372
|
+
created_at_gt: "created_at[gt]",
|
373
|
+
created_at_gte: "created_at[gte]",
|
374
|
+
created_at_lt: "created_at[lt]",
|
375
|
+
created_at_lte: "created_at[lte]"
|
376
|
+
),
|
372
377
|
page: Orb::Internal::Page,
|
373
378
|
model: Orb::Models::Subscription,
|
374
379
|
options: options
|
@@ -376,66 +381,66 @@ module Orb
|
|
376
381
|
end
|
377
382
|
|
378
383
|
# This endpoint can be used to cancel an existing subscription. It returns the
|
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
|
-
#
|
384
|
+
# serialized subscription object with an `end_date` parameter that signifies when
|
385
|
+
# the subscription will transition to an ended state.
|
386
|
+
#
|
387
|
+
# The body parameter `cancel_option` determines the cancellation behavior. Orb
|
388
|
+
# supports three cancellation options:
|
389
|
+
#
|
390
|
+
# - `end_of_subscription_term`: stops the subscription from auto-renewing.
|
391
|
+
# Subscriptions that have been cancelled with this option can still incur
|
392
|
+
# charges for the remainder of their term:
|
393
|
+
#
|
394
|
+
# - Issuing this cancellation request for a monthly subscription will keep the
|
395
|
+
# subscription active until the start of the subsequent month, and potentially
|
396
|
+
# issue an invoice for any usage charges incurred in the intervening period.
|
397
|
+
# - Issuing this cancellation request for a quarterly subscription will keep the
|
398
|
+
# subscription active until the end of the quarter and potentially issue an
|
399
|
+
# invoice for any usage charges incurred in the intervening period.
|
400
|
+
# - Issuing this cancellation request for a yearly subscription will keep the
|
401
|
+
# subscription active for the full year. For example, a yearly subscription
|
402
|
+
# starting on 2021-11-01 and cancelled on 2021-12-08 will remain active until
|
403
|
+
# 2022-11-01 and potentially issue charges in the intervening months for any
|
404
|
+
# recurring monthly usage charges in its plan.
|
405
|
+
# - **Note**: If a subscription's plan contains prices with difference cadences,
|
406
|
+
# the end of term date will be determined by the largest cadence value. For
|
407
|
+
# example, cancelling end of term for a subscription with a quarterly fixed
|
408
|
+
# fee with a monthly usage fee will result in the subscription ending at the
|
409
|
+
# end of the quarter.
|
410
|
+
#
|
411
|
+
# - `immediate`: ends the subscription immediately, setting the `end_date` to the
|
412
|
+
# current time:
|
413
|
+
#
|
414
|
+
# - Subscriptions that have been cancelled with this option will be invoiced
|
415
|
+
# immediately. This invoice will include any usage fees incurred in the
|
416
|
+
# billing period up to the cancellation, along with any prorated recurring
|
417
|
+
# fees for the billing period, if applicable.
|
418
|
+
# - **Note**: If the subscription has a recurring fee that was paid in-advance,
|
419
|
+
# the prorated amount for the remaining time period will be added to the
|
420
|
+
# [customer's balance](list-balance-transactions) upon immediate cancellation.
|
421
|
+
# However, if the customer is ineligible to use the customer balance, the
|
422
|
+
# subscription cannot be cancelled immediately.
|
423
|
+
#
|
424
|
+
# - `requested_date`: ends the subscription on a specified date, which requires a
|
425
|
+
# `cancellation_date` to be passed in. If no timezone is provided, the
|
426
|
+
# customer's timezone is used. For example, a subscription starting on January
|
427
|
+
# 1st with a monthly price can be set to be cancelled on the first of any month
|
428
|
+
# after January 1st (e.g. March 1st, April 1st, May 1st). A subscription with
|
429
|
+
# multiple prices with different cadences defines the "term" to be the highest
|
430
|
+
# cadence of the prices.
|
431
|
+
#
|
432
|
+
# Upcoming subscriptions are only eligible for immediate cancellation, which will
|
433
|
+
# set the `end_date` equal to the `start_date` upon cancellation.
|
434
|
+
#
|
435
|
+
# ## Backdated cancellations
|
436
|
+
#
|
437
|
+
# Orb allows you to cancel a subscription in the past as long as there are no paid
|
438
|
+
# invoices between the `requested_date` and the current time. If the cancellation
|
439
|
+
# is after the latest issued invoice, Orb will generate a balance refund for the
|
440
|
+
# current period. If the cancellation is before the most recently issued invoice,
|
441
|
+
# Orb will void the intervening invoice and generate a new one based on the new
|
442
|
+
# dates for the subscription. See the section on
|
443
|
+
# [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors).
|
439
444
|
#
|
440
445
|
# @overload cancel(subscription_id, cancel_option:, allow_invoice_credit_or_void: nil, cancellation_date: nil, request_options: {})
|
441
446
|
#
|
@@ -460,7 +465,7 @@ module Orb
|
|
460
465
|
end
|
461
466
|
|
462
467
|
# This endpoint is used to fetch a [Subscription](/core-concepts##subscription)
|
463
|
-
#
|
468
|
+
# given an identifier.
|
464
469
|
#
|
465
470
|
# @overload fetch(subscription_id, request_options: {})
|
466
471
|
#
|
@@ -480,15 +485,15 @@ module Orb
|
|
480
485
|
end
|
481
486
|
|
482
487
|
# This endpoint is used to fetch a day-by-day snapshot of a subscription's costs
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
488
|
+
# in Orb, calculated by applying pricing information to the underlying usage (see
|
489
|
+
# the [subscription usage endpoint](fetch-subscription-usage) to fetch usage per
|
490
|
+
# metric, in usage units rather than a currency).
|
486
491
|
#
|
487
|
-
#
|
488
|
-
#
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
492
|
+
# The semantics of this endpoint exactly mirror those of
|
493
|
+
# [fetching a customer's costs](fetch-customer-costs). Use this endpoint to limit
|
494
|
+
# your analysis of costs to a specific subscription for the customer (e.g. to
|
495
|
+
# de-aggregate costs when a customer's subscription has started and stopped on the
|
496
|
+
# same day).
|
492
497
|
#
|
493
498
|
# @overload fetch_costs(subscription_id, currency: nil, timeframe_end: nil, timeframe_start: nil, view_mode: nil, request_options: {})
|
494
499
|
#
|
@@ -514,9 +519,9 @@ module Orb
|
|
514
519
|
end
|
515
520
|
|
516
521
|
# This endpoint returns a [paginated](/api-reference/pagination) list of all plans
|
517
|
-
#
|
518
|
-
#
|
519
|
-
#
|
522
|
+
# associated with a subscription along with their start and end dates. This list
|
523
|
+
# contains the subscription's initial plan along with past and future plan
|
524
|
+
# changes.
|
520
525
|
#
|
521
526
|
# @overload fetch_schedule(subscription_id, cursor: nil, limit: nil, start_date_gt: nil, start_date_gte: nil, start_date_lt: nil, start_date_lte: nil, request_options: {})
|
522
527
|
#
|
@@ -537,7 +542,12 @@ module Orb
|
|
537
542
|
@client.request(
|
538
543
|
method: :get,
|
539
544
|
path: ["subscriptions/%1$s/schedule", subscription_id],
|
540
|
-
query: parsed
|
545
|
+
query: parsed.transform_keys(
|
546
|
+
start_date_gt: "start_date[gt]",
|
547
|
+
start_date_gte: "start_date[gte]",
|
548
|
+
start_date_lt: "start_date[lt]",
|
549
|
+
start_date_lte: "start_date[lte]"
|
550
|
+
),
|
541
551
|
page: Orb::Internal::Page,
|
542
552
|
model: Orb::Models::SubscriptionFetchScheduleResponse,
|
543
553
|
options: options
|
@@ -545,199 +555,199 @@ module Orb
|
|
545
555
|
end
|
546
556
|
|
547
557
|
# This endpoint is used to fetch a subscription's usage in Orb. Especially when
|
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
|
-
#
|
558
|
+
# combined with optional query parameters, this endpoint is a powerful way to
|
559
|
+
# build visualizations on top of Orb's event data and metrics.
|
560
|
+
#
|
561
|
+
# With no query parameters specified, this endpoint returns usage for the
|
562
|
+
# subscription's _current billing period_ across each billable metric that
|
563
|
+
# participates in the subscription. Usage quantities returned are the result of
|
564
|
+
# evaluating the metric definition for the entirety of the customer's billing
|
565
|
+
# period.
|
566
|
+
#
|
567
|
+
# ### Default response shape
|
568
|
+
#
|
569
|
+
# Orb returns a `data` array with an object corresponding to each billable metric.
|
570
|
+
# Nested within this object is a `usage` array which has a `quantity` value and a
|
571
|
+
# corresponding `timeframe_start` and `timeframe_end`. The `quantity` value
|
572
|
+
# represents the calculated usage value for the billable metric over the specified
|
573
|
+
# timeframe (inclusive of the `timeframe_start` timestamp and exclusive of the
|
574
|
+
# `timeframe_end` timestamp).
|
575
|
+
#
|
576
|
+
# Orb will include _every_ window in the response starting from the beginning of
|
577
|
+
# the billing period, even when there were no events (and therefore no usage) in
|
578
|
+
# the window. This increases the size of the response but prevents the caller from
|
579
|
+
# filling in gaps and handling cumbersome time-based logic.
|
580
|
+
#
|
581
|
+
# The query parameters in this endpoint serve to override this behavior and
|
582
|
+
# provide some key functionality, as listed below. Note that this functionality
|
583
|
+
# can also be used _in conjunction_ with each other, e.g. to display grouped usage
|
584
|
+
# on a custom timeframe.
|
585
|
+
#
|
586
|
+
# ## Custom timeframe
|
587
|
+
#
|
588
|
+
# In order to view usage for a custom timeframe rather than the current billing
|
589
|
+
# period, specify a `timeframe_start` and `timeframe_end`. This will calculate
|
590
|
+
# quantities for usage incurred between timeframe_start (inclusive) and
|
591
|
+
# timeframe_end (exclusive), i.e. `[timeframe_start, timeframe_end)`.
|
592
|
+
#
|
593
|
+
# Note:
|
594
|
+
#
|
595
|
+
# - These timestamps must be specified in ISO 8601 format and UTC timezone, e.g.
|
596
|
+
# `2022-02-01T05:00:00Z`.
|
597
|
+
# - Both parameters must be specified if either is specified.
|
598
|
+
#
|
599
|
+
# ## Grouping by custom attributes
|
600
|
+
#
|
601
|
+
# In order to view a single metric grouped by a specific _attribute_ that each
|
602
|
+
# event is tagged with (e.g. `cluster`), you must additionally specify a
|
603
|
+
# `billable_metric_id` and a `group_by` key. The `group_by` key denotes the event
|
604
|
+
# property on which to group.
|
605
|
+
#
|
606
|
+
# When returning grouped usage, only usage for `billable_metric_id` is returned,
|
607
|
+
# and a separate object in the `data` array is returned for each value of the
|
608
|
+
# `group_by` key present in your events. The `quantity` value is the result of
|
609
|
+
# evaluating the billable metric for events filtered to a single value of the
|
610
|
+
# `group_by` key.
|
611
|
+
#
|
612
|
+
# Orb expects that events that match the billable metric will contain values in
|
613
|
+
# the `properties` dictionary that correspond to the `group_by` key specified. By
|
614
|
+
# default, Orb will not return a `null` group (i.e. events that match the metric
|
615
|
+
# but do not have the key set). Currently, it is only possible to view usage
|
616
|
+
# grouped by a single attribute at a time.
|
617
|
+
#
|
618
|
+
# When viewing grouped usage, Orb uses pagination to limit the response size to
|
619
|
+
# 1000 groups by default. If there are more groups for a given subscription,
|
620
|
+
# pagination metadata in the response can be used to fetch all of the data.
|
621
|
+
#
|
622
|
+
# The following example shows usage for an "API Requests" billable metric grouped
|
623
|
+
# by `region`. Note the extra `metric_group` dictionary in the response, which
|
624
|
+
# provides metadata about the group:
|
625
|
+
#
|
626
|
+
# ```json
|
627
|
+
# {
|
628
|
+
# "data": [
|
629
|
+
# {
|
630
|
+
# "usage": [
|
631
|
+
# {
|
632
|
+
# "quantity": 0.19291,
|
633
|
+
# "timeframe_start": "2021-10-01T07:00:00Z",
|
634
|
+
# "timeframe_end": "2021-10-02T07:00:00Z",
|
635
|
+
# },
|
636
|
+
# ...
|
637
|
+
# ],
|
638
|
+
# "metric_group": {
|
639
|
+
# "property_key": "region",
|
640
|
+
# "property_value": "asia/pacific"
|
641
|
+
# },
|
642
|
+
# "billable_metric": {
|
643
|
+
# "id": "Fe9pbpMk86xpwdGB",
|
644
|
+
# "name": "API Requests"
|
645
|
+
# },
|
646
|
+
# "view_mode": "periodic"
|
647
|
+
# },
|
648
|
+
# ...
|
649
|
+
# ]
|
650
|
+
# }
|
651
|
+
# ```
|
652
|
+
#
|
653
|
+
# ## Windowed usage
|
654
|
+
#
|
655
|
+
# The `granularity` parameter can be used to _window_ the usage `quantity` value
|
656
|
+
# into periods. When not specified, usage is returned for the entirety of the time
|
657
|
+
# range.
|
658
|
+
#
|
659
|
+
# When `granularity = day` is specified with a timeframe longer than a day, Orb
|
660
|
+
# will return a `quantity` value for each full day between `timeframe_start` and
|
661
|
+
# `timeframe_end`. Note that the days are demarcated by the _customer's local
|
662
|
+
# midnight_.
|
663
|
+
#
|
664
|
+
# For example, with `timeframe_start = 2022-02-01T05:00:00Z`,
|
665
|
+
# `timeframe_end = 2022-02-04T01:00:00Z` and `granularity=day`, the following
|
666
|
+
# windows will be returned for a customer in the `America/Los_Angeles` timezone
|
667
|
+
# since local midnight is `08:00` UTC:
|
668
|
+
#
|
669
|
+
# - `[2022-02-01T05:00:00Z, 2022-02-01T08:00:00Z)`
|
670
|
+
# - `[2022-02-01T08:00:00, 2022-02-02T08:00:00Z)`
|
671
|
+
# - `[2022-02-02T08:00:00, 2022-02-03T08:00:00Z)`
|
672
|
+
# - `[2022-02-03T08:00:00, 2022-02-04T01:00:00Z)`
|
673
|
+
#
|
674
|
+
# ```json
|
675
|
+
# {
|
676
|
+
# "data": [
|
677
|
+
# {
|
678
|
+
# "billable_metric": {
|
679
|
+
# "id": "Q8w89wjTtBdejXKsm",
|
680
|
+
# "name": "API Requests"
|
681
|
+
# },
|
682
|
+
# "usage": [
|
683
|
+
# {
|
684
|
+
# "quantity": 0,
|
685
|
+
# "timeframe_end": "2022-02-01T08:00:00+00:00",
|
686
|
+
# "timeframe_start": "2022-02-01T05:00:00+00:00"
|
687
|
+
# },
|
688
|
+
# {
|
689
|
+
#
|
690
|
+
# "quantity": 0,
|
691
|
+
# "timeframe_end": "2022-02-02T08:00:00+00:00",
|
692
|
+
# "timeframe_start": "2022-02-01T08:00:00+00:00"
|
693
|
+
# },
|
694
|
+
# {
|
695
|
+
# "quantity": 0,
|
696
|
+
# "timeframe_end": "2022-02-03T08:00:00+00:00",
|
697
|
+
# "timeframe_start": "2022-02-02T08:00:00+00:00"
|
698
|
+
# },
|
699
|
+
# {
|
700
|
+
# "quantity": 0,
|
701
|
+
# "timeframe_end": "2022-02-04T01:00:00+00:00",
|
702
|
+
# "timeframe_start": "2022-02-03T08:00:00+00:00"
|
703
|
+
# }
|
704
|
+
# ],
|
705
|
+
# "view_mode": "periodic"
|
706
|
+
# },
|
707
|
+
# ...
|
708
|
+
# ]
|
709
|
+
# }
|
710
|
+
# ```
|
711
|
+
#
|
712
|
+
# ## Decomposable vs. non-decomposable metrics
|
713
|
+
#
|
714
|
+
# Billable metrics fall into one of two categories: decomposable and
|
715
|
+
# non-decomposable. A decomposable billable metric, such as a sum or a count, can
|
716
|
+
# be displayed and aggregated across arbitrary timescales. On the other hand, a
|
717
|
+
# non-decomposable metric is not meaningful when only a slice of the billing
|
718
|
+
# window is considered.
|
719
|
+
#
|
720
|
+
# As an example, if we have a billable metric that's defined to count unique
|
721
|
+
# users, displaying a graph of unique users for each day is not representative of
|
722
|
+
# the billable metric value over the month (days could have an overlapping set of
|
723
|
+
# 'unique' users). Instead, what's useful for any given day is the number of
|
724
|
+
# unique users in the billing period so far, which are the _cumulative_ unique
|
725
|
+
# users.
|
726
|
+
#
|
727
|
+
# Accordingly, this endpoint returns treats these two types of metrics differently
|
728
|
+
# when `group_by` is specified:
|
729
|
+
#
|
730
|
+
# - Decomposable metrics can be grouped by any event property.
|
731
|
+
# - Non-decomposable metrics can only be grouped by the corresponding price's
|
732
|
+
# invoice grouping key. If no invoice grouping key is present, the metric does
|
733
|
+
# not support `group_by`.
|
734
|
+
#
|
735
|
+
# ## Matrix prices
|
736
|
+
#
|
737
|
+
# When a billable metric is attached to a price that uses matrix pricing, it's
|
738
|
+
# important to view usage grouped by those matrix dimensions. In this case, use
|
739
|
+
# the query parameters `first_dimension_key`, `first_dimension_value` and
|
740
|
+
# `second_dimension_key`, `second_dimension_value` while filtering to a specific
|
741
|
+
# `billable_metric_id`.
|
742
|
+
#
|
743
|
+
# For example, if your compute metric has a separate unit price (i.e. a matrix
|
744
|
+
# pricing model) per `region` and `provider`, your request might provide the
|
745
|
+
# following parameters:
|
746
|
+
#
|
747
|
+
# - `first_dimension_key`: `region`
|
748
|
+
# - `first_dimension_value`: `us-east-1`
|
749
|
+
# - `second_dimension_key`: `provider`
|
750
|
+
# - `second_dimension_value`: `aws`
|
741
751
|
#
|
742
752
|
# @overload fetch_usage(subscription_id, billable_metric_id: nil, first_dimension_key: nil, first_dimension_value: nil, granularity: nil, group_by: nil, second_dimension_key: nil, second_dimension_value: nil, timeframe_end: nil, timeframe_start: nil, view_mode: nil, request_options: {})
|
743
753
|
#
|
@@ -769,77 +779,77 @@ module Orb
|
|
769
779
|
end
|
770
780
|
|
771
781
|
# This endpoint is used to add and edit subscription
|
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
|
-
#
|
782
|
+
# [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). By
|
783
|
+
# making modifications to a subscription’s price intervals, you can
|
784
|
+
# [flexibly and atomically control the billing behavior of a subscription](/product-catalog/modifying-subscriptions).
|
785
|
+
#
|
786
|
+
# ## Adding price intervals
|
787
|
+
#
|
788
|
+
# Prices can be added as price intervals to a subscription by specifying them in
|
789
|
+
# the `add` array. A `price_id` or `external_price_id` from an add-on price or
|
790
|
+
# previously removed plan price can be specified to reuse an existing price
|
791
|
+
# definition (however, please note that prices from other plans cannot be added to
|
792
|
+
# the subscription). Additionally, a new price can be specified using the `price`
|
793
|
+
# field — this price will be created automatically.
|
794
|
+
#
|
795
|
+
# A `start_date` must be specified for the price interval. This is the date when
|
796
|
+
# the price will start billing on the subscription, so this will notably result in
|
797
|
+
# an immediate charge at this time for any billed in advance fixed fees. The
|
798
|
+
# `end_date` will default to null, resulting in a price interval that will bill on
|
799
|
+
# a continually recurring basis. Both of these dates can be set in the past or the
|
800
|
+
# future and Orb will generate or modify invoices to ensure the subscription’s
|
801
|
+
# invoicing behavior is correct.
|
802
|
+
#
|
803
|
+
# Additionally, a discount, minimum, or maximum can be specified on the price
|
804
|
+
# interval. This will only apply to this price interval, not any other price
|
805
|
+
# intervals on the subscription.
|
806
|
+
#
|
807
|
+
# ## Adjustment intervals
|
808
|
+
#
|
809
|
+
# An adjustment interval represents the time period that a particular adjustment
|
810
|
+
# (a discount, minimum, or maximum) applies to the prices on a subscription.
|
811
|
+
# Adjustment intervals can be added to a subscription by specifying them in the
|
812
|
+
# `add_adjustments` array, or modified via the `edit_adjustments` array. When
|
813
|
+
# creating an adjustment interval, you'll need to provide the definition of the
|
814
|
+
# new adjustment (the type of adjustment, and which prices it applies to), as well
|
815
|
+
# as the start and end dates for the adjustment interval. The start and end dates
|
816
|
+
# of an existing adjustment interval can be edited via the `edit_adjustments`
|
817
|
+
# field (just like price intervals). (To "change" the amount of a discount,
|
818
|
+
# minimum, or maximum, then, you'll need to end the existing interval, and create
|
819
|
+
# a new adjustment interval with the new amount and a start date that matches the
|
820
|
+
# end date of the previous interval.)
|
821
|
+
#
|
822
|
+
# ## Editing price intervals
|
823
|
+
#
|
824
|
+
# Price intervals can be adjusted by specifying edits to make in the `edit` array.
|
825
|
+
# A `price_interval_id` to edit must be specified — this can be retrieved from the
|
826
|
+
# `price_intervals` field on the subscription.
|
827
|
+
#
|
828
|
+
# A new `start_date` or `end_date` can be specified to change the range of the
|
829
|
+
# price interval, which will modify past or future invoices to ensure correctness.
|
830
|
+
# If either of these dates are unspecified, they will default to the existing date
|
831
|
+
# on the price interval. To remove a price interval entirely from a subscription,
|
832
|
+
# set the `end_date` to be equivalent to the `start_date`.
|
833
|
+
#
|
834
|
+
# ## Fixed fee quantity transitions
|
835
|
+
#
|
836
|
+
# The fixed fee quantity transitions for a fixed fee price interval can also be
|
837
|
+
# specified when adding or editing by passing an array for
|
838
|
+
# `fixed_fee_quantity_transitions`. A fixed fee quantity transition must have a
|
839
|
+
# `quantity` and an `effective_date`, which is the date after which the new
|
840
|
+
# quantity will be used for billing. If a fixed fee quantity transition is
|
841
|
+
# scheduled at a billing period boundary, the full quantity will be billed on an
|
842
|
+
# invoice with the other prices on the subscription. If the fixed fee quantity
|
843
|
+
# transition is scheduled mid-billing period, the difference between the existing
|
844
|
+
# quantity and quantity specified in the transition will be prorated for the rest
|
845
|
+
# of the billing period and billed immediately, which will generate a new invoice.
|
846
|
+
#
|
847
|
+
# Notably, the list of fixed fee quantity transitions passed will overwrite the
|
848
|
+
# existing fixed fee quantity transitions on the price interval, so the entire
|
849
|
+
# list of transitions must be specified to add additional transitions. The
|
850
|
+
# existing list of transitions can be retrieved using the
|
851
|
+
# `fixed_fee_quantity_transitions` property on a subscription’s serialized price
|
852
|
+
# intervals.
|
843
853
|
#
|
844
854
|
# @overload price_intervals(subscription_id, add: nil, add_adjustments: nil, allow_invoice_credit_or_void: nil, edit: nil, edit_adjustments: nil, request_options: {})
|
845
855
|
#
|
@@ -866,188 +876,188 @@ module Orb
|
|
866
876
|
end
|
867
877
|
|
868
878
|
# This endpoint can be used to change an existing subscription's plan. It returns
|
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
|
-
#
|
879
|
+
# the serialized updated subscription object.
|
880
|
+
#
|
881
|
+
# The body parameter `change_option` determines when the plan change occurrs. Orb
|
882
|
+
# supports three options:
|
883
|
+
#
|
884
|
+
# - `end_of_subscription_term`: changes the plan at the end of the existing plan's
|
885
|
+
# term.
|
886
|
+
# - Issuing this plan change request for a monthly subscription will keep the
|
887
|
+
# existing plan active until the start of the subsequent month. Issuing this
|
888
|
+
# plan change request for a yearly subscription will keep the existing plan
|
889
|
+
# active for the full year. Charges incurred in the remaining period will be
|
890
|
+
# invoiced as normal.
|
891
|
+
# - Example: The plan is billed monthly on the 1st of the month, the request is
|
892
|
+
# made on January 15th, so the plan will be changed on February 1st, and
|
893
|
+
# invoice will be issued on February 1st for the last month of the original
|
894
|
+
# plan.
|
895
|
+
# - `immediate`: changes the plan immediately.
|
896
|
+
# - Subscriptions that have their plan changed with this option will move to the
|
897
|
+
# new plan immediately, and be invoiced immediately.
|
898
|
+
# - This invoice will include any usage fees incurred in the billing period up
|
899
|
+
# to the change, along with any prorated recurring fees for the billing
|
900
|
+
# period, if applicable.
|
901
|
+
# - Example: The plan is billed monthly on the 1st of the month, the request is
|
902
|
+
# made on January 15th, so the plan will be changed on January 15th, and an
|
903
|
+
# invoice will be issued for the partial month, from January 1 to January 15,
|
904
|
+
# on the original plan.
|
905
|
+
# - `requested_date`: changes the plan on the requested date (`change_date`).
|
906
|
+
# - If no timezone is provided, the customer's timezone is used. The
|
907
|
+
# `change_date` body parameter is required if this option is chosen.
|
908
|
+
# - Example: The plan is billed monthly on the 1st of the month, the request is
|
909
|
+
# made on January 15th, with a requested `change_date` of February 15th, so
|
910
|
+
# the plan will be changed on February 15th, and invoices will be issued on
|
911
|
+
# February 1st and February 15th.
|
912
|
+
#
|
913
|
+
# Note that one of `plan_id` or `external_plan_id` is required in the request body
|
914
|
+
# for this operation.
|
915
|
+
#
|
916
|
+
# ## Customize your customer's subscriptions
|
917
|
+
#
|
918
|
+
# Prices and adjustments in a plan can be added, removed, or replaced on the
|
919
|
+
# subscription when you schedule the plan change. This is useful when a customer
|
920
|
+
# has prices that differ from the default prices for a specific plan.
|
921
|
+
#
|
922
|
+
# <Note>
|
923
|
+
# This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
|
924
|
+
# Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
|
925
|
+
# </Note>
|
926
|
+
#
|
927
|
+
# ### Adding Prices
|
928
|
+
#
|
929
|
+
# To add prices, provide a list of objects with the key `add_prices`. An object in
|
930
|
+
# the list must specify an existing add-on price with a `price_id` or
|
931
|
+
# `external_price_id` field, or create a new add-on price by including an object
|
932
|
+
# with the key `price`, identical to what would be used in the request body for
|
933
|
+
# the [create price endpoint](/api-reference/price/create-price). See the
|
934
|
+
# [Price resource](/product-catalog/price-configuration) for the specification of
|
935
|
+
# different price model configurations possible in this object.
|
936
|
+
#
|
937
|
+
# If the plan has phases, each object in the list must include a number with
|
938
|
+
# `plan_phase_order` key to indicate which phase the price should be added to.
|
939
|
+
#
|
940
|
+
# An object in the list can specify an optional `start_date` and optional
|
941
|
+
# `end_date`. If `start_date` is unspecified, the start of the phase / plan change
|
942
|
+
# time will be used. If `end_date` is unspecified, it will finish at the end of
|
943
|
+
# the phase / have no end time.
|
944
|
+
#
|
945
|
+
# An object in the list can specify an optional `minimum_amount`,
|
946
|
+
# `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
947
|
+
# to this price.
|
948
|
+
#
|
949
|
+
# Additionally, an object in the list can specify an optional `reference_id`. This
|
950
|
+
# ID can be used to reference this price when
|
951
|
+
# [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
952
|
+
# is _transient_ and cannot be used to refer to the price in future API calls.
|
953
|
+
#
|
954
|
+
# ### Removing Prices
|
955
|
+
#
|
956
|
+
# To remove prices, provide a list of objects with the key `remove_prices`. An
|
957
|
+
# object in the list must specify a plan price with either a `price_id` or
|
958
|
+
# `external_price_id` field.
|
959
|
+
#
|
960
|
+
# ### Replacing Prices
|
961
|
+
#
|
962
|
+
# To replace prices, provide a list of objects with the key `replace_prices`. An
|
963
|
+
# object in the list must specify a plan price to replace with the
|
964
|
+
# `replaces_price_id` key, and it must specify a price to replace it with by
|
965
|
+
# either referencing an existing add-on price with a `price_id` or
|
966
|
+
# `external_price_id` field, or by creating a new add-on price by including an
|
967
|
+
# object with the key `price`, identical to what would be used in the request body
|
968
|
+
# for the [create price endpoint](/api-reference/price/create-price). See the
|
969
|
+
# [Price resource](/product-catalog/price-configuration) for the specification of
|
970
|
+
# different price model configurations possible in this object.
|
971
|
+
#
|
972
|
+
# For fixed fees, an object in the list can supply a `fixed_price_quantity`
|
973
|
+
# instead of a `price`, `price_id`, or `external_price_id` field. This will update
|
974
|
+
# only the quantity for the price, similar to the
|
975
|
+
# [Update price quantity](/api-reference/subscription/update-price-quantity)
|
976
|
+
# endpoint.
|
977
|
+
#
|
978
|
+
# The replacement price will have the same phase, if applicable, and the same
|
979
|
+
# start and end dates as the price it replaces.
|
980
|
+
#
|
981
|
+
# An object in the list can specify an optional `minimum_amount`,
|
982
|
+
# `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
983
|
+
# to this price.
|
984
|
+
#
|
985
|
+
# Additionally, an object in the list can specify an optional `reference_id`. This
|
986
|
+
# ID can be used to reference the replacement price when
|
987
|
+
# [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
988
|
+
# is _transient_ and cannot be used to refer to the price in future API calls.
|
989
|
+
#
|
990
|
+
# ### Adding adjustments
|
991
|
+
#
|
992
|
+
# To add adjustments, provide a list of objects with the key `add_adjustments`. An
|
993
|
+
# object in the list must include an object with the key `adjustment`, identical
|
994
|
+
# to the adjustment object in the
|
995
|
+
# [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
|
996
|
+
#
|
997
|
+
# If the plan has phases, each object in the list must include a number with
|
998
|
+
# `plan_phase_order` key to indicate which phase the adjustment should be added
|
999
|
+
# to.
|
1000
|
+
#
|
1001
|
+
# An object in the list can specify an optional `start_date` and optional
|
1002
|
+
# `end_date`. If `start_date` is unspecified, the start of the phase / plan change
|
1003
|
+
# time will be used. If `end_date` is unspecified, it will finish at the end of
|
1004
|
+
# the phase / have no end time.
|
1005
|
+
#
|
1006
|
+
# ### Removing adjustments
|
997
1007
|
#
|
998
|
-
#
|
999
|
-
#
|
1000
|
-
#
|
1008
|
+
# To remove adjustments, provide a list of objects with the key
|
1009
|
+
# `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
|
1010
|
+
# with the ID of the adjustment to be removed.
|
1001
1011
|
#
|
1002
|
-
#
|
1012
|
+
# ### Replacing adjustments
|
1003
1013
|
#
|
1004
|
-
#
|
1005
|
-
#
|
1006
|
-
#
|
1007
|
-
#
|
1008
|
-
#
|
1009
|
-
#
|
1014
|
+
# To replace adjustments, provide a list of objects with the key
|
1015
|
+
# `replace_adjustments`. An object in the list must specify a plan adjustment to
|
1016
|
+
# replace with the `replaces_adjustment_id` key, and it must specify an adjustment
|
1017
|
+
# to replace it with by including an object with the key `adjustment`, identical
|
1018
|
+
# to the adjustment object in the
|
1019
|
+
# [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
|
1010
1020
|
#
|
1011
|
-
#
|
1012
|
-
#
|
1021
|
+
# The replacement adjustment will have the same phase, if applicable, and the same
|
1022
|
+
# start and end dates as the adjustment it replaces.
|
1013
1023
|
#
|
1014
|
-
#
|
1024
|
+
# ## Price overrides (DEPRECATED)
|
1015
1025
|
#
|
1016
|
-
#
|
1017
|
-
#
|
1018
|
-
#
|
1019
|
-
#
|
1020
|
-
#
|
1021
|
-
#
|
1022
|
-
#
|
1023
|
-
#
|
1026
|
+
# <Note>
|
1027
|
+
# Price overrides are being phased out in favor adding/removing/replacing prices. (See
|
1028
|
+
# [Customize your customer's subscriptions](/api-reference/subscription/schedule-plan-change))
|
1029
|
+
# </Note>
|
1030
|
+
#
|
1031
|
+
# Price overrides are used to update some or all prices in a plan for the specific
|
1032
|
+
# subscription being created. This is useful when a new customer has negotiated a
|
1033
|
+
# rate that is unique to the customer.
|
1024
1034
|
#
|
1025
|
-
#
|
1026
|
-
#
|
1027
|
-
#
|
1028
|
-
#
|
1029
|
-
#
|
1030
|
-
#
|
1035
|
+
# To override prices, provide a list of objects with the key `price_overrides`.
|
1036
|
+
# The price object in the list of overrides is expected to contain the existing
|
1037
|
+
# price id, the `model_type` and configuration. (See the
|
1038
|
+
# [Price resource](/product-catalog/price-configuration) for the specification of
|
1039
|
+
# different price model configurations.) The numerical values can be updated, but
|
1040
|
+
# the billable metric, cadence, type, and name of a price can not be overridden.
|
1031
1041
|
#
|
1032
|
-
#
|
1042
|
+
# ### Maximums, and minimums
|
1033
1043
|
#
|
1034
|
-
#
|
1035
|
-
#
|
1036
|
-
#
|
1037
|
-
#
|
1038
|
-
#
|
1044
|
+
# Price overrides are used to update some or all prices in the target plan.
|
1045
|
+
# Minimums and maximums, much like price overrides, can be useful when a new
|
1046
|
+
# customer has negotiated a new or different minimum or maximum spend cap than the
|
1047
|
+
# default for the plan. The request format for maximums and minimums is the same
|
1048
|
+
# as those in [subscription creation](create-subscription).
|
1039
1049
|
#
|
1040
|
-
#
|
1050
|
+
# ## Scheduling multiple plan changes
|
1041
1051
|
#
|
1042
|
-
#
|
1043
|
-
#
|
1052
|
+
# When scheduling multiple plan changes with the same date, the latest plan change
|
1053
|
+
# on that day takes effect.
|
1044
1054
|
#
|
1045
|
-
#
|
1055
|
+
# ## Prorations for in-advance fees
|
1046
1056
|
#
|
1047
|
-
#
|
1048
|
-
#
|
1049
|
-
#
|
1050
|
-
#
|
1057
|
+
# By default, Orb calculates the prorated difference in any fixed fees when making
|
1058
|
+
# a plan change, adjusting the customer balance as needed. For details on this
|
1059
|
+
# behavior, see
|
1060
|
+
# [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees).
|
1051
1061
|
#
|
1052
1062
|
# @overload schedule_plan_change(subscription_id, change_option:, add_adjustments: nil, add_prices: nil, align_billing_with_plan_change_date: nil, auto_collection: nil, billing_cycle_alignment: nil, billing_cycle_anchor_configuration: nil, change_date: nil, coupon_redemption_code: nil, credits_overage_rate: nil, default_invoice_memo: nil, external_plan_id: nil, filter: nil, initial_phase_order: nil, invoicing_threshold: nil, net_terms: nil, per_credit_overage_amount: nil, plan_id: nil, plan_version_number: nil, price_overrides: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, trial_duration_days: nil, usage_customer_ids: nil, request_options: {})
|
1053
1063
|
#
|
@@ -1095,7 +1105,7 @@ module Orb
|
|
1095
1105
|
end
|
1096
1106
|
|
1097
1107
|
# Manually trigger a phase, effective the given date (or the current time, if not
|
1098
|
-
#
|
1108
|
+
# specified).
|
1099
1109
|
#
|
1100
1110
|
# @overload trigger_phase(subscription_id, allow_invoice_credit_or_void: nil, effective_date: nil, request_options: {})
|
1101
1111
|
#
|
@@ -1119,11 +1129,11 @@ module Orb
|
|
1119
1129
|
end
|
1120
1130
|
|
1121
1131
|
# This endpoint can be used to unschedule any pending cancellations for a
|
1122
|
-
#
|
1132
|
+
# subscription.
|
1123
1133
|
#
|
1124
|
-
#
|
1125
|
-
#
|
1126
|
-
#
|
1134
|
+
# To be eligible, the subscription must currently be active and have a future
|
1135
|
+
# cancellation. This operation will turn on auto-renew, ensuring that the
|
1136
|
+
# subscription does not end at the currently scheduled cancellation time.
|
1127
1137
|
#
|
1128
1138
|
# @overload unschedule_cancellation(subscription_id, request_options: {})
|
1129
1139
|
#
|
@@ -1143,10 +1153,10 @@ module Orb
|
|
1143
1153
|
end
|
1144
1154
|
|
1145
1155
|
# This endpoint can be used to clear scheduled updates to the quantity for a fixed
|
1146
|
-
#
|
1156
|
+
# fee.
|
1147
1157
|
#
|
1148
|
-
#
|
1149
|
-
#
|
1158
|
+
# If there are no updates scheduled, a request validation error will be returned
|
1159
|
+
# with a 400 status code.
|
1150
1160
|
#
|
1151
1161
|
# @overload unschedule_fixed_fee_quantity_updates(subscription_id, price_id:, request_options: {})
|
1152
1162
|
#
|
@@ -1169,7 +1179,7 @@ module Orb
|
|
1169
1179
|
end
|
1170
1180
|
|
1171
1181
|
# This endpoint can be used to unschedule any pending plan changes on an existing
|
1172
|
-
#
|
1182
|
+
# subscription.
|
1173
1183
|
#
|
1174
1184
|
# @overload unschedule_pending_plan_changes(subscription_id, request_options: {})
|
1175
1185
|
#
|
@@ -1190,18 +1200,18 @@ module Orb
|
|
1190
1200
|
|
1191
1201
|
# This endpoint can be used to update the quantity for a fixed fee.
|
1192
1202
|
#
|
1193
|
-
#
|
1194
|
-
#
|
1195
|
-
#
|
1196
|
-
#
|
1197
|
-
#
|
1203
|
+
# To be eligible, the subscription must currently be active and the price
|
1204
|
+
# specified must be a fixed fee (not usage-based). This operation will immediately
|
1205
|
+
# update the quantity for the fee, or if a `effective_date` is passed in, will
|
1206
|
+
# update the quantity on the requested date at midnight in the customer's
|
1207
|
+
# timezone.
|
1198
1208
|
#
|
1199
|
-
#
|
1200
|
-
#
|
1201
|
-
#
|
1209
|
+
# In order to change the fixed fee quantity as of the next draft invoice for this
|
1210
|
+
# subscription, pass `change_option=upcoming_invoice` without an `effective_date`
|
1211
|
+
# specified.
|
1202
1212
|
#
|
1203
|
-
#
|
1204
|
-
#
|
1213
|
+
# If the fee is an in-advance fixed fee, it will also issue an immediate invoice
|
1214
|
+
# for the difference for the remainder of the billing period.
|
1205
1215
|
#
|
1206
1216
|
# @overload update_fixed_fee_quantity(subscription_id, price_id:, quantity:, allow_invoice_credit_or_void: nil, change_option: nil, effective_date: nil, request_options: {})
|
1207
1217
|
#
|
@@ -1228,23 +1238,23 @@ module Orb
|
|
1228
1238
|
end
|
1229
1239
|
|
1230
1240
|
# This endpoint is used to update the trial end date for a subscription. The new
|
1231
|
-
#
|
1232
|
-
#
|
1233
|
-
#
|
1234
|
-
#
|
1235
|
-
#
|
1236
|
-
#
|
1237
|
-
#
|
1238
|
-
#
|
1239
|
-
#
|
1240
|
-
#
|
1241
|
-
#
|
1242
|
-
#
|
1243
|
-
#
|
1244
|
-
#
|
1245
|
-
#
|
1246
|
-
#
|
1247
|
-
#
|
1241
|
+
# trial end date must be within the time range of the current plan (i.e. the new
|
1242
|
+
# trial end date must be on or after the subscription's start date on the current
|
1243
|
+
# plan, and on or before the subscription end date).
|
1244
|
+
#
|
1245
|
+
# In order to retroactively remove a trial completely, the end date can be set to
|
1246
|
+
# the transition date of the subscription to this plan (or, if this is the first
|
1247
|
+
# plan for this subscription, the subscription's start date). In order to end a
|
1248
|
+
# trial immediately, the keyword `immediate` can be provided as the trial end
|
1249
|
+
# date.
|
1250
|
+
#
|
1251
|
+
# By default, Orb will shift only the trial end date (and price intervals that
|
1252
|
+
# start or end on the previous trial end date), and leave all other future price
|
1253
|
+
# intervals untouched. If the `shift` parameter is set to `true`, Orb will shift
|
1254
|
+
# all subsequent price and adjustment intervals by the same amount as the trial
|
1255
|
+
# end date shift (so, e.g., if a plan change is scheduled or an add-on price was
|
1256
|
+
# added, that change will be pushed back by the same amount of time the trial is
|
1257
|
+
# extended).
|
1248
1258
|
#
|
1249
1259
|
# @overload update_trial(subscription_id, trial_end_date:, shift: nil, request_options: {})
|
1250
1260
|
#
|