Time Machine is a simulation feature which imitates the key characteristics, behaviours and functions of the billing configurations. It is a virtual time travelling tool which facilitates the integration testing process by carrying out subscription renewals, dunning, webhooks etc on a hypothetical time frame.
You can use Time Machine in the test site to verify if the billing rules configured in your site adhere to your expectations before executing them in real time. This feature can be used in both API and UI versions.
Note: In order to use Time Machine via API , you need to first "enable" the Time Travel option which is available under Settings > Configure Chargebee > Time Machine.
enumerated string, default=not_enabled The current status of time travel
Possible values are
not_enabledTime travel has not been enabled for the sitein_progressTime travel is in progresssucceededTime travel has succeeded.failedTime travel has failed. Check the failure code and failure reason attributes for further details. Note: The time machine needs to be reset by starting afresh again.
Restart the time machine. This will clear the "customer" data like customer details, subscriptions, invoices, transactions. Also a time travel is initiated to travel back to specified genesis time.
Note: This API call is asynchronous. You need to check if the "start afresh" operation has completed by checking if the time travel status is successful by retrieving the time machine in a loop with a minimum delay of 3 secs between two retrieve requests. In case you are using any of the client libraries, use the wait for time travel completion function provided as a instance method in the library. Use method waitForTimeTravelCompletion() on the returned time_machine resource which will block until the time travel completes. Use method waitForTimeTravelCompletion() on the returned time_machine resource which will block until the time travel completes. Use method wait_for_time_travel_completion on the returned time_machine resource which will block until the time travel completes. Use method wait_for_time_travel_completion on the returned time_machine resource which will block until the time travel completes. Use method WaitForTimeTravelCompletion on the returned time_machine resource which will block until the time travel completes. Use method wait_for_time_travel_completion on the returned time_machine resource which will block until the time travel completes. Use method waitForTimeTravelCompletion on the returned time_machine resource which will block until the time travel completes. Use method wait_for_time_travel_completion on the returned time_machine resource which will block until the time travel completes.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Notes
Sample Request
curl https://{site}.chargebee.com/api/v2/time_machines/delorean/start_afresh \
-X POST \
-u {site_api_key}:
optional, timestamp(UTC) in seconds The genesis time to travel back as part of the reset operation. If not provided, then the travel is set to 6 months in the past.
Note: Can only be in the past.
Travel forward in time. This operation is asynchronous. You need to check if the "start afresh" operation has completed by checking if the time travel status is successful by retrieving the time machine in a loop with a minimum delay of 3 secs between two retrieve requests. Use method waitForTimeTravelCompletion() on the returned time_machine resource which will block until the time travel completes.
This API is not enabled for live sites by default. Please contact
support to get this enabled.