{ "info": { "author": "Joseph Schilz", "author_email": "joseph@schilz.org", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries" ], "description": ".. image:: https://travis-ci.org/JASchilz/pystrike.svg?branch=master\n :target: https://travis-ci.org/JASchilz/pystrike\n.. image:: https://api.codeclimate.com/v1/badges/3b5d31b0331c41501416/maintainability\n :target: https://codeclimate.com/github/JASchilz/pystrike/maintainability\n :alt: Maintainability\n.. image:: https://img.shields.io/pypi/v/pystrike.svg\n :target: https://pypi.org/project/pystrike/\n :alt: PyPI\n.. image:: https://readthedocs.org/projects/pystrike/badge/?version=latest\n :target: https://pystrike.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n\npystrike\n========\n\nPython wrapper for `Acinq\u00e2\u20ac\u2122s Strike lightning network payment service`_.\n\nThe lightning network allows near-fee, near-instant transactions atop the Bitcoin chain layer. Acinq operates the Strike service, which allows you to create lightning invoices, receive lightning payments into your Strike account, and then receive consolidated payouts on-chain. This Python library allows you to invoice customers and check the payment-status of those invoices in just a few lines of code.\n\nThis library does not require any third-party dependencies.\n\nExample\n-------\n\nInitialize the ``Charge`` class:\n\n::\n\n from pystrike.charge import make_charge_class\n\n Charge = make_charge_class(\n api_key=\"YOURSTRIKETESTNETAPIKEY\",\n api_host=\"api.dev.strike.acinq.co\",\n api_base=\"/api/v1/\",\n )\n\nCreate a new ``charge``:\n\n::\n\n charge = Charge(\n currency=Charge.CURRENCY_BTC,\n amount=4200, # Amount in Satoshi\n description=\"services rendered\",\n )\n\nRetrieve a payment request:\n\n::\n\n payment_request = charge.payment_request\n\n # Now `payment_request` might be something like \"lnbtb420u1pfoobarbaz...\"\n \nAt this point, you would present the ``payment_request`` to your\ncustomer. You can call ``charge.update()`` to poll the Strike server\nfor the current status of the charge, and then retrieve whether or not\nthe charge has been paid from the ``charge.paid`` attribute.\n\nFor example, suppose that ``charge.payment_request`` has not yet been paid and then we run the following code:\n\n::\n\n charge.update() # Reaches out the the Acinq server to retrieve the\n # status of the charge\n\n paid = charge.paid\n # Because the payment request has not yet been paid, charge.paid is False\n\nThen suppose that the client pays the ``charge.payment_request`` and then we run the following code:\n\n::\n\n charge.update()\n paid = charge.paid\n # Because the client paid the request before we called `update`, charge.paid\n # evaluates to True.\n\nAcinq's Strike service also offers a web hook/callback service, which is a better way to update your charges than frequent polling if you are running a web service.\n\nThe example above uses Strike's testnet web service at ``api.dev.strike.acinq.co``. When you're ready to issue mainnet lightning invoices, you'll need to use your Strike mainnet API key and make your requests to host ``api.strike.acinq.co``.\n\nUse\n---\n\nInstall pystrike\n^^^^^^^^^^^^^^^^\n\n::\n\n $ pip install pystrike\n\nCreating an API Key\n^^^^^^^^^^^^^^^^^^^\n\nBegin by creating an account on `Acinq\u00e2\u20ac\u2122s Strike lightning network payment service`_. Note that there is also a `testnet version of the service`_ that you may wish to use for your initial development. The two versions of this service are distinct, with separate accounts, separate API keys, and separate API hosts.\n\nOnce you have created an account and logged into the dashboard, you can retrieve an API key from your dashboard settings. You will need this key to configure your connection to Strike.\n\nConfiguring a Charge Class\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou'll begin by creating a Charge class from the provided ``make_charge_class`` function.\n \n::\n\n from pystrike.charge import make_charge_class\n\n Charge = make_charge_class(\n api_key=\"YOURSTRIKETESTNETAPIKEY\",\n api_host=\"api.dev.strike.acinq.co\",\n api_base=\"/api/v1/\",\n )\n\nThe host will probably be one of:\n\n - api.strike.acinq.co: the mainnet version of Strike\n - api.dev.strike.acinq.co: the testnet version of Strike\n\nIf you're pointing your charge class to the mainnet version then be sure to use the API key from your mainnet Strike dashboard.\n\nCreating a Charge\n^^^^^^^^^^^^^^^^^\n\nYou can create a new charge with the following code:\n\n::\n\n charge = Charge(\n currency=Charge.CURRENCY_BTC,\n amount=4200, # Amount in Satoshi\n description=\"services rendered\",\n )\n\nThis initialization will automatically reach out to the Strike web service and create a new charge on their servers. Once this call has returned, you can immediately access the details of that charge through ``charge.id``, ``charge.payment_request``, and so on.\n\nAt this point, you might present the ``charge.payment_request`` to your customer for payment.\n\nRetrieving a Charge\n^^^^^^^^^^^^^^^^^^^\n\nRather than creating a new charge, if you know the Strike id of an existing charge you can retrieve it with the following code:\n\n::\n\n charge = Charge.from_charge_id('ch_LWafoobarbazjFFv8eurFJkerhgDA')\n\nUpdating a Charge\n^^^^^^^^^^^^^^^^^\n\nYou can poll the Strike server to update your local charge object:\n\n::\n\n charge.update()\n\nThis command reaches out to the Strike server and updates the attributes of the charge. For example, if you are waiting on payment for a charge, you might run ``charge.update()`` to retrieve the status of the charge from the Strike server and then access ``charge.paid`` to see if a payment has been recorded for the charge on the Strike server.\n\nIf you're developing a web application, you could use web hooks instead of polling the server. See Strike's documentation on web hooks for more information.\n\nTesting\n-------\n\nRunning the library tests requires two environment variables:\n\n - ``STRIKE_TESTNET_API_KEY``: Your API key for the ``api.dev.strike.acinq.co``\n web service.\n - ``RETRIEVE_CHARGE_ID``: The Strike id of a charge in your\n ``api.dev.strike.acinq.co``. For example: ``ch_LWafoobarbazjFFv8eufoobarbaz``\n\n.. _Acinq\u00e2\u20ac\u2122s Strike lightning network payment service: https://strike.acinq.co\n.. _testnet version of the service: https://dev.strike.acinq.co", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/JASchilz/pystrike", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pystrike", "package_url": "https://pypi.org/project/pystrike/", "platform": "", "project_url": "https://pypi.org/project/pystrike/", "project_urls": { "Homepage": "https://github.com/JASchilz/pystrike" }, "release_url": "https://pypi.org/project/pystrike/0.5.3/", "requires_dist": null, "requires_python": "", "summary": "Python library for interacting with Acinq's Strike lightning network payment web service.", "version": "0.5.3" }, "last_serial": 4544495, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "63149a7cc8da80acf11ec5c48670725d", "sha256": "c384550422ddc17d99794f981f882ecf12707fb440587b9171822113c703ad9c" }, "downloads": -1, "filename": "pystrike-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "63149a7cc8da80acf11ec5c48670725d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4409, "upload_time": "2018-09-13T21:56:25", "url": "https://files.pythonhosted.org/packages/90/61/8623f78afce79d94c0d3cd2c6deb25a536b2d675c57709ff2b8a7d374a44/pystrike-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4fb3f06ad4b067c5cb845dd7cbc705ce", "sha256": "5f55f436ffc0e8431ed873d0576548278a1644b80a16785887f159b5f0ee0489" }, "downloads": -1, "filename": "pystrike-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4fb3f06ad4b067c5cb845dd7cbc705ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3951, "upload_time": "2018-09-13T21:56:27", "url": "https://files.pythonhosted.org/packages/3b/92/41225f91d17d866992b2eb4312fcd8e2c1b43747a6b325b3fe11d9279d5c/pystrike-0.0.1.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "076caeb595d28470cf6cd608ad783db8", "sha256": "8c02ea867be2569208787c32d52782cf5483927a21e1774852c906ea10c983ae" }, "downloads": -1, "filename": "pystrike-0.5.1-py3-none-any.whl", "has_sig": false, "md5_digest": "076caeb595d28470cf6cd608ad783db8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7283, "upload_time": "2018-09-17T09:11:06", "url": "https://files.pythonhosted.org/packages/c4/bc/3a21e27d9d06664d46da73aceddec54c8c6b125a4dc45fc6f8af041cc7f9/pystrike-0.5.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9a8bb6c45839d13a209762049eb0ce6", "sha256": "c057cdd360623f3fbf3f12f27f0019810b897cd1b8366e4a9084bddcab92cd14" }, "downloads": -1, "filename": "pystrike-0.5.1.tar.gz", "has_sig": false, "md5_digest": "a9a8bb6c45839d13a209762049eb0ce6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6372, "upload_time": "2018-09-17T09:11:08", "url": "https://files.pythonhosted.org/packages/0d/62/e031ce85bafe1b08aa0f7e49dcafb6ef6d2249b34fafc3d11774fff42e30/pystrike-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "901365d9193f2e495ea6ca9fa381fd69", "sha256": "9e221cfc9915f1d40c4d21715abf2dec58091b326572c99fd30b2a132edb3172" }, "downloads": -1, "filename": "pystrike-0.5.2-py3-none-any.whl", "has_sig": false, "md5_digest": "901365d9193f2e495ea6ca9fa381fd69", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7751, "upload_time": "2018-09-17T21:31:52", "url": "https://files.pythonhosted.org/packages/c8/ba/e563cef2af697fb7939789f0488a569bf36c524382e81a5b72c8788ef807/pystrike-0.5.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "883fbb19cbd35d950ed389807bca0572", "sha256": "e80f28d5aed880d71d9d9f8c0fa394151fc1d1bb0517a4a81e4ea92299491b69" }, "downloads": -1, "filename": "pystrike-0.5.2.tar.gz", "has_sig": false, "md5_digest": "883fbb19cbd35d950ed389807bca0572", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6906, "upload_time": "2018-09-17T21:31:55", "url": "https://files.pythonhosted.org/packages/0b/08/6bc21019ce48c56077502054f5d69f7f1807529fcca2c1a5a41fac937377/pystrike-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "ffa6098c17be796a4bf4ef4f9fea14f4", "sha256": "0b7588089caa1e276b78a98af379573cca7680cfa68f6b599b36559ce8d2fe20" }, "downloads": -1, "filename": "pystrike-0.5.3.tar.gz", "has_sig": false, "md5_digest": "ffa6098c17be796a4bf4ef4f9fea14f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7227, "upload_time": "2018-11-29T21:31:18", "url": "https://files.pythonhosted.org/packages/16/86/59f82d0be8a20facd002886b4021b58d3b44bd1c3980b8f0bf167ad3fe3e/pystrike-0.5.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ffa6098c17be796a4bf4ef4f9fea14f4", "sha256": "0b7588089caa1e276b78a98af379573cca7680cfa68f6b599b36559ce8d2fe20" }, "downloads": -1, "filename": "pystrike-0.5.3.tar.gz", "has_sig": false, "md5_digest": "ffa6098c17be796a4bf4ef4f9fea14f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7227, "upload_time": "2018-11-29T21:31:18", "url": "https://files.pythonhosted.org/packages/16/86/59f82d0be8a20facd002886b4021b58d3b44bd1c3980b8f0bf167ad3fe3e/pystrike-0.5.3.tar.gz" } ] }