Skip to main content

Django / Paypal integration (based on dj-stripe)

Project description

dj-paypal

Build Status PyPI

A Paypal integration for Django, inspired by dj-stripe.

Currently only supports subscriptions.

Requirements

  • Python 3.6+
  • Django 2.0+
  • Postgres 9.6+ (Non-postgres engines not supported)

Installation

  1. Install dj-paypal with pip install dj-paypal
  2. Add djpaypal to django INSTALLED_APPS setting
  3. Get a client ID and client secret from paypal and add them to the settings PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET
  4. Set PAYPAL_MODE = "sandbox" (or "live") in the settings
  5. Install your Billing Plans (see below)

Setting up billing plans

Download already-created billing plans from Paypal

Run manage.py djpaypal_download_plans to sync all plans already created upstream into the local database.

This will create djpaypal.models.BillingPlan objects, which can be listed from the Django admin.

Creating new Paypal billing plans

The manage.py djpaypal_upload_plans management command creates billing plans using the Paypal API. An extra PAYPAL_PLANS setting must be set, which will contain a dict of Paypal billing plans to create.

See example_settings.py for an example of plans to create.

Webhooks

The djpaypal.views.ProcessWebhookView view should be hooked up to an URL endpoint which you then set up in Paypal as a webhook endpoint (https://developer.paypal.com).

In order to verify webhooks being transmitted to your app, dj-paypal needs to know the ID of the webhook that is expected at that URL. Set it in the setting PAYPAL_WEBHOOK_ID.

Sandbox vs. Live

All models have a livemode boolean attribute. That attribute is set to True if created in Live (production) mode, False otherwise (sandbox mode). Sandbox and Live data can co-exist without issues. Once you are done testing in Sandbox mode, use the manage.py djpaypal_delete_all_test_data management command to (locally) clear all the test data. This command has no impact on the upstream data.

Data considerations

Most of the models defined in dj-paypal are copies of the upstream Paypal model data. Deleting or editing objects (be it from the admin or in the database) does not actually change any of the upstream Paypal data.

License and Sponsorship

This project was designed and developed by HearthSim. It is licensed under the MIT license. The full license text is available in the LICENSE file.

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

dj-paypal-0.15.1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

dj_paypal-0.15.1-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file dj-paypal-0.15.1.tar.gz.

File metadata

  • Download URL: dj-paypal-0.15.1.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.7 Linux/4.15.0-1028-gcp

File hashes

Hashes for dj-paypal-0.15.1.tar.gz
Algorithm Hash digest
SHA256 fa60e8d1dddd24abc9d86eaf01c37f8d318ca0391f9813375717c080527bec9b
MD5 fd1449b6d6b1941173695ac5756447a0
BLAKE2b-256 d6ed424788f968ff356f6eb47d7dffcf9c5313ec9dfffd01f97bd7901a056e14

See more details on using hashes here.

File details

Details for the file dj_paypal-0.15.1-py3-none-any.whl.

File metadata

  • Download URL: dj_paypal-0.15.1-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.7 Linux/4.15.0-1028-gcp

File hashes

Hashes for dj_paypal-0.15.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca1f42cf98ee23e6e499328217ea0f6f66a778144d54da2826c245fe0b489102
MD5 9865e178058c8d330398a0c8baf1dcb6
BLAKE2b-256 437c27037d006c4d32b2ac7907c016217eb7fabb5f87a3a78c8c480204788e21

See more details on using hashes here.

Supported by

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