Skip to main content

Confirm Paypal payments via PDT and IPN

Project description

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_string_from_paypal')

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 a pypay.exceptions.RequestError will be thrown.

The values passed to pdt_confirm and ipn_confirm are sanity checked and a pypay.exceptions.InvalidPaypalData will be thrown 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

Project details


Release history Release notifications

History Node

0.2.1

History Node

0.1.1

This version
History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pypay-0.1.0.tar.gz (4.2 kB) Copy SHA256 hash SHA256 Source None May 20, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page