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
PEP-484 type hints bindings for the Django web framework

mypy-django Type stubs to use the mypy static type-checker with your Django projects This project includes the PEP-484 compatible "type stubs" for Dja

Machinalis 223 Jun 17, 2022
Adding Firebase Cloud Messaging Service into a Django Project

Adding Firebase Cloud Messaging Service into a Django Project The aim of this repository is to provide a step-by-step guide and a basic project sample

Seyyed Ali Ayati 11 Jan 03, 2023
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
Application made in Django to generate random passwords as based on certain criteria .

PASSWORD GENERATOR Welcome to Password Generator About The App Password Generator is an Open Source project brought to you by Iot Lab,KIIT and it brin

IoT Lab KIIT 3 Oct 21, 2021
A standalone package to scrape financial data from listed Vietnamese companies via Vietstock

Scrape Financial Data of Vietnamese Listed Companies - Version 2 A standalone package to scrape financial data from listed Vietnamese companies via Vi

Viet Anh (Vincent) Tran 45 Nov 16, 2022
It takes time to start a Django Project and make it almost production-ready.

It takes time to start a Django Project and make it almost production-ready. A developer needs to spend a lot of time installing required libraries, setup a database, setup cache as well as hiding se

Khan Asfi Reza 1 Jan 01, 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
Automated image processing for Django. Currently v4.0

ImageKit is a Django app for processing images. Need a thumbnail? A black-and-white version of a user-uploaded image? ImageKit will make them for you.

Matthew Dapena-Tretter 2.1k Dec 17, 2022
Auto-detecting the n+1 queries problem in Python

nplusone nplusone is a library for detecting the n+1 queries problem in Python ORMs, including SQLAlchemy, Peewee, and the Django ORM. The Problem Man

Joshua Carp 837 Dec 29, 2022
Django Audit is a simple Django app that tracks and logs requests to your application.

django-audit Django Audit is a simple Django app that tracks and logs requests to your application. Quick Start Install django-audit pip install dj-au

Oluwafemi Tairu 6 Dec 01, 2022
A test microblog project created using Django 4.0

django-microblog This is a test microblog project created using Django 4.0. But don't worry this is a fully working project. There is no super-amazing

Ali Kasimoglu 8 Jan 14, 2022
PostgreSQL with Docker + Portainer + pgAdmin + Django local

django-postgresql-docker Running PostgreSQL with Docker + Portainer + pgAdmin + Django local for development. This project was done with: Python 3.9.8

Regis Santos 4 Jun 12, 2022
Simple XML-RPC and JSON-RPC server for modern Django

django-modern-rpc Build an XML-RPC and/or JSON-RPC server as part of your Django project. Major Django and Python versions are supported Main features

Antoine Lorence 82 Dec 04, 2022
Streamlining Django forms to provide all the wins of single-page-applications without the pain.

nango Streamlining Django forms to provide all the wins of single-page-applications without the pain. Key features Available to all Django deployments

Nick Farrell 107 Dec 12, 2022
I managed to attach the Django Framework to my Telegram Bot and set a webhook

I managed to attach the Django Framework to my Telegram Bot and set a webhook. I've been developing it from 10th of November 2021 and I want to have a basic working prototype.

Valentyn Vovchak 2 Sep 08, 2022
Use Database URLs in your Django Application.

DJ-Database-URL This simple Django utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Django appl

Jacob Kaplan-Moss 1.3k Dec 30, 2022
A blog app powered by python-django

Django_BlogApp This is a blog app powered by python-django Features Add and delete blog post View someone else blog Can add comment to that blog And o

Manish Jalui 1 Sep 12, 2022
A generic system for filtering Django QuerySets based on user selections

Django Filter Django-filter is a reusable Django application allowing users to declaratively add dynamic QuerySet filtering from URL parameters. Full

Carlton Gibson 3.9k Jan 03, 2023
A CBV to handle multiple forms in one view

django-shapeshifter A common problem in Django is how to have a view, especially a class-based view that can display and process multiple forms at onc

Kenneth Love 167 Nov 26, 2022
A django model and form field for normalised phone numbers using python-phonenumbers

django-phonenumber-field A Django library which interfaces with python-phonenumbers to validate, pretty print and convert phone numbers. python-phonen

Stefan Foulis 1.3k Dec 31, 2022