pystack-sdk


Namepystack-sdk JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/grayoj/pystack
SummaryA Python API wrapper designed to streamline Paystack integrations within Python projects.
upload_time2023-08-03 14:38:38
maintainer
docs_urlNone
authorGerald Maduabuchi
requires_python>=3.6
license
keywords paystack payment integration api wrapper python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pystack.

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.

## Features

- Initiate and verify payments with Paystack.
- Resolve card BIN to get card details.
- Resolve account number to get account details.
- Simplify recurring charges and subscriptions with Paystack.

## Getting Started

The package is available on PyPi. In any project, run: `pip3 install pystack.`

## Usage

- The first thing to do is to install the `PystackClient.`

```python
from pystack import PystackClient
```

- Obtain your key from Paystack. You could get your key by following these instructions: [Paystack Docs](https://paystack.com/)
- Using the pystack client, create an object with your key.

```python
# Create a PaystackClient object
paystack_client = PystackClient(pystack_key=YOUR_KEY)
```

- You're set to go.

## Making Payments

Below is an example of how the pystack module helps you skip the shenanigans and focus on the payments.

```python

from pystack import PystackClient

# Replace 'YOUR_KEY' with your actual Paystack secret key.
YOUR_KEY = 'YOUR_KEY'

# Create a PaystackClient object
pystack = PystackClient(pystack_key=YOUR_KEY)

# Now we initiate a payment
amount = 5000  # The amount to send in the request
email = 'pystack@pystack.com'  # The customer's email address
payment_response = pystack.initiatePayment(amount=amount, email=email)
```

Look how much boilerplate code you saved above.

## Verifying Transactions

You can also verify transactions through though the pystack module. Here is an example:

```python
from pystack import PystackClient

# Replace 'YOUR_KEY' with your actual Paystack secret key.
YOUR_KEY = 'YOUR_KEY'

# Create a PaystackClient object
pystack = PystackClient(pystack=YOUR_KEY)

# Now we initiate a payment
amount = 5000  # The amount to send in the request
email = 'pystack@pystack.com'  # The customer's email address
payment_response = pystack.initiatePayment(amount=amount, email=email)

# Condition to verify the payment
if payment_response['status']:
    transaction_reference = payment_response['data']['reference']
    verification_response = pystack.verifyPayment(reference=transaction_reference)

    if verification_response['status']:
        print("Payment was successful.")
    else:
        print("Payment verification failed.")
else:
    print("Payment initiation failed.")
```

Like 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.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/grayoj/pystack",
    "name": "pystack-sdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "paystack payment integration api wrapper python",
    "author": "Gerald Maduabuchi",
    "author_email": "Mgeraldoj07@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/42/e6/9b2ee9a55c28d6d514ad85c0e2b38dc062c43e7d196a9bfcf3da906cefd6/pystack-sdk-0.1.0.tar.gz",
    "platform": null,
    "description": "# pystack.\n\nA 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\nThe package is available on PyPi. 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",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python API wrapper designed to streamline Paystack integrations within Python projects.",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/grayoj/pystack/issues",
        "Homepage": "https://github.com/grayoj/pystack",
        "Source Code": "https://github.com/grayoj/pystack"
    },
    "split_keywords": [
        "paystack",
        "payment",
        "integration",
        "api",
        "wrapper",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90b8b81a0ebb089a68443aad0a3ea71c3802cbcbb79cd3cc3002bcd5fa786e46",
                "md5": "8fd3cd04f6f48f147ae033bef37f084e",
                "sha256": "0080c74b25bf353bf689ceda4545721c4e6dc9cc4e514d2896445b201e156eb8"
            },
            "downloads": -1,
            "filename": "pystack_sdk-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8fd3cd04f6f48f147ae033bef37f084e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 3190,
            "upload_time": "2023-08-03T14:38:36",
            "upload_time_iso_8601": "2023-08-03T14:38:36.805286Z",
            "url": "https://files.pythonhosted.org/packages/90/b8/b81a0ebb089a68443aad0a3ea71c3802cbcbb79cd3cc3002bcd5fa786e46/pystack_sdk-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42e69b2ee9a55c28d6d514ad85c0e2b38dc062c43e7d196a9bfcf3da906cefd6",
                "md5": "4118fe95605ecac9c8b2fdbc07043fdf",
                "sha256": "30a919200ec82286b2348fe39d84d4a3e3e7bc0d78d413c7acf5c2aa20e7d0ae"
            },
            "downloads": -1,
            "filename": "pystack-sdk-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4118fe95605ecac9c8b2fdbc07043fdf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3457,
            "upload_time": "2023-08-03T14:38:38",
            "upload_time_iso_8601": "2023-08-03T14:38:38.771056Z",
            "url": "https://files.pythonhosted.org/packages/42/e6/9b2ee9a55c28d6d514ad85c0e2b38dc062c43e7d196a9bfcf3da906cefd6/pystack-sdk-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-03 14:38:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "grayoj",
    "github_project": "pystack",
    "github_not_found": true,
    "lcname": "pystack-sdk"
}
        
Elapsed time: 0.10977s