Skip to main content

A Paystack API wrapper in Python

Project description

Installation / Usage

To install use pip:

$ pip install --upgrade paystack

or

$ easy_install --upgrade paystack

Info

on installing pip. If you are on a system with easy_install but not
pip, you can use easy_install instead. If you’re not using virtualenv,
you may have to prefix those commands with sudo. You can learn more
about virtualenv at http://www.virtualenv.org/

To install from source, clone this repo and run:

$ git clone https://github.com/ojengwa/paystack.git

$ python setup.py install

Documentation

Please see https://developers.paystack.co/docs for the most up-to-date documentation for the Paystack API.

API Anatomy

Please see https://ojengwa.github.io/paystack/ for the most up-to-date documentation of the API Anatomy.

Testing

The package is compatible with Python 2.6+, Python 3.1+ and PyPy. We need to test against all of these environments to ensure compatibility. Travis CI will automatically run our tests on push. For local testing, we use nose to handle testing across environments.

To run the included test:

  1. Clone the repo:

$ git clone https://github.com/ojengwa/paystack.git
  1. Enter project directory:

$ cd paystack
  1. Install dependencies using fabric:

$ fab install
  1. Run the includded test using fabric:

$ fab test

TODO

  1. Add Event hooks

  2. Create Consumer Resource

  3. Create Plan Resource

Example

from paystack.resource import TransactionResource

import random
import string

def main():
    rand = ''.join(
        [random.choice(
            string.ascii_letters + string.digits) for n in range(16)])
    secret_key = 'YOUR_SECRET_KEY'
    random_ref = rand
    test_email = 'TEST_EMAIL'
    test_amount = 'TEST_AMOUNT'
    plan = 'Basic'
    client = TransactionResource(secret_key, random_ref)
    response = client.initialize(test_amount,
                                 test_email,
                                 plan)
    print(response)
    client.authorize() # Will open a browser window for client to enter card details
    verify = client.verify() # Verify client credentials
    print(verify)
    print(client.charge()) # Charge an already exsiting client

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

paystack-1.5.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

paystack-1.5.0-py2.7.egg (26.1 kB view details)

Uploaded Source

File details

Details for the file paystack-1.5.0.tar.gz.

File metadata

  • Download URL: paystack-1.5.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for paystack-1.5.0.tar.gz
Algorithm Hash digest
SHA256 95eafecbc763bc49b5ece0f7bf12472c1e0cf610df837067ea88841130a6a2e7
MD5 aae87183d7f7f97966123da548ff8bad
BLAKE2b-256 7e55babf7e2564618d705443f2b1d79862adca9570542bd0e7f4aade87b3f15f

See more details on using hashes here.

File details

Details for the file paystack-1.5.0-py2.7.egg.

File metadata

  • Download URL: paystack-1.5.0-py2.7.egg
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for paystack-1.5.0-py2.7.egg
Algorithm Hash digest
SHA256 e9709e204ffcef54ba7a0732002e67cd147ceb13ac4d09c0361d9a6873021a36
MD5 a629bb5d14907cd54c8eb06fcbb1e461
BLAKE2b-256 51a9826cb77603d4724b316e181fb255eae5947000c3968cd3e334ebaaca785e

See more details on using hashes here.

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