### Build and run localstripe from source Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Build the package, install it locally, and run the localstripe command. ```shell python -m build pip install --user --upgrade dist/localstripe-*.tar.gz localstripe ``` -------------------------------- ### Install localstripe globally with pip Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Install localstripe globally using sudo pip. After installation, run the 'localstripe' command to start the fake Stripe server on port 8420. ```shell sudo pip install localstripe ``` -------------------------------- ### Customer creation response Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Example JSON response returned after creating the customer. Shows the customer object with id, description, account_balance, currency, and default_source. ```shell { "id": "cus_b3IecP7GlNCPMM", "description": "Customer for david.anderson@example.com", "account_balance": 0, "currency": "eur", "default_source": null, ... } ``` -------------------------------- ### Plan creation response Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Example JSON response returned after creating the plan. Shows the plan object with fields such as amount, currency, id, interval, and livemode false. ```shell { "amount": 2500, "created": 1504187388, "currency": "eur", "id": "pro-plan", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "name": "Plan for professionals", "object": "plan", "statement_descriptor": null, "trial_period_days": null } ``` -------------------------------- ### Subscription creation response Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Example JSON response returned after creating the subscription. Shows the subscription object with id, customer, and current period timestamps. ```shell { "id": "sub_UJIdAleo3FnwG7", "customer": "cus_b3IecP7GlNCPMM", "current_period_end": 1506779564, "current_period_start": 1504187564, "items": { ... } ``` -------------------------------- ### Customer retrieval response with subscription Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Example JSON response returned after retrieving the customer, showing the associated subscription data. ```shell { "id": "cus_b3IecP7GlNCPMM", "description": "Customer for david.anderson@example.com", ... "subscriptions": { "data": [ { "id": "sub_UJIdAleo3FnwG7", "items": { "data": [ { "id": "si_2y5q9Q6lvAB9cr", "plan": { "id": "pro-plan", "name": "Plan for professionals", "amount": 2500, "currency": "eur", "interval": "month", ... } ``` -------------------------------- ### Install localstripe with pip Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Install localstripe using pip with the --user flag and upgrade option. This installs the package for the current user. ```shell pip install --user -U localstripe ``` -------------------------------- ### Run tests continuously with entr Source: https://github.com/adrienverge/localstripe/blob/master/CONTRIBUTING.rst Use this command to automatically run the test suite whenever a Python file changes. It requires the 'entr' utility and starts the localstripe server from scratch. ```shell find -name '*.py' | entr -r python -m localstripe --from-scratch curl -X DELETE localhost:8420/_config/data && ./test.sh ``` -------------------------------- ### Rebuild localstripe Docker image Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Rebuild the localstripe Docker image from a Dockerfile provided inline via heredoc. The Dockerfile uses Python 3, installs localstripe via pip, and sets the command to run localstripe. ```shell docker build --no-cache -t adrienverge/localstripe -< ``` -------------------------------- ### Flush stored data with curl Source: https://github.com/adrienverge/localstripe/blob/master/README.rst Flush all stored data using the /_config/data route with the DELETE HTTP method. Useful for resetting localstripe in test frameworks. ```shell curl -X DELETE localhost:8420/_config/data ```