Skip to content

iambenkay/paystack-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paystack-py Build Status

For completing, initializing and verifying paystack transactions

New in 1.0.5:

  • Now supports recurring debits and directly charging a card
  • included tests

Import the paystack class

from paystack_py import Paystack

ps = Paystack("<YOUR_API_KEY>")

For payments that redirect you to paystack.

url = ps.init_redirect('test@test.com', 500000, 'https://callback.com/url')

Redirect to the URL returned and in your callback view get the reference GET parameter and pass it to verify:

status = ps.verify(reference)

if status:
    # give value to customer
    pass

For recurring debits, instead of using verify above, use verify_and_authorize:

    auth_code = ps.verify_and_authorize(reference)
    if status:
        # give value to customer and store auth_code.
    pass
    new_auth_code = ps.recurring_payments(auth_code, "test@test.com", 50000)

    # just keep storing each subsequent authorization code so you can use it later.

For charging cards:

status = ps.charge_a_card(card={
        "number": "4084084084084081",
        "cvv": 408, 
        "expiry_month": 9,
        "expiry_year": y}, email="test@test.com", amount=500000)

if status:
    # Give customer value
    pass

About

For completing, initializing and verifying paystack transactions

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages