Skip to main content

Asynchronous PayStack library

Project description

aiopaystack

Asynchronous Python library for Paystack

GitHub PyPI PyPI - Python Version GitHub issues GitHub Workflow Status (branch)

Installation

pip install aiopaystack

Usage

Add your paystack secret key as an environment variable as PAY_STACK_SECRET_KEY

from paystack import Transactions

trans = Transactions()

# All parameters must be passed in as keywords. For both required and optional arguments.
res = await trans.initialize(email="sam@gmail.com", amount='5000')

# Passing secret key as an argument
# This replaces any key set in the environment
from paystack import Paystack
paystack = Paystack(secret_key="paystack_secret_key")

# to use one session for multiple request use the class as a context manager
async with Transactions() as trans:
    res= await trans.verify(reference="ref")
    
# The response type for every request is a typed dict.
from typing import TypedDict, Any
Response = TypedDict('Response', {'status_code': int, 'status': bool, 'message': str, 'data': dict | Any})

# Sample response
{'status': True,
 'message': 'Authorization URL created',
 'data': 
     {'authorization_url': 'https://checkout.paystack.com/3521i62zf1i0ljl',
      'access_code': '3521i62zf1i0ljl', 'reference': '2q16btxglw'
      },
 'status_code': 200
 }
## DOC Reference: <https://developers.paystack.co/v2.0/reference>
### Static Use

Don't forget to get your API key from Paystack and assign to the variable PAYSTACK_SECRET_KEY Please reference the docs folder for usage,

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiopaystack-2.0.0.tar.gz (21.2 kB view hashes)

Uploaded Source

Built Distribution

aiopaystack-2.0.0-py3-none-any.whl (29.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page