Django / Paypal integration (based on dj-stripe)
Project description
dj-paypal
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
- Install dj-paypal with
pip install dj-paypal - Add
djpaypalto djangoINSTALLED_APPSsetting - Get a client ID and client secret from paypal and add them to the settings
PAYPAL_CLIENT_IDandPAYPAL_CLIENT_SECRET - Set
PAYPAL_MODE = "sandbox"(or"live") in the settings - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dj_paypal-0.16.1.tar.gz.
File metadata
- Download URL: dj_paypal-0.16.1.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5610159d970841e5e3c62c0358a295c53211bcb4e2e1d7c790a1fdf7406b94c
|
|
| MD5 |
7d4bf2e0b10d297d36fa41cd0c60a4f6
|
|
| BLAKE2b-256 |
39c831de3715d795f57b17bbeaf44de201e80c16c0fbd3a5ebe8dffcd37cca29
|
Provenance
The following attestation bundles were made for dj_paypal-0.16.1.tar.gz:
Publisher:
ci.yml on HearthSim/dj-paypal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dj_paypal-0.16.1.tar.gz -
Subject digest:
c5610159d970841e5e3c62c0358a295c53211bcb4e2e1d7c790a1fdf7406b94c - Sigstore transparency entry: 179692440
- Sigstore integration time:
-
Permalink:
HearthSim/dj-paypal@21c58522560a84ef1463708987db8283d443f6d6 -
Branch / Tag:
refs/tags/v0.16.1 - Owner: https://github.com/HearthSim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@21c58522560a84ef1463708987db8283d443f6d6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dj_paypal-0.16.1-py3-none-any.whl.
File metadata
- Download URL: dj_paypal-0.16.1-py3-none-any.whl
- Upload date:
- Size: 37.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9cecd89dcb340eb9db11a76f8b001667b3d3cd4e9edae2e1648a6463c6394b8
|
|
| MD5 |
8690305e5c9c6df52b927f112f4c3db2
|
|
| BLAKE2b-256 |
85d190e19970f2c2254b2159fdc98c118f7e0fe48ff9fd505cfc521eef5b5ae3
|
Provenance
The following attestation bundles were made for dj_paypal-0.16.1-py3-none-any.whl:
Publisher:
ci.yml on HearthSim/dj-paypal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dj_paypal-0.16.1-py3-none-any.whl -
Subject digest:
f9cecd89dcb340eb9db11a76f8b001667b3d3cd4e9edae2e1648a6463c6394b8 - Sigstore transparency entry: 179692442
- Sigstore integration time:
-
Permalink:
HearthSim/dj-paypal@21c58522560a84ef1463708987db8283d443f6d6 -
Branch / Tag:
refs/tags/v0.16.1 - Owner: https://github.com/HearthSim
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@21c58522560a84ef1463708987db8283d443f6d6 -
Trigger Event:
push
-
Statement type: