GithubHelp home page GithubHelp logo

hearthsim / dj-paypal Goto Github PK

View Code? Open in Web Editor NEW
86.0 13.0 19.0 264 KB

Paypal integration for Django - Inspired by dj-Stripe

License: MIT License

Python 99.39% HTML 0.61%
paypal django payments paypal-rest-sdk python

dj-paypal's Introduction

dj-paypal

Build Status 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.

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.

dj-paypal's People

Contributors

beheh avatar jleclanche avatar joolean avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dj-paypal's Issues

Option to sync everything from paypal

Hi,

is there any possibility to resync from paypal? Like manage.py djpaypal_download_plans but also for BillingAgreements and all the other models?

Regards
Native

Show related WebhookEvents in Django admin

We could add an inline model admin to show all WebhookEvents related to a specific model (e.g. Sale or BillingAgreement). This would help with debugging information desyncs between the API and our models.

Where are the docs?

I'd like to use your library, but iIcan't find the documentation anywhere, I checked the wikis here and searched at readthedocs.
isn't there any documentation?

Subscribing to existing plan

Besides the webhook & upload/download billing plans (command line) functionalities i can't reckon a functionality to connect/sub a user to a specific plan. I don't know if that's really considered in this library ( i assumed it since in the desc. its meant for subscriptions ) , but the djstripe plugin allows the loged-in user to subscribe to a specific plan using REST API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.