{"id":27204910,"url":"https://github.com/grayoj/pystack","last_synced_at":"2025-04-09T23:00:03.087Z","repository":{"id":185870542,"uuid":"674221773","full_name":"grayoj/pystack","owner":"grayoj","description":"A Python API wrapper designed to streamline Paystack integrations within Python projects, (Django, Flask, etc)","archived":false,"fork":false,"pushed_at":"2023-10-19T09:15:04.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T22:59:58.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pystack-sdk/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grayoj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-03T12:20:42.000Z","updated_at":"2024-06-18T23:53:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"580e1493-976f-4371-9fb1-cc1f5c3596ab","html_url":"https://github.com/grayoj/pystack","commit_stats":null,"previous_names":["grayoj/pystack"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fpystack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fpystack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fpystack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayoj%2Fpystack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grayoj","download_url":"https://codeload.github.com/grayoj/pystack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125582,"owners_count":21051768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-09T23:00:02.525Z","updated_at":"2025-04-09T23:00:03.070Z","avatar_url":"https://github.com/grayoj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pystack.\n\n[Pystack](https://pypi.org/project/pystack-sdk/) is a Python API wrapper designed to streamline Paystack integrations within Python projects, (Django, Flask, etc) Paystack does not natively provide an sdk or wrapper client for Python. I was working on a project once and I found myself writing boilerplate code rather than focusing on integrating payments into my service.\n\n## Features\n\n- Initiate and verify payments with Paystack.\n- Resolve card BIN to get card details.\n- Resolve account number to get account details.\n- Simplify recurring charges and subscriptions with Paystack.\n\n## Getting Started\n\n[The package is available on PyPi](https://pypi.org/project/pystack-sdk/). In any project, run: `pip3 install pystack.`\n\n## Usage\n\n- The first thing to do is to install the `PystackClient.`\n\n```python\nfrom pystack import PystackClient\n```\n\n- Obtain your key from Paystack. You could get your key by following these instructions: [Paystack Docs](https://paystack.com/)\n- Using the pystack client, create an object with your key.\n\n```python\n# Create a PaystackClient object\npaystack_client = PystackClient(pystack_key=YOUR_KEY)\n```\n\n- You're set to go.\n\n## Making Payments\n\nBelow is an example of how the pystack module helps you skip the shenanigans and focus on the payments.\n\n```python\n\nfrom pystack import PystackClient\n\n# Replace 'YOUR_KEY' with your actual Paystack secret key.\nYOUR_KEY = 'YOUR_KEY'\n\n# Create a PaystackClient object\npystack = PystackClient(pystack_key=YOUR_KEY)\n\n# Now we initiate a payment\namount = 5000  # The amount to send in the request\nemail = 'pystack@pystack.com'  # The customer's email address\npayment_response = pystack.initiatePayment(amount=amount, email=email)\n```\n\nLook how much boilerplate code you saved above.\n\n## Verifying Transactions\n\nYou can also verify transactions through though the pystack module. Here is an example:\n\n```python\nfrom pystack import PystackClient\n\n# Replace 'YOUR_KEY' with your actual Paystack secret key.\nYOUR_KEY = 'YOUR_KEY'\n\n# Create a PaystackClient object\npystack = PystackClient(pystack=YOUR_KEY)\n\n# Now we initiate a payment\namount = 5000  # The amount to send in the request\nemail = 'pystack@pystack.com'  # The customer's email address\npayment_response = pystack.initiatePayment(amount=amount, email=email)\n\n# Condition to verify the payment\nif payment_response['status']:\n    transaction_reference = payment_response['data']['reference']\n    verification_response = pystack.verifyPayment(reference=transaction_reference)\n\n    if verification_response['status']:\n        print(\"Payment was successful.\")\n    else:\n        print(\"Payment verification failed.\")\nelse:\n    print(\"Payment initiation failed.\")\n```\n\nLike wise there are other things you could do with Pystack, such as recurring charges, subscriptions, etc. It's up to you to decide what you want to do, and then use it.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayoj%2Fpystack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrayoj%2Fpystack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayoj%2Fpystack/lists"}