This Python package provides a set of classes to interact with the Paystack API for handling transactions, customers, subscriptions, and webhooks.
To use this package, you need to have Python installed. You can install the package using pip:
pip install pypstk
from pypstk.payment import Payment
email = "[email protected]"
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'}
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()
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)
- Emekadefirst
- I used Olabode template to test this in an api
This project is licensed under the MIT License - see the LICENSE file for details.