Giter VIP home page Giter VIP logo

pypay's Introduction

pypay

pypay provides a clean API for confirming Paypal payments via PDT or IPN. It takes the boilerplate out of interacting with these services and normalises the Paypal response into something sensible.

Under the hood pypay uses the excellent Requests library for handling http.

Installation

pip install pypay

Usage

To check a payment via PDT

import pypay

response = pypay.pdt_confirm('your_transaction_id', 'your_identity_token')

To check a payment via IPN

import pypay

response = pypay.ipn_confirm('query_params_from_paypal')

You can pass the query params as either a string (e.g. 'quantity=1&name=joe') or a dict. This is particularly useful if you're using Django as you can drop in request.POST and everything with just work.

Response objects

Response objects always have two properties

response.confirmed # bool indicating if payment is verified

response.details # dict containing all the Paypal variables that were returned

Handling exceptions

In the event of a problem making the http call to Paypal, pypay will raise a pypay.exceptions.RequestError.

The values passed to pdt_confirm and ipn_confirm are sanity checked and a pypay.exceptions.InvalidPaypalData will be raised if they are of the wrong type.

Python version support

pypay runs on Python 2.6, 2.7, 3.3 and 3.4 using the Six compatibility library.

Running tests

Run the test suite with Tox

pip install tox

Tests are written with pytest

pypay's People

Contributors

juddgarratt avatar dbohomiakov avatar

Stargazers

Andrii Soldatenko avatar

Watchers

James Cloos avatar  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.