https://github.com/emekadefirst/pypstk
The essence of this repo is to help python developer integrate paystack into their python code(especially APIs) seamlessly. Originally Paystack only provide samples for PHP and Node Js which is kinda is anot appealing to python devlopers.
https://github.com/emekadefirst/pypstk
payment paystack python-apps subscription verify
Last synced: 5 days ago
JSON representation
The essence of this repo is to help python developer integrate paystack into their python code(especially APIs) seamlessly. Originally Paystack only provide samples for PHP and Node Js which is kinda is anot appealing to python devlopers.
- Host: GitHub
- URL: https://github.com/emekadefirst/pypstk
- Owner: emekadefirst
- License: mit
- Created: 2024-02-26T07:11:18.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-26T15:15:45.000Z (almost 2 years ago)
- Last Synced: 2026-01-14T09:29:31.870Z (2 months ago)
- Topics: payment, paystack, python-apps, subscription, verify
- Language: Python
- Homepage: https://pypi.org/project/pypstk/
- Size: 49.8 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pystack
This Python package provides a set of classes to interact with the Paystack API for handling transactions, customers, subscriptions, and webhooks.
## Installation
To use this package, you need to have Python installed. You can install the package using pip:
```
pip install pypstk
```
## Usage
### 1. Payment
```python
from pypstk.payment import Payment
email = "customer@email.com"
amount = "20000"
secret_key = "your secret_key from api"
new_payment = Payment(email, amount, secret_key)
transaction_data = new_payment.initialize_transaction()
print(transaction_data)
# Sample output:
# {'references': '8pr6trcjj5', 'url': 'https://checkout.paystack.com/j62hay03a7dj6iu'}
```
### 3. Subscription
```python
from pypstk.subscription import Subscription
# Initialize subscription payment
name = "Monthly Retainer"
interval = "monthly"
amount = 500000
secret_key = "sk_test_daf386e7071c4613e54e4b71f43926409abd811e"
pay_subscription = Subscription(name, interval, amount, secret_key)
pay_subscription.initialize_payment()
pay_subscription.payment_status()
```
### 4. Payment Status
```python
from pypstk.status import Verify
# Check webhook status
reference = "YOUR_REFERENCE"
secret_key = "YOUR_SECRET_KEY"
hook = Hook(reference, secret_key)
status = hook.status()
print(status)
```
## Contributors
- [Emekadefirst](https://github.com/emekadefirst)
- I used [Olabode](https://github.com/Olabode-cmd) template to test this in an api
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.