{"id":27788034,"url":"https://github.com/interledger/open-payments-python-sdk","last_synced_at":"2026-01-23T18:33:31.285Z","repository":{"id":272409227,"uuid":"914415171","full_name":"interledger/open-payments-python-sdk","owner":"interledger","description":"Python client for Open Payments API","archived":false,"fork":false,"pushed_at":"2025-10-02T06:18:09.000Z","size":128,"stargazers_count":0,"open_issues_count":8,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-02T08:28:36.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interledger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/code_of_conduct.md","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}},"created_at":"2025-01-09T14:54:39.000Z","updated_at":"2025-10-02T06:18:17.000Z","dependencies_parsed_at":"2025-01-14T09:19:44.572Z","dependency_job_id":"5bb11ea1-04d9-4133-86c4-193d18af4c74","html_url":"https://github.com/interledger/open-payments-python-sdk","commit_stats":null,"previous_names":["interledger/open-payments-python-sdk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/interledger/open-payments-python-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledger%2Fopen-payments-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledger%2Fopen-payments-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledger%2Fopen-payments-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledger%2Fopen-payments-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interledger","download_url":"https://codeload.github.com/interledger/open-payments-python-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledger%2Fopen-payments-python-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: 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":"2025-04-30T16:53:30.622Z","updated_at":"2026-01-23T18:33:31.276Z","avatar_url":"https://github.com/interledger.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Open Payments SDK\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/interledger/open-payments/main/docs/public/img/logo.svg\" width=\"700\" alt=\"Open Payments\"\u003e\n\u003c/p\u003e\n\n\u003e This project is still a work in progress\n\n## Open Payments\n\nOpen Payments is an open API standard that can be implemented by account servicing entities (e.g. banks, digital wallet providers, and mobile money providers) to facilitate interoperability in the setup and completion of payments for different use cases including:\n\n- Web Monetization\n- Tipping/Donations (low value/low friction)\n- eCommerce checkout\n- P2P transfers\n- Subscriptions\n- Invoice Payments\n\nAn Open Payments server runs two sub-systems, a resource server which exposes APIs for performing functions against the underlying accounts and authorization server which exposes APIs compliant with the GNAP standard for getting grants to access the resource server APIs.\n\n## Local development\n\n- Python \u003e= 3.11\n\n  To install python visit [Python Download](https://www.python.org/downloads/)\n\n- Poetry\n  To install poetry visit [Poetry Documentation](https://python-poetry.org/docs/).\n\n### Installation\n\n1. Activate your virtual environment. No need to create one, Poetry creates one.\n   Read [managing environments in Poetry](https://python-poetry.org/docs/managing-environments/).\n\n2. Install the dependencies in the poetry.lock\n\n```\n\u003e poetry install\n```\n\n## Usage\n\nTo use this SDK, you will first need to install it in your project. Currently, you will need to build from source but once it is hosted on PyPi you will be able to install it with `pip`.\n\n```bash\npython3 -m pip install open-payments-python-sdk #currently not setup\n```\n\n## Installing from source\n\nClone the repository\n\n```bash\ngit clone https://github.com/interledger/open-payments-python-sdk.git\ncd open-payments-python-sdk\n```\n\nBuild the package\n\n```bash\npoetry build\n```\n\nAfter running this command, the wheel package will be written to the `dist/` folder in the repo you just cloned\n\nInstall it in your project\n\n```bash\npip install \u003c/path/to/\u003eopen-payments-python-sdk/dist/open_payments_sdk-0.1.0-py3-none-any.whl\n```\n\n# Initialising the Client\n\nTo create a client you can do so by importing the `OpenPaymentsClient` defined in the [`client`](./src/client/client.py) module and instantiating it.\n\n```python\nfrom open_payments_sdk.client.client import OpenPaymentsClient\n\nwith open(\"privkey.pem\",\"r\",encoding=\"utf_8\") as privkey:\n    private_key = privkey.read()\n\nop_client = OpenPaymentsClient(keyid=\"27b4f8d2-746c-4522-b3f0-874ca15bfe65\",private_key=private_key)\n```\n\nThe client is to be created after you have created a key pair and have obtained the `kid` and `private_key`\n\nSome helper functions have been created to ease key pair creation. A class called `KeyManager` has been created and it provides functions to create a key pair and load a private key from UTF-8 string. It also returns an object that has information to be registered at the AS when registering the public key.\n\n```python\nimport json\nfrom open_payments_sdk.gnap_utils.keys import KeyManager\n\nkey_manager = KeyManager()\nkey_pair = key_manager.generate_key_pair() # generate key pair\n\nwith open(\"privkey.pem\", \"w\",encoding=\"utf_8\") as pem_file: # save private key to file\n    pem_file.write(key_pair.private_key_pem)\n\n\nwith open(\"jwks.json\",\"w\", encoding=\"utf_8\") as jwks_file: # save jwks.json file\n    jwks_file.write(json.dumps(key_pair.jwks.keys[0].__dict__))\n\n\nwith open(\"privkey.pem\", \"r\", encoding=\"utf_8\") as privkey: # load private key from file system\n    private_key = privkey.read()\n\nprivate_key = key_manager.load_ed25519_private_key_from_pem(\n    private_key\n) # load private key fron file utf_8 string\n\npublic_key = private_key.public_key() # derive public key from private key\n```\n\n## Wallets\n\nYou can use the created client to interact with the resource server. In this case we will use it to interact with a wallet address to get the wallet address details and jwks.json\n\n```python\n#get wallet address\nwallet_address_details = op_client.wallet.get_wallet_address(\"https://ilp.interledger-test.dev/elijahokellosalary\")\n\n# Response\n{'id': AnyUrl('https://ilp.interledger-test.dev/elijahokellosalary'), 'publicName': 'elijahokellosalary', 'assetCode': AssetCode(root='USD'), 'assetScale': AssetScale(root=2), 'authServer': AnyUrl('https://auth.interledger-test.dev/'), 'resourceServer': AnyUrl('https://ilp.interledger-test.dev/')}\n\n```\n\nGet Wallet jwks\n\n```python\n#get wallet jwks\nwallet_jwks = op_client.wallet.get_keys(\"https://ilp.interledger-test.dev/elijahokellosalary\")\n\n# Response\n{'keys': []}\n\n```\n\n## Grants\n\nYou can use the created client to request a grant from the authorization server. In this case we will use it to request a grant for an incoming payment resource. Check the [fixtures](./tests/conftest.py) file to see the request body.\n\n```python\nwallet = op_client.wallet.get_wallet_address(\"https://ilp.interledger-test.dev/5c327379\")\ngrant_response = op_client.grants.post_grant_request(grant_request=grant_req_dto,auth_server_endpoint=str(wallet.authServer))\n\n# Response\n{'access_token': {'access': [{'actions': ['create', 'read'], 'identifier': 'https://ilp.interledger-test.dev/5c327379', 'type': 'incoming-payment'}], 'value': '2E6F040D518B6F1A0883', 'manage': 'https://auth.interledger-test.dev/token/dad85db0-804d-4778-bf78-33eb5f81d86e', 'expires_in': 600}, 'continue': {'access_token': {'value': '3A088F83D39BDCDEC995'}, 'uri': 'https://auth.interledger-test.dev/continue/d2bb7a46-8cd9-4dde-83e2-821353b50579'}}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledger%2Fopen-payments-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterledger%2Fopen-payments-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledger%2Fopen-payments-python-sdk/lists"}