{"id":41219152,"url":"https://github.com/adrum/localstripe","last_synced_at":"2026-01-23T00:11:35.404Z","repository":{"id":310759297,"uuid":"1040440892","full_name":"adrum/localstripe","owner":"adrum","description":"A fake but stateful Stripe server that you can run locally, for testing purposes.","archived":false,"fork":false,"pushed_at":"2026-01-02T04:09:17.000Z","size":892,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-07T07:21:27.925Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"adrienverge/localstripe","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrum.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-19T01:42:10.000Z","updated_at":"2026-01-02T04:09:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/adrum/localstripe","commit_stats":null,"previous_names":["adrum/localstripe"],"tags_count":81,"template":false,"template_full_name":null,"purl":"pkg:github/adrum/localstripe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrum%2Flocalstripe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrum%2Flocalstripe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrum%2Flocalstripe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrum%2Flocalstripe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrum","download_url":"https://codeload.github.com/adrum/localstripe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrum%2Flocalstripe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28675542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T00:11:34.895Z","updated_at":"2026-01-23T00:11:35.396Z","avatar_url":"https://github.com/adrum.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"localstripe\n===========\n\nThis project is a derivative of https://github.com/adrienverge/localstripe\n\n\n*A fake but stateful Stripe server that you can run locally, for testing\npurposes.*\n\nThis is a program that you can launch to simulate a Stripe server locally,\nwithout touching real Stripe servers nor the Internet.\n\nUnlike other test/mock software like `stripe-mock\n\u003chttps://github.com/stripe/stripe-mock\u003e`_, localstripe is *stateful*: it keeps\ntrack of the actions performed (creating a customer, adding a card, etc.) so\nthat these actions have an impact on the next queries.\n\nThe goal is to have a ready-to-use mock server for end-to-end testing any\napplication.\n\nFeatures\n--------\n\n- **works with any language**: localstripe is not a library that you include,\n  but a real server that you can query at ``http://localhost:8420``, using\n  regular Stripe API requests\n- **stateful**: if you create a Stripe object (let's say, a customer), you will\n  get it back on future requests\n- **integrates with Stripe Elements**: localstripe includes a JavaScript file\n  that can mock Stripe Elements on any webpage, allowing you to create tokens\n  on the fake server, from your webpage\n- **supports webhooks** that you can customize using a special API route\n- **has a UI** to manage the state of the server\n\nLimitations\n-----------\n\n- only the **latest version of Stripe API** is supported (on best effort)\n- deprecated properties and features may or may not be supported\n- **no Stripe Connect support**: localstripe currently only supports Stripe\n  Payments, and does not support Stripe Connect\n\nGet started\n-----------\n\nLaunch a container using `the Docker image\n\u003chttps://github.com/adrum/localstripe/pkgs/container/localstripe\u003e`_:\n\n.. code:: yaml\n\n    services:\n      localstripe:\n        image: ghcr.io/adrum/localstripe:latest\n        ports:\n          - 8420:8420\n        restart: always\n        volumes:\n          - ./data:/data\n\n\nExamples\n--------\n\nIn the following example, let's create a ``Plan``, a ``Customer``, and\nsubscribe the latter to the former:\n\n.. code:: shell\n\n curl localhost:8420/v1/plans -u sk_test_12345: \\\n      -d id=pro-plan \\\n      -d amount=2500 \\\n      -d currency=eur \\\n      -d interval=month \\\n      -d name=\"Plan for professionals\"\n\n.. code:: shell\n\n {\n   \"amount\": 2500,\n   \"created\": 1504187388,\n   \"currency\": \"eur\",\n   \"id\": \"pro-plan\",\n   \"interval\": \"month\",\n   \"interval_count\": 1,\n   \"livemode\": false,\n   \"metadata\": {},\n   \"name\": \"Plan for professionals\",\n   \"object\": \"plan\",\n   \"statement_descriptor\": null,\n   \"trial_period_days\": null\n }\n\n.. code:: shell\n\n curl localhost:8420/v1/customers -u sk_test_12345: \\\n      -d description=\"Customer for david.anderson@example.com\"\n\n.. code:: shell\n\n {\n   \"id\": \"cus_b3IecP7GlNCPMM\",\n   \"description\": \"Customer for david.anderson@example.com\",\n   \"account_balance\": 0,\n   \"currency\": \"eur\",\n   \"default_source\": null,\n   ...\n }\n\n.. code:: shell\n\n curl localhost:8420/v1/subscriptions -u sk_test_12345: \\\n      -d customer=cus_b3IecP7GlNCPMM \\\n      -d items[0][plan]=pro-plan\n\n.. code:: shell\n\n {\n   \"id\": \"sub_UJIdAleo3FnwG7\",\n   \"customer\": \"cus_b3IecP7GlNCPMM\",\n   \"current_period_end\": 1506779564,\n   \"current_period_start\": 1504187564,\n   \"items\": {\n   ...\n }\n\nNow if you retrieve that customer again, it has an associated subscription:\n\n.. code:: shell\n\n curl localhost:8420/v1/customers/cus_b3IecP7GlNCPMM -u sk_test_12345:\n\n.. code:: shell\n\n {\n   \"id\": \"cus_b3IecP7GlNCPMM\",\n   \"description\": \"Customer for david.anderson@example.com\",\n   ...\n   \"subscriptions\": {\n     \"data\": [\n       {\n         \"id\": \"sub_UJIdAleo3FnwG7\",\n         \"items\": {\n           \"data\": [\n             {\n               \"id\": \"si_2y5q9Q6lvAB9cr\",\n               \"plan\": {\n                 \"id\": \"pro-plan\",\n                 \"name\": \"Plan for professionals\",\n                 \"amount\": 2500,\n                 \"currency\": \"eur\",\n                 \"interval\": \"month\",\n   ...\n }\n\nIntegrate with your back-end\n----------------------------\n\nFor instance in a Python application, you only need to set ``stripe.api_base``\nto ``http://localhost:8420``:\n\n.. code:: python\n\n import stripe\n\n stripe.api_key = 'sk_test_12345'\n stripe.api_base = 'http://localhost:8420'\n\nIntegrate with Stripe Elements\n------------------------------\n\nIf your application takes card numbers on a web page using Stripe Elements, you\nmay want tokens to be sent to the mock server instead of the real Stripe\nserver.\n\nTo achieve this, you need to load the\n``http://localhost:8420/js.stripe.com/v3/`` script into your page. It will\noverwrite the global ``Stripe`` object, so new elements and card forms will\nactually send data to the ``http://localhost:8420/v1/tokens`` API.\n\nFor example if you use a testing tool like Protractor, you need to inject this\nJavaScript source in the web page before it creates card elements:\n\n.. code:: html\n\n \u003cscript src=\"http://localhost:8420/js.stripe.com/v3/\"\u003e\u003c/script\u003e\n\nUse webhooks\n------------\n\nRegister a webhook using the special ``/_config`` route:\n\n.. code:: shell\n\n curl localhost:8420/_config/webhooks/mywebhook1 \\\n      -d url=http://localhost:8888/api/url -d secret=whsec_s3cr3t\n\nThen, localstripe will send webhooks to this url, signed using ``secret``. The\n``events`` option can be used to filter events to be sent.\nOnly those events types are currently supported:\n\n- Product: ``product.created``\n- Plan: ``plan.created``\n- Customer: ``customer.created``, ``customer.updated`` and ``customer.deleted``\n- Source: ``customer.source.created``\n- Subscription: ``customer.subscription.created`` and\n  ``customer.subscription.deleted``\n- Invoice: ``invoice.created``, ``invoice.payment_succeeded`` and\n  ``invoice.payment_failed``\n\nFlush stored data\n-----------------\n\nFlushing data programmatically can be useful to reset localstripe if your are\nusing it with any test framework.\n\nFlushing stored data can be performed using the ``/_config/data`` route\nwith DELETE http method:\n\n.. code:: shell\n\n curl -X DELETE localhost:8420/_config/data\n\nHacking and contributing\n------------------------\n\nTo quickly run localstripe from source, and reload when a file changed:\n\n.. code:: shell\n\n find -name '*.py' | entr -r python -m localstripe --from-scratch\n\nTo quickly build and run localstripe from source:\n\n.. code:: shell\n\n python -m build\n pip install --user --upgrade dist/localstripe-*.tar.gz\n localstripe\n\nIf you plan to open a pull request to improve localstripe, that is so cool! To\nmake reviews smooth you should follow `our contributing guidelines\n\u003cCONTRIBUTING.rst\u003e`_.\n\nLicense\n-------\n\nThis program is licensed under the GNU General Public License version 3.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrum%2Flocalstripe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrum%2Flocalstripe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrum%2Flocalstripe/lists"}