Skip to main content

Django Stripe

PyPI - Python Version PyPI version Downloads Build Status codecov License

django-stripe is an open source Python package that simplifies the integration of Stripe payments into your Django web application. Its key features include:

  • Full support for Stripe's B2C Subscription.
  • Built-in webhook handling for secure communication with Stripe.
  • A wide range of functions for creating and managing customers, subscriptions, and other Stripe-related operations within your Django web application.

Table of Contents

💾 Installation

You can easily install or upgrade to the latest version of the package using pip:

pip install django-stripe-plus

🚀 Quickstart

To get started quickly, follow these steps:

  1. Install the package using pip:
pip install django-stripe-plus
  1. Add django_stripe to your INSTALLED_APPS setting:
INSTALLED_APPS = [
    ...,
    'django_stripe',
]
  1. Database migration

After implementing the models, create a migration file using the following command:

python manage.py makemigrations

Once the migration file has been created, apply the migrations to the database using the following command:

python manage.py migrate
  1. In your settings, update the model paths in STRIPE_CONFIG:
STRIPE_CONFIG = {
    "API_VERSION": "2024-06-20", # Stripe API Version
    "API_KEY": "api_key", # Stripe Secret Key
}
  1. Implement APIs

You can use the appropriate actions to build payment APIs. Here are some examples: You can use the appropriate actions to build payment APIs. Here are some examples:

  • Syncing a customer
from django.contrib.auth.models import  User
from django_stripe.actions import StripeCustomerAction
from django_stripe.models import StripeCustomer
import stripe

user = User.objects.get(email="test@example.com")
action = StripeCustomerAction()
stripe_customer = StripeCustomer.objects.get(user=user)

stripe_customer_data = stripe.Customer.retrieve(stripe_customer.stripe_id)

customer = StripeCustomerAction().sync(stripe_data=stripe_customer_data)

Code of Conduct

In order to foster a kind, inclusive, and harassment-free community, we have a code of conduct, which can be found here. We ask you to treat everyone as a smart human programmer that shares an interest in Python and django-stripe with you.

Metadata

Release files for django-stripe-plus 0.2.0

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

Source distribution (sdist)

Source distribution for django-stripe-plus 0.2.0
File Size Uploaded Provenance Actions
django_stripe_plus-0.2.0.tar.gz 26.8 kB Without provenance Details for django_stripe_plus-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-stripe-plus 0.2.0
File Interpreter ABI Platform Actions
django_stripe_plus-0.2.0-py3-none-any.whl Python 3 none any Details for django_stripe_plus-0.2.0-py3-none-any.whl

Total release size: 76.2 kB

Release files / django_stripe_plus-0.2.0.tar.gz

Download URL django_stripe_plus-0.2.0.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
80ffab3d1fbc2e39cdf805998a5298143b9b876b2ae407b0726e9785b2141953
BLAKE2b-256 checksum
How to use checksums
a46b272b712ba7e410ec4d8fe835d4fec6ed5e32bd86fa801e3a7d96b0e77bbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.7 Linux/6.5.0-1025-azure

Release files / django_stripe_plus-0.2.0-py3-none-any.whl

Download URL django_stripe_plus-0.2.0-py3-none-any.whl
Size 49.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f453943de29505186bb318e996a0577d3c5a7af6aeabde87d7e6ced742de0e1
BLAKE2b-256 checksum
How to use checksums
c05f204e59a09f66310877f32a8b28afa53774f82f096d9dadf8d8aa3607b9ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.7 Linux/6.5.0-1025-azure

Security for django-stripe-plus 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.2.0 This release

2 release files No 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