Skip to main content

dj-paypal

CI PyPI

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

Currently only supports subscriptions.

Requirements

  • Python 3.6+
  • Django 3.1+
  • 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.

Webhooks are only accepted if their certificate is hosted on the PayPal API host matching PAYPAL_MODE and if they were transmitted within PAYPAL_WEBHOOK_MAX_AGE (a timedelta, defaults to 15 minutes) of being received.

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.

Metadata

Release files for dj-paypal 0.16.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-paypal 0.16.2
File Size Uploaded Provenance Actions
dj_paypal-0.16.2.tar.gz 25.9 kB With provenance Details for dj_paypal-0.16.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dj-paypal 0.16.2
File Interpreter ABI Platform Actions
dj_paypal-0.16.2-py3-none-any.whl Python 3 none any Details for dj_paypal-0.16.2-py3-none-any.whl

Total release size: 64.7 kB

Release files / dj_paypal-0.16.2.tar.gz

Download URL dj_paypal-0.16.2.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
041a9697bf0cbe172b07bea9d645b55deab710e0d7fca15b02312de3f3970401
BLAKE2b-256 checksum
How to use checksums
3203ffe2f68a62a38468871bff922404241312c11e3597e910f7f665cd9bcb14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / dj_paypal-0.16.2-py3-none-any.whl

Download URL dj_paypal-0.16.2-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1c732a4fef2cd9062513c5fff67acc9d0a4548892a231c1e5e62f68975b2c5b
BLAKE2b-256 checksum
How to use checksums
2c7c94d093e1355a317f0bb76c07c3419ba65f94b13aed61313393a9e2fe9ede
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for dj-paypal 0.16.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dj_paypal-0.16.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.16.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page