Git Product home page Git Product logo

pesapal.py's Introduction

Introduction

A python library to work with the Pesapal payment API.

Usage

API Methods

  1. PesapalDirectOrderV4

     import pesapal
    
     consumer_key ='lhiP9QWtQQsXWU+G5HdFHEUr41COHMiI'  # Demo key. Replace with your own, provided by Pesapal
     consumer_secret = '5k6xJ7E0G5JFgUowlc+13SFEfkY='  # Demo consumer secret. Replace with your own.
    
     oauth_consumer = pesapal.OAuthConsumer(consumer_key, consumer_secret)
    
     reference = 123  # Order reference number
     description = 'An order'  # Order description
     amount = 1199.00  # The total cost of the order
     callback='http://example.com'  # The URL the user will be redirected to after making a payment
    
     email = '[email protected]'  # You must supply at least one of either a phone number or email
     phone_number = '012345678'
     direct_order = pesapal.DirectOrder(
         oauth_consumer,
         reference,
         description,
         amount,
         callback,
         email=email,
         phone_number=phone_number)
    
     print direct_order.url  # This is the URL for the payment page
    
  2. QueryPaymentStatus

     import pesapal
    
     consumer_key ='lhiP9QWtQQsXWU+G5HdFHEUr41COHMiI'  # Demo key. Replace with your own, provided by Pesapal
     consumer_secret = '5k6xJ7E0G5JFgUowlc+13SFEfkY='  # Demo consumer secret. Replace with your own.
    
     oauth_consumer = pesapal.OAuthConsumer(consumer_key, consumer_secret)
    
     pesapal_merchant_reference = 1234  # Order reference number
     pesapal_transaction_tracking_id = '4321'  # Tracking id returned by Pesapal as callback param
    
     payment_status = pesapal.PaymentStatus(
         consumer,
         pesapal_merchant_reference,
         pesapal_transaction_tracking_id)
    
     print payment_status.message  # Message returned by API call. This requires urllib2
    

Roadmap

Implement the remaining api methods, namely

QueryPaymentStatus QueryPaymentDetails

License

Pesapal.py is Open Source Software, released under the terms of the MIT License.

© Okal Otieno, 2012.

pesapal.py's People

Contributors

okal avatar

Watchers

Jude Mwenda avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.