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
Official Python agent for the Elastic APM

elastic-apm -- Elastic APM agent for Python This is the official Python module for Elastic APM. It provides full out-of-the-box support for many of th

elastic 369 Jan 05, 2023
Django + NextJS + Tailwind Boilerplate

django + NextJS + Tailwind Boilerplate About A Django project boilerplate/templa

Shayan Debroy 3 Mar 11, 2022
A debug/profiling overlay for Django

Django Debug Toolbar The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/respons

David Cramer 228 Oct 17, 2022
Plug and play continuous integration with django and jenkins

django-jenkins Plug and play continuous integration with Django and Jenkins Installation From PyPI: $ pip install django-jenkins Or by downloading th

Mikhail Podgurskiy 941 Oct 22, 2022
A simple djagno music website.

Mrock A simple djagno music website. I used this template and I translated it to eng. Also some changes commited. My Live Domo : https://mrock.pythona

Hesam N 1 Nov 30, 2021
Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

foorilla LLC 4 May 18, 2022
Django Simple Spam Blocker is blocking spam by regular expression.

Django Simple Spam Blocker is blocking spam by regular expression.

Masahiko Okada 23 Nov 29, 2022
ProjectManagementWebsite - Project management website for CMSC495 built using the Django stack

ProjectManagementWebsite A minimal project management website for CMSC495 built

Justin 1 May 23, 2022
pytest-django allows you to test your Django project/applications with the pytest testing tool.

pytest-django allows you to test your Django project/applications with the pytest testing tool.

pytest-dev 1.1k Dec 14, 2022
Vehicle registration using Python, Django and SQlite3

PythonCrud Cadastro de veículos utilizando Python, Django e SQlite3 Para acessar o deploy no Heroku:

Jorge Thiago 4 May 20, 2022
Simple yet powerful and really extendable application for managing a blog within your Django Web site.

Django Blog Zinnia Simple yet powerful and really extendable application for managing a blog within your Django Web site. Zinnia has been made for pub

Julien Fache 2.1k Dec 24, 2022
A multiprocessing distributed task queue for Django

A multiprocessing distributed task queue for Django Features Multiprocessing worker pool Asynchronous tasks Scheduled, cron and repeated tasks Signed

Ilan Steemers 1.7k Jan 03, 2023
Custom Django field for using enumerations of named constants

django-enumfield Provides an enumeration Django model field (using IntegerField) with reusable enums and transition validation. Installation Currently

5 Monkeys 195 Dec 20, 2022
Rosetta is a Django application that eases the translation process of your Django projects

Rosetta Rosetta is a Django application that facilitates the translation process of your Django projects. Because it doesn't export any models, Rosett

Marco Bonetti 909 Dec 26, 2022
Media-Management with Grappelli

Django FileBrowser Media-Management with Grappelli. The FileBrowser is an extension to the Django administration interface in order to: browse directo

Patrick Kranzlmueller 913 Dec 28, 2022
🗂️ 🔍 Geospatial Data Management and Search API - Django Apps

Geospatial Data API in Django Resonant GeoData (RGD) is a series of Django applications well suited for cataloging and searching annotated geospatial

Resonant GeoData 53 Nov 01, 2022
A pickled object field for Django

django-picklefield About django-picklefield provides an implementation of a pickled object field. Such fields can contain any picklable objects. The i

Gintautas Miliauskas 167 Oct 18, 2022
Coltrane - A simple content site framework that harnesses the power of Django without the hassle.

coltrane A simple content site framework that harnesses the power of Django without the hassle. Features Can be a standalone static site or added to I

Adam Hill 58 Jan 02, 2023
Django-MySQL extends Django's built-in MySQL and MariaDB support their specific features not available on other databases.

Django-MySQL The dolphin-pony - proof that cute + cute = double cute. Django-MySQL extends Django's built-in MySQL and MariaDB support their specific

Adam Johnson 504 Jan 04, 2023
Getdp-project - A Django-built web app that generates a personalized banner of events to come

getdp-project https://get-my-dp.herokuapp.com/ A Django-built web app that gener

CODE 4 Aug 01, 2022