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

Overview

Django PayPal

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 may be 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 following developers:

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
payu payment gateway integration for django projects

Django-PayU This package provides integration between Django and PayU Payment Gateway. Quick start Install 'django-payu' using the following command:

MicroPyramid 37 Nov 09, 2022
Django + Stripe Made Easy

dj-stripe Stripe Models for Django. Introduction dj-stripe implements all of the Stripe models, for Django. Set up your webhook endpoint and start rec

dj-stripe 1.3k Dec 28, 2022
A pluggable Django application for integrating PayPal Payments Standard or Payments Pro

Django PayPal Django PayPal is a pluggable application that integrates with PayPal Payments Standard and Payments Pro. See https://django-paypal.readt

Luke Plant 672 Dec 22, 2022
PayPal integration for django-oscar. Can be used without Oscar too.

PayPal package for django-oscar This package provides integration between django-oscar and both PayPal REST API, PayPal Express (NVP) and PayPal Payfl

Oscar 146 Nov 25, 2022
A Django app to accept payments from various payment processors via Pluggable backends.

Django-Merchant Django-Merchant is a django application that enables you to use multiple payment processors from a single API. Gateways Following gate

Agiliq 997 Dec 24, 2022
Django library to simplify payment processing with pin

Maintainer Wanted I no longer have any side projects that use django-pinpayments and I don't have the time or headspace to maintain an important proje

Ross Poulton 25 May 25, 2022
Forms, widgets, template tags and examples that make Stripe + Django easier.

Overview Zebra is a library that makes using Stripe with Django even easier. It's made of: zebra, the core library, with forms, webhook handlers, abst

GoodCloud 189 Jan 01, 2023
Adyen package for django-oscar

Adyen package for django-oscar This package provides integration with the Adyen payment gateway. It is designed to work with the e-commerce framework

Oscar 13 Jan 10, 2022