A pluggable Django application for integrating PayPal Payments Standard or Payments Pro

Overview

Django PayPal

Build Status Latest PyPI version

Django PayPal is a pluggable application that integrates with PayPal Payments Standard and Payments Pro.

See https://django-paypal.readthedocs.org/ for documentation.

django-paypal supports:

  • Django 1.11+
  • Python 2.7, and 3.4+

(Not all combinations are supported).

Project status

This is an Open Source project that is active but in maintenance mode. The maintainers see their primary responsibilities as:

  • fixing any critical data loss or security bugs.
  • keeping the project up-to-date with new versions of Django (or other dependencies).
  • merging well written patches from the community, and doing so promptly.

Large scale development work and feature additions are not planned by the maintainers.

Some important parts of the code base are not covered by automated tests, and may be broken for some versions of Django or Python. These parts of the code base currently issue warnings, and the maintainers are waiting for tests to be contributed by those who actually need those parts, and docs where appropriate.

Please bear these things in mind if filing an issue. If you discover a bug, unless it is a critical data loss or security bug, the maintainers are unlikely to work for free to fix it, and a new feature, or tests for existing functionality, will only be added by the maintainers if they need it themselves.

That said, if you do have large changes that you want to contribute, including large new features (such as implementing newer PayPal payment methods), they will be gladly accepted if they are implemented well.

Please see CONTRIBUTING.rst for more information about using the issue tracker and pull requests. Please do not open issues for support requests.

Paid support

Some of the maintainers are able to provide support on a paid basis for this Open Source project. This includes the following kinds of things:

  • Paying for bug fixes or new features (with the understanding that these changes will become freely available as part of the project and are not 'owned' by the person who paid for them).
  • Debugging or other support for integrating django-paypal into your project.
  • Implementing the integration for you from scratch.

If you are interested in these, you can contact the follower developers:

  • Luke Plant - homepage, email - long time Django expert and contributor.
Comments
  • Fix encrypted buttons under Python 3

    Fix encrypted buttons under Python 3

    Avoid the b'' decoration under Python 3 when mixing binary (encrypted button contents) and normal strings. Fix the examples in the documentation for encrypted buttons to use the encrypted form.

    patch-needs-improvement 
    opened by JonathanRoach 12
  • PayPal IPN test returns 502

    PayPal IPN test returns 502

    I've followed the tutorial almost exactly and I got this response:

    Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request POST /webapps/developer/applications/ipn_simulator. Reason: Error reading from remote server

    Any reason why a 502 Proxy Error is raised when using the IPN simulator: https://developer.paypal.com/webapps/developer/applications/ipn_simulator

    opened by macdonjo 11
  • valid_ipn_received.connect(show_me_the_money) has never called.

    valid_ipn_received.connect(show_me_the_money) has never called.

    I tried the code in the page http://django-paypal.readthedocs.org/en/latest/standard/ipn.html

    I certainly added the valid_ipn_received.connect(show_me_the_money) in my views.py But, show_me_the_money has never called. Is it bug?

    opened by shinriyo 10
  • SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE]

    SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE]

    Hi folks, i am having this issue all day and i cant figure out what should be.

    I am running in the localhost the paypal pro, when i submit the payment form i get this error:

    requests.exceptions.SSLError
    SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)
    

    Thanks in advance for any clues and sorry if this is not directly related with the django-paypal.

    o/

    opened by luanfonceca 9
  • UnicodeDecodeError when receiving flag_info info error

    UnicodeDecodeError when receiving flag_info info error

    Hi all,

    First of all thanks to spookylukey (and also dcramer) for this super library. I have recently discovered that sometimes Paypal is returning some unreadable characters in the 'flag_info' field and an UnicodeDecodeException exception is raised in the following line: self.flag_info += info of file: django_paypal-0.1.3-py2.7.egg/paypal/standard/models.py

    I guess that a try/catch surrounding the line and managing the unicode variable properly should be enough to fix it.

    Best regards from Barcelona, Álvaro Vélez.

    opened by alvarovelezgalvez 9
  • Using a different locale breaks the callback from paypal

    Using a different locale breaks the callback from paypal

    Hi,

    We run django-paypal on a website with a fr_FR locale. When django-paypal receive the callback from paypal, that confirms that the payment has been made, it tries to parse the date from paypal using PAYPAL_DATE_FORMAT (defined in standard/forms.py).

    However, as my locale is fr_FR, it is expecting the names in the date in french, and it fails. It returns that an invalid ipn is received… If I turn my locale to en_US, everything works fine.

    Could you fix that problem ? (probably by setting the locale to "C" before parsing the dates, and setting it back to its original value after ?).

    Thanks, palkeo.

    bug needs-info 
    opened by palkeo 8
  • recurring_payment signal never sent

    recurring_payment signal never sent

    The recurring_payment signal is never sent because a recurring payment is also a transaction

            if self.is_transaction():
                if self.flag:
                    payment_was_flagged.send(sender=self)
                elif self.is_refund():
                    payment_was_refunded.send(sender=self)
                elif self.is_reversed():
                    payment_was_reversed.send(sender=self)
                else:
                    payment_was_successful.send(sender=self)
            # Recurring payment signals:
            # XXX: Should these be merged with subscriptions?
            elif self.is_recurring():
                if self.is_recurring_create():
                    recurring_create.send(sender=self)
                elif self.is_recurring_payment():
                    recurring_payment.send(sender=self)
    

    I wanted to change elif self.is_recurring(): into if self.is_recurring(): but this comment stopped me:

        def test_recurring_payment_ipn(self):
            """
            The wat the code is written in
            PayPalIPN.send_signals the recurring_payment
            will never be sent because the paypal ipn
            contains a txn_id, if this test failes you
            might break some compatibility
            """
    

    Is there any reason for not sending both signals?

    opened by chripede 8
  • Confusing PayPal documentation

    Confusing PayPal documentation

    I confused PayPal doc that describes paypal_dict variables that are sent to PayPal with doc describing variables that are returned by PayPal via IPN. As a result, my function that checks if the payment was correct, triggered by the valid_ipn_received signal, used ipn_obj.amount variable instead of ipn_obj.mc_gross.

    The function didn't work as I expected but there were no errors reported on the console. After doing some digging I ended up adding this code in my_app.__int__.py

    from django.conf import settings
    
    class ExceptionLoggingMiddleware(object):
        def __init__(self, get_response):
            self.get_response = get_response
    
        def __call__(self, request):
            response = self.get_response(request)
            return response
    
        def process_exception(self, request, exception):
            if settings.DEBUG:
                print(exception.__class__.__name__)
                return None
    

    and also add to project's settings.py:

    MIDDLEWARE = [
        ...
        'my_project.my_app.ExceptionLoggingMiddleware',
    ]
    

    With this ExceptionLoggingMiddleware class on now I can see errors that makes my function fail.

    opened by TomSteck 7
  • REMOTE_ADDR may contain invalid data when using Nginx as reverse proxy

    REMOTE_ADDR may contain invalid data when using Nginx as reverse proxy

    /paypal/standard/models.py the method named def initialize(self, request): has the following line:

    self.ipaddress = request.META.get('REMOTE_ADDR', '')

    If you ever reverse proxy a connection to django the REMOTE_ADDR does not contain the end-users actual IP, it'll contain nothing or the proxy servers ip or in my case it actually contained literally "b''" (thats B and 2 single quotes in a string).

    There are also cases when someone is using a service such as cloudflare, I changed the self.ipaddress line to the following code so that it'll find an IP somewhere.

    for val in ['HTTP_CF_CONNECTING_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP', 'REMOTE_ADDR']:
        self.ipaddress = request.META.get(val, '').split(',')[0]  # proxys may forwarded multiple ips, first one is clients
        if self.ipaddress:
            break
    
    opened by iarp 7
  • RawPostDataException when trying to test IPN

    RawPostDataException when trying to test IPN

    I am using the chrome plugin Postman to try and test the IPN callback on my localhost. When posting to the callback URL I am getting a RawPostDataException error "You cannot access body after reading from request's data stream"

    Am I doing something wrong here or is there a better why to test the IPN callback locally? Thanks

    opened by dantium 7
  • Fix Paypal making requests using POST instead of GET.

    Fix Paypal making requests using POST instead of GET.

    While I was testing using the Paypal sandbox I found I was getting POST request instead for GET for its notifications. I modified the code in a way that existing code won't break, but it will also handle the POST method. Hope it gets merged. Thanks.

    patch-needs-improvement 
    opened by dhontecillas 7
  • untested warning for is_subscription

    untested warning for is_subscription

    Hi, I'm getting an untested warning for PayPalStandardBase.is_subcription()

    paypal.standard.models:286: This method (or branch) is not covered by automated tests. It is therefore very vulnerable to being accidentally broken by future versions of django-paypal. Please contribute tests to ensure future functionality!
    

    The method itself is just one line:

        def is_subscription(self):
            warn_untested()
            return len(self.subscr_id) > 0
    

    So I wonder what kind of test would be needed for this. Or if it's pointing to the more generic subscription logic?

    opened by newearthmartin 4
  • Custom data got truncated

    Custom data got truncated

    Recently I have got 4 payments where the IPN returned with truncated custom field. I did create the (unencrypted) form with data like:

     'custom': '{"user_plan_id": 310606, "plan_id": 1, "pricing_id": 1, "first_order_id": 43102, "user_email": "[email protected]"}
    

    But i am receiving IPN with only ...&custom={&... in URL, so I can't pair the payment with the data in DB.

    This would probably be error on side of PayPal, but also can be caused by some interaction with the form in browser on user's side (but it happened for 4 different users). I am creating this issue mainly because I want to ask if somebody has similar experience.

    opened by PetrDlouhy 4
  • Encrypted form gives different interface on PayPal

    Encrypted form gives different interface on PayPal

    If I switch to encrypted form, the PayPal shows me interface with much worse UX: Snímek obrazovky_2022-05-03_07-48-03

    In contrast with the interface with unencrypted form: Snímek obrazovky_2022-05-03_07-48-14

    I don't think, this is fault of django-paypal, but I would like to know the reason for this anyway. Also this might be something that should get into documentation.

    opened by PetrDlouhy 1
  • Fix intermittent PDT issues

    Fix intermittent PDT issues

    Fixes issue #239.

    Rather than use the same form for both the PDT callback and the postback, split these apart. We'll take a minimal set of parameters from the callback, and fill in rest using the postback endpoint.

    I've included a test which includes the full set of query parameters I'm seeing on most (but not all) PDT callback requests. Note payment_date is in ISO format in these requests, and notify_version is a string. With this PR both these parameters will be ignored.

    opened by djw 0
  • Received 3 IPNs for the same transaction, only one flagged as duplicate

    Received 3 IPNs for the same transaction, only one flagged as duplicate

    Hi! I received 3 IPNs for the same transaction with the same data, but only one was flagged as duplicate. They have all the same transaction id and all the same payment status, and are all separated by one minute (3:00 am 3:01 am 3:02 am).

    Only one got marked as duplicate so my system ended up processing the same payment twice.

    Screen Shot 2021-10-18 at 12 42 06

    opened by newearthmartin 3
Releases(v1.0.0)
Owner
Luke Plant
Core @django developer, freelancer. spookylukey on Twitter
Luke Plant
Django app for handling the server headers required for Cross-Origin Resource Sharing (CORS)

django-cors-headers A Django App that adds Cross-Origin Resource Sharing (CORS) headers to responses. This allows in-browser requests to your Django a

Adam Johnson 4.8k Jan 03, 2023
Simple API written in Python using FastAPI to store and retrieve Books and Authors.

Simple API made with Python FastAPI WIP: Deploy in AWS with Terraform Simple API written in Python using FastAPI to store and retrieve Books and Autho

Caio Delgado 9 Oct 26, 2022
Django-Docker - Django Installation Guide on Docker

Guía de instalación del Framework Django en Docker Introducción: Con esta guía p

Victor manuel torres 3 Dec 02, 2022
Pinax is an open-source platform built on the Django Web Framework.

Symposion Pinax Pinax is an open-source platform built on the Django Web Framework. It is an ecosystem of reusable Django apps, themes, and starter pr

Pinax Project 295 Mar 20, 2022
Imparare Django ricreando un sito facsimile a quello Flask

SitoPBG-Django Imparare Django ricreando un sito facsimile a quello Flask Note di utilizzo Necessita la valorizzazione delle seguenti variabili di amb

Mario Nardi 1 Dec 08, 2021
Django + AWS Elastic Transcoder

Django Elastic Transcoder django-elastic-transcoder is an Django app, let you integrate AWS Elastic Transcoder in Django easily. What is provided in t

StreetVoice 66 Dec 14, 2022
A Django backed for PostgreSQL using Psycopg 3

A Django backend for PostgreSQL using Psycopg 2 The backend passes the entire Django test suite, but it needs a few modifications to Django and to i

Daniele Varrazzo 42 Dec 16, 2022
A calendaring app for Django. It is now stable, Please feel free to use it now. Active development has been taken over by bartekgorny.

Django-schedule A calendaring/scheduling application, featuring: one-time and recurring events calendar exceptions (occurrences changed or cancelled)

Tony Hauber 814 Dec 26, 2022
A Student/ School management application built using Django and Python.

Student Management An awesome student management app built using Django.! Explore the docs » View Demo · Report Bug · Request Feature Table of Content

Nishant Sethi 1 Feb 10, 2022
Reusable, generic mixins for Django

django-braces Mixins for Django's class-based views. Documentation Read The Docs Installation Install from PyPI with pip: pip install django-braces Bu

Brack3t 1.9k Jan 05, 2023
A CTF leaderboard for the submission of flags during a CTF challenge. Built using Django.

🚩 CTF Leaderboard The goal of this project is to provide a simple web page to allow the participants of an CTF to enter their found flags. Also the l

Maurice Bauer 2 Jan 17, 2022
This is a repository for a web application developed with Django, built with Crowdbotics

assignment_32558 This is a repository for a web application developed with Django, built with Crowdbotics Table of Contents Project Structure Features

Crowdbotics 1 Dec 29, 2021
A web app which allows user to query the weather info of any place in the world

weather-app This is a web app which allows user to get the weather info of any place in the world as soon as possible. It makes use of OpenWeatherMap

Oladipo Adesiyan 3 Sep 20, 2021
The new Python SDK for Sentry.io

Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoy

Sentry 1.4k Jan 05, 2023
Tweak the form field rendering in templates, not in python-level form definitions. CSS classes and HTML attributes can be altered.

django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is su

Jazzband 1.8k Jan 02, 2023
Django React Flight Rezervation

Django Intro & Installation python -m venv venv source ./venv/Scripts/activate pip install Django pip install djangorestframework pip install python-d

HILMI SARIOGLU 2 May 26, 2022
English dictionary using Django based on freecodecamp

English Dictionary Hi there, i made this english dictionary using Django based on freecodecamp.org tutorial :) Table of Contents Preview Technologies

Aline Alencar 3 May 09, 2022
Template for Django Project Using Docker

You want a Django project who use Docker and Docker-compose for Development and for Production ? It's for you !

1 Dec 17, 2021
A Django based shop system

django-SHOP Django-SHOP aims to be a the easy, fun and fast e-commerce counterpart to django-CMS. Here you can find the full documentation for django-

Awesto 2.9k Dec 30, 2022
Template de desarrollo Django

Template de desarrollo Django Python Django Docker Postgres Nginx CI/CD Descripción del proyecto : Proyecto template de directrices para la estandariz

Diego Esteban 1 Feb 25, 2022