Skip to main content

Integration between django-plans and django-paypal.

Project description

https://badge.fury.io/py/django-plans-paypal.svg https://travis-ci.org/PetrDlouhy/django-plans-paypal.svg?branch=master https://codecov.io/gh/PetrDlouhy/django-plans-paypal/branch/master/graph/badge.svg

Almost automatic integration between django-plans and django-paypal. This will add subscribe buttons to the order page and automatically confirm the Order after the payment.

Currently it is in experimetal stage, wher only recurring payments (subscribtions) are supported.

Documentation

The full documentation is at https://django-plans-paypal.readthedocs.io.

Quickstart

Install and configure django-plans and django-paypal apps. Capture mode is not yet supported, so PAYMENT_VARINANTS with 'capture': False will not get confirmed.

Install Django plans paypal:

pip install django-plans-paypal

Add it to your INSTALLED_APPS, before the plans:

INSTALLED_APPS = (
    ...
    'payments',
    'paypal.standard.ipn',
    'plans_paypal',
    ...
)

Add your bussiness account e-mail address to settings:

PAYPAL_BUSSINESS_EMAIL = "foo@bar.com"

# To enable encrypted PayPal form:
PAYPAL_ENCRYPTED_FORM = True
PAYPAL_PRIVATE_CERT = os.path.join(BASE_DIR, 'certs/paypal_private.pem')
PAYPAL_PUBLIC_CERT = os.path.join(BASE_DIR, 'certs/paypal_public.pem')
PAYPAL_CERT = os.path.join(BASE_DIR, 'certs/paypal_cert.pem')
PAYPAL_CERT_ID = 'xxxxx'

Add Django plans_paypal to the URL patterns:

urlpatterns = [
    ...
    url(r'^plans-paypal', include('plans_paypal.urls')),
    ...
]

Override django-plans class CreateOrderView so that get_success_url() returns url of paypal-payment view:

def get_success_url(self):
   return reverse("paypal-payment", kwargs={'order_id': self.object.id})

Sandbox testing

Set following settings:

PAYPAL_TEST_BUSSINESS_EMAIL = "foo@bar.com"
PAYPAL_TEST = True

# For encrypted PayPal sandbox form:
PAYPAL_TEST_PRIVATE_CERT = os.path.join(BASE_DIR, 'certs/paypal_private.pem')
PAYPAL_TEST_PUBLIC_CERT = os.path.join(BASE_DIR, 'certs/paypal_public.pem')
PAYPAL_TEST_CERT = os.path.join(BASE_DIR, 'certs/paypal_sandbox_cert.pem')
PAYPAL_TEST_CERT_ID = 'xxxx'

Redirect user to paypal-payment-sandbox instead of paypal-payment view.

Features

  • TODO

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

History

0.4.2 (2021-11-08)

  • fix problem with other IPN types

0.4.1 (2021-10-18)

  • cancel order after returning to failure URL

0.4.0 (2021-10-18)

  • allow to set up encrypted PayPal form

0.3.0 (2021-10-15)

  • fixes and improvements to the sandbox/production functionality

  • reverse sandbox logic - if no PAYPAL_TEST, the sandbox view would return production so nobody can pay through sandbox on production server

0.2.2 (2021-10-12)

  • fix foregotten pudb

0.2.1 (2021-10-12)

  • add sandbox view, so both production and sandbox can be used on one server

0.2.0 (2021-10-11)

  • fix periods to complain with PayPal maximal durations

0.1.0 (2021-10-08)

  • hook ipn.PayPalIpn object with plans.Order (for later usage e.g. determining PayPal fee)

  • set plan renewal for django-plans

0.0.2 (2018-08-05)

  • Payment process without capturing should work

  • Automatic buttons generation

0.0.1 (2018-07-23)

  • First release on PyPI.

Project details


Download files

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

Source Distribution

django-plans-paypal-0.4.2.tar.gz (19.4 kB view details)

Uploaded Source

File details

Details for the file django-plans-paypal-0.4.2.tar.gz.

File metadata

  • Download URL: django-plans-paypal-0.4.2.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.7

File hashes

Hashes for django-plans-paypal-0.4.2.tar.gz
Algorithm Hash digest
SHA256 0ca757ea503878d90a6f8c7f277d701625f8fb5aac1efa939efdf238b4a6d07d
MD5 b3e39bbcb5ed34aa381c884e642a5d8c
BLAKE2b-256 2582f7ea6a125c72711b7d40a482cacd3004b528aa7b2392764c5dcc238d1d4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page