Drf-stripe-subscription - An out-of-box Django REST framework solution for payment and subscription management using Stripe

Overview

drf-stripe-subscription

An out-of-box Django REST framework solution for payment and subscription management using Stripe. The goal of this package is to utilize Stripe provided UI and features as much as possible to manage subscription product models. This package helps you make use of Stripe's hosted UI for customer checkout, billing management, as well as for admin to manage product, pricing, and customer subscriptions.

  • Django data models representing Stripe data objects
  • Supports Stripe Webhook for managing changes with your products, prices, and customer subscriptions
  • Django management commands for synchronizing data with Stripe
  • Django REST API endpoints supporting Stripe Checkout Session and Customer Portal

Installation & Setup

pip install drf-stripe-subscription

Include the following drf_stripe settings in Django project settings.py:

DRF_STRIPE = {
    "STRIPE_API_SECRET": "my_stripe_api_key",
    "STRIPE_WEBHOOK_SECRET": "my_stripe_webhook_key",
    "FRONT_END_BASE_URL": "http://localhost:3000",
}

Include drf_stripe in Django INSTALLED_APPS setting:

INSTALLED_APPS = (
    ...,
    "rest_framework",
    "drf_stripe",
    ...
)

Include drf_stripe.url routing in Django project's urls.py, ie:

from django.urls import include, path

urlpatterns = [
    path("stripe/", include("drf_stripe.urls")),
    ...
]

Run migrations command:

python manage.py migrate

Pull Product and Price data from Stripe into Django database using the following command:

python manage.py update_stripe_products

Finally, start Django development server

python manage.py runserver

as well as Stripe CLI to forward Stripe webhook requests:

stripe listen --forward-to 127.0.0.1:8000/stripe/webhook/

Usage

The following REST API endpoints are provided:

List product prices to subscribe

my-site.com/stripe/subscribable-product/

This endpoint is available to both anonymous users and authenticated users. Anonymous users will see a list of all currently available products. For authenticated users, this will be a list of currently available products without any products that the user has already subscribed currently.

List user's current subscriptions

my-site.com/stripe/my-subscription/

This endpoint provides a list of active subscriptions for the current user.

List user's current subscription items

my-site.com/stripe/my-subscription-items/

This endpoint provides a list of active subscription items for the current user.

Create a checkout session using Stripe hosted Checkout page

my-site.com/stripe/checkout/

This endpoint creates Stripe Checkout Session

Make request with the follow request data:

{"price_id": "price_stripe_price_id_to_be_checked_out"}

The response will contain a session_id which can be used by Stripe:

{"session_id": "stripe_checkout_session_id"}

This session_id is a unique identifier for a Stripe Checkout Session, and can be used by redirectToCheckout in Stripe.js. You can implement this in your frontend application to redirect to a Stripe hosted Checkout page after fetching the session id.

By default, the Stripe Checkout page will redirect the user back to your application at either mysite.com/payment/session={{CHECKOUT_SESSION_ID}} if the checkout is successful, or mysite.com/manage-subscription/ if checkout is cancelled.

Stripe Customer Portal

mysite.com/stripe/customer-portal

This will create a Stripe billing portal session, and return the url to that session:

{"url": "url_to_Stripe_billing_portal_session"

This is a link that you can use in your frontend application to redirect a user to Stripe Customer Portal and back to your application. By default, Stripe Customer Portal will redirect the user back to your frontend application at my-site.com/manage-subscription/

Stripe Webhook

mysite.com/stripe/webhook/

This the REST API endpoint Stripe servers can call to update your Django backend application. The following Stripe webhook events are currently supported:

product.created
product.updated
product.deleted
price.created
price.updated
price.deleted
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted

With these Stripe events, you can:

  • Manage your products and pricing model from Stripe Portal, and rely on webhook to update your Django application automatically.
  • Manage your customer subscriptions from Stripe Portal, and rely on webhook to update your Django application automatically.

StripeUser

The StripeUser model comes with a few attributs that allow accessing information about the user quickly:

from drf_stripe.models import StripeUser

stripe_user = StripeUser.objects.get(user_id=django_user_id)

print(stripe_user.subscription_items)
print(stripe_user.current_subscription_items)
print(stripe_user.subscribed_products)
print(stripe_user.subscribed_features)

Product features

Stripe does not come with a way of managing features specific to your products and application. drf-stripe-subscription provides additional tables to manage features associated with each Stripe Product:

  • Feature: this table contains feature_id and a description for the feature.
  • ProductFeature: this table keeps track of the many-to-many relation between Product and Feature.

To assign features to a product, go to Stripe Dashboard -> Products -> Add Product/Edit Product: Under Product information, click on Additional options, add metadata.

Add an entry called features, the value of the entry should be a space-delimited string describing a set of features, ie: FEATURE_A FEATURE_B FEATURE_C.

If you have Stripe CLI webhook running, you should see that your Django server has automatically received product information update, and created/updated the associated ProductFeature and Feature instances. Otherwise, you can also run the python manage.py update_stripe_products command again to synchronize all of your product data. The description attribute of each Feature instance will default to the same value as feature_id, you should update the description yourself if needed.

Comments
  • Invalid field name(s) for model CustomUser: 'username'  while trying to pull new  data from stripe

    Invalid field name(s) for model CustomUser: 'username' while trying to pull new data from stripe

    Invalid field name(s) for model CustomUser: 'username'

    python manage.py update_stripe_customers

    Updated Stripe Customer cus_LSr9w7FB2J7r9U Updated Stripe Customer cus_LSN6YXRJULxYv2 Updated Stripe Customer cus_LSLsozLd7PpiAJ Updated Stripe Customer cus_LSLoxRY2x62iqT Updated Stripe Customer cus_LSBn1ocYarYb8I Updated Stripe Customer cus_LSBMjVw45wQLc9 Updated Stripe Customer cus_LS8UsIDLMRgQL9 Traceback (most recent call last): File "C:\backend\env\lib\site-packages\django\db\models\query.py", line 581, in get_or_create return self.get(**kwargs), False File "C:\backend\env\lib\site-packages\django\db\models\query.py", line 435, in get raise self.model.DoesNotExist( accounts.models.CustomUser.DoesNotExist: CustomUser matching query does not exist.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "C:\backend\mrbackend\manage.py", line 22, in main() File "C:\backend\mrbackend\manage.py", line 18, in main execute_from_command_line(sys.argv) File "C:\backend\env\lib\site-packages\django\core\management_init_.py", line 419, in execute_from_command_line utility.execute() File "C:\backend\env\lib\site-packages\django\core\management_init_.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\backend\env\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "C:\backend\env\lib\site-packages\django\core\management\base.py", line 398, in execute output = self.handle(*args, **options) File "C:\backend\env\lib\site-packages\drf_stripe\management\commands\update_stripe_customers.py", line 14, in handle stripe_api_update_customers(limit=kwargs.get('limit'), starting_after=kwargs.get('starting_after')) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 79, in inner return func(*args, **kwds) File "C:\backend\env\lib\site-packages\drf_stripe\stripe_api\customers.py", line 159, in stripe_api_update_customers user, user_created = get_user_model().objects.get_or_create( File "C:\backend\env\lib\site-packages\django\db\models\manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\backend\env\lib\site-packages\django\db\models\query.py", line 583, in get_or_create params = self._extract_model_params(defaults, **kwargs) File "C:\backend\env\lib\site-packages\django\db\models\query.py", line 634, in _extract_model_params raise exceptions.FieldError( django.core.exceptions.FieldError: Invalid field name(s) for model CustomUser: 'username'.

    my customuser model:

    class CustomUser(AbstractUser): username = None email = models.EmailField(_('email address'), unique=True) bio = models.TextField() gender = models.CharField( max_length=140, null=True, choices=( ('Male', 'Male'), ('Female', 'Female'), ('Other', 'Other') ) ) birth_date = models.DateField(null=True, blank=True) id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)

    Please help me resolve the issue.ASAP

    opened by anirbanchakraborty123 6
  • Product Limit 100

    Product Limit 100

    I'm considering using your library for Stripe payments but I noticed that when you pull products, you limit them to 100:

    https://github.com/oscarychen/drf-stripe-subscription/blob/c352ec59944651a80a9ccbb7b26ea5cbc80b1e13/drf_stripe/stripe_api/products.py#L28

    What is the reason you have hard coded this limit? How do I pull more than 100 products without modifying your code?

    Thanks!

    opened by pkrumins 4
  • react native stripe element implementation?

    react native stripe element implementation?

    Hey there, I've been trying to following this guide i have also created the custom Checkout, i am getting data null in payment_intent and setup_intent is there any option i am missing?

    Custom Serializer

    class CustomCheckoutRequestSerializer(CheckoutRequestSerializer):
        """Handle creation of a custom checkout session where parameters are customized."""
    
        def validate(self, attrs):
            stripe_user = get_or_create_stripe_user(user_id=self.context['request'].user.id)
            try:
                checkout_session = stripe_api_create_checkout_session(
                    customer_id=stripe_user.customer_id,
                    price_id=attrs['price_id'],
                    trial_end='auto' if stripe_user.subscription_items.count() == 0 else None,
                    payment_method_types=["card"],
                    checkout_mode="subscription",
                )
                print(checkout_session)
                attrs['session_id'] = checkout_session['id']
                attrs['customer_id'] = checkout_session['customer']
                attrs['payment_intent'] = checkout_session['payment_intent']
                attrs['url'] = checkout_session['url']
            except StripeError as e:
                raise ValidationError(e.error)
            return attrs
    

    SETTING

    DRF_STRIPE = {
        "STRIPE_API_SECRET": env('STRIPE_API', default=''),
        "STRIPE_WEBHOOK_SECRET": "*",
        "NEW_USER_FREE_TRIAL_DAYS": 7,
    }
    
    opened by AxanIqbal 2
  • Attach coupon to customer

    Attach coupon to customer

    A callback to attach a coupon to a customer would be nice on:

    1. Input passed on first creation of customer
    2. Function on stripe_user that can be called manually

    https://stripe.com/docs/billing/subscriptions/coupons?dashboard-or-api=api https://stripe.com/docs/api/customers/update

    opened by joshuakoh1 1
  • Validation error on StripeSubscriptionEvent

    Validation error on StripeSubscriptionEvent

    1 validation error for StripeEvent event -> StripeSubscriptionEvent -> data -> object -> pending_update str type expected (type=type_error.str)

    opened by pvfarooq 1
  • IndexError: tuple index out of range with stripe_webhooks

    IndexError: tuple index out of range with stripe_webhooks

    When I create a user on the Django admin panel the following way, I get the following error

    class CustomUser(AbstractUser):
        username = None
        email = models.EmailField(_('email address'), unique=True)
        name = models.CharField(verbose_name=_("first name"), max_length=50)
        stripe_customer_id = models.CharField(max_length=120)
    
        USERNAME_FIELD = 'email'
        REQUIRED_FIELDS = ['name']
    
        objects = CustomUserManager()
    
        def __str__(self):
            return self.name
    
    
    @receiver(post_save, sender=CustomUser)
    def _on_update_user(sender, instance, created, **extra_fields):
        print(f"HERE {instance.is_superuser}")
    
        if created and not instance.is_superuser:
    
            # Create Stripe user
            customer = stripe.Customer.create(
                email=instance.email,
                name=instance.name,
            )
            
            User = get_user_model()
    
            # Create profile
            user = User.objects.get(id=instance.id)
            user.email = instance.email
            user.name=instance.name
            user.stripe_customer_id=customer.id
    
            user.save()
    

    The error occurs when the following is running

    stripe listen --forward-to 127.0.0.1:8000/stripe/webhook/

    2022-06-17 13:07:51   --> customer.created [evt_1LBd1nCiNWlPNf1Rnx6rsetb]
    2022-06-17 13:07:51  <--  [500] POST http://127.0.0.1:8000/stripe/webhook/ [evt_1LBd1nCiNWlPNf1Rnx6rsetb]
    

    Here is the error I get

    Traceback (most recent call last):
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/drf_stripe/stripe_webhooks/handler.py", line 53, in handle_webhook_event
        e = StripeEvent(event=event)
      File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
    pydantic.error_wrappers.ValidationError: 1 validation error for StripeEvent
    event
      No match for discriminator 'type' and value 'customer.created' (allowed values: <EventType.CUSTOMER_SUBSCRIPTION_DELETED: 'customer.subscription.deleted'>, <EventType.CUSTOMER_SUBSCRIPTION_UPDATED: 'customer.subscription.updated'>, <EventType.CUSTOMER_SUBSCRIPTION_CREATED: 'customer.subscription.created'>, <EventType.INVOICE_PAID: 'invoice.paid'>, <EventType.INVOICE_CREATED: 'invoice.created'>, <EventType.INVOICE_PAYMENT_FAILED: 'invoice.payment_failed'>, <EventType.PRODUCT_UPDATED: 'product.updated'>, <EventType.PRODUCT_CREATED: 'product.created'>, <EventType.PRODUCT_DELETED: 'product.deleted'>, <EventType.PRICE_CREATED: 'price.created'>, <EventType.PRICE_UPDATED: 'price.updated'>, <EventType.PRICE_DELETED: 'price.deleted'>, <class 'str'>) (type=value_error.discriminated_union.invalid_discriminator; discriminator_key=type; discriminator_value=customer.created; allowed_values=<EventType.CUSTOMER_SUBSCRIPTION_DELETED: 'customer.subscription.deleted'>, <EventType.CUSTOMER_SUBSCRIPTION_UPDATED: 'customer.subscription.updated'>, <EventType.CUSTOMER_SUBSCRIPTION_CREATED: 'customer.subscription.created'>, <EventType.INVOICE_PAID: 'invoice.paid'>, <EventType.INVOICE_CREATED: 'invoice.created'>, <EventType.INVOICE_PAYMENT_FAILED: 'invoice.payment_failed'>, <EventType.PRODUCT_UPDATED: 'product.updated'>, <EventType.PRODUCT_CREATED: 'product.created'>, <EventType.PRODUCT_DELETED: 'product.deleted'>, <EventType.PRICE_CREATED: 'price.created'>, <EventType.PRICE_UPDATED: 'price.updated'>, <EventType.PRICE_DELETED: 'price.deleted'>, <class 'str'>)
    
    
    During the handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
        response = get_response(request)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
        return view_func(*args, **kwargs)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/django/views/generic/base.py", line 70, in view
        return self.dispatch(request, *args, **kwargs)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
        response = self.handle_exception(exc)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
        self.raise_uncaught_exception(exc)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
        raise exc
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
        response = handler(request, *args, **kwargs)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/drf_stripe/views.py", line 69, in post
        handle_stripe_webhook_request(request)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/drf_stripe/stripe_webhooks/handler.py", line 15, in handle_stripe_webhook_request
        handle_webhook_event(event)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/drf_stripe/stripe_webhooks/handler.py", line 55, in handle_webhook_event
        _handle_event_type_validation_error(err)
      File "/Users/magedhelmy/Desktop/VS_Code/licensingDemo4/.venv/lib/python3.10/site-packages/drf_stripe/stripe_webhooks/handler.py", line 41, in _handle_event_type_validation_error
        if error_loc[0] == 'event' and error_loc[1] == 'type':
    IndexError: tuple index out of range
    
    

    I do not understand the error and I am not sure how to proceed from here.

    opened by magedhelmy1 1
  • Redirection in Custom CheckoutRequestSerializer

    Redirection in Custom CheckoutRequestSerializer

    can we have custom redirection option in the serializer the app to work with dynamic linking for mobile apps and website at same time ? or any way to do the platform checks and redirect according to the given platform

    opened by AxanIqbal 1
  • django.db.utils.IntegrityError: insert or update on table

    django.db.utils.IntegrityError: insert or update on table "drf_stripe_subscriptionitem" violates foreign key constraint "drf_stripe_subscript_price_id_56df13e9_fk_drf_strip"

    Caused by python manage.py update_stripe_subscriptions

    $ python manage.py update_stripe_subscriptions
    message='Request to Stripe api' method=get path=https://api.stripe.com/v1/subscriptions?limit=100
    message='Stripe API response' path=https://api.stripe.com/v1/subscriptions?limit=100 response_code=200
    Updated subscription sub_JqlXq6MuRv2zKF
    Updated sub item si_JqlXL5vg7czvwV
    ...
    [more lines like this]
    ...
    Created 34 new Subscriptions.
    Traceback (most recent call last):
      File "/home/vscode/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 267, in _commit
        return self.connection.commit()
    psycopg2.errors.ForeignKeyViolation: insert or update on table "drf_stripe_subscriptionitem" violates foreign key constraint "drf_stripe_subscript_price_id_56df13e9_fk_drf_strip"
    DETAIL:  Key (price_id)=(both_regular_monthly_EU) is not present in table "drf_stripe_price".
    
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/workspace/manage.py", line 10, in <module>
        execute_from_command_line(sys.argv)
      File "/home/vscode/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
        utility.execute()
      File "/home/vscode/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/home/vscode/.local/lib/python3.9/site-packages/django/core/management/base.py", line 414, in run_from_argv
        self.execute(*args, **cmd_options)
      File "/home/vscode/.local/lib/python3.9/site-packages/django/core/management/base.py", line 460, in execute
        output = self.handle(*args, **options)
      File "/home/vscode/.local/lib/python3.9/site-packages/drf_stripe/management/commands/update_stripe_subscriptions.py", line 14, in handle
        stripe_api_update_subscriptions(limit=kwargs.get('limit'), starting_after=kwargs.get('starting_after'))
      File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner
        return func(*args, **kwds)
      File "/home/vscode/.local/lib/python3.9/site-packages/django/db/transaction.py", line 255, in __exit__
        connection.commit()
      File "/home/vscode/.local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
        return func(*args, **kwargs)
      File "/home/vscode/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 291, in commit
        self._commit()
      File "/home/vscode/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 267, in _commit
        return self.connection.commit()
      File "/home/vscode/.local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
        raise dj_exc_value.with_traceback(traceback) from exc_value
      File "/home/vscode/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 267, in _commit
        return self.connection.commit()
    django.db.utils.IntegrityError: insert or update on table "drf_stripe_subscriptionitem" violates foreign key constraint "drf_stripe_subscript_price_id_56df13e9_fk_drf_strip"
    DETAIL:  Key (price_id)=(both_regular_monthly_EU) is not present in table "drf_stripe_price".
    
    opened by janbaykara 1
  • Added support for customizing Stripe Checkout parameters

    Added support for customizing Stripe Checkout parameters

    This addresses issue #2.

    Some of the checkout parameters are specified in DRF_STRIPE settings:

    CHECKOUT_SUCCESS_URL_PATH: The checkout session success redirect url path. CHECKOUT_CANCEL_URL_PATH: The checkout session cancel redirect url path. PAYMENT_METHOD_TYPES: The default default payment method types , defaults to ["card"]. DEFAULT_CHECKOUT_MODE: The default checkout mode, defaults to "subscription".

    By default, you can create a checkout session by calling the default REST endpoint my-site.com/stripe/checkout/, this REST endpoint utilizes drf_stripe.serializers.CheckoutRequestSerializer to validate checkout parameters and create a Stripe Checkout Session. Only a price_id is needed, quantity defaults to 1.

    You can extend this serializer and customize Checkout behavior, such as specifying multiple line_items , payment_method_types, and checkout_mode.

    See README for more info.

    opened by oscarychen 1
  • current_subscription_items isn't efficient on DB queries

    current_subscription_items isn't efficient on DB queries

    Probably should rework the query.

    In [57]: len(connection.queries)
    Out[57]: 31
    
    In [58]: u.stripe_user.current_subscription_items
    Out[58]: {<SubscriptionItem: SubscriptionItem object>}
    
    In [59]: len(connection.queries)
    Out[59]: 39
    
    opened by joshuakoh1 1
  • Can't seem to pull price_id or product_id in my own serializer

    Can't seem to pull price_id or product_id in my own serializer

    Extremely confused by this

    from drf_stripe.models import Price
    class PriceSerializer(serializers.ModelSerializer):
        class Meta:
            model = Price
            fields = ["price_id", "price", "freq"]
    

    Throws an error in the serializer

    Got AttributeError when attempting to get a value for field `price_id` on serializer `PriceSerializer`.
    The serializer field might be named incorrectly and not match any attribute or key on the `Price` instance.
    Original exception text was: 'Price' object has no attribute 'price_id'.
    

    But when I go into the shell it works

    In [2]: models.Price.objects.all().first().price_id
    Out[2]: 'price_xxx'
    
    opened by joshuakoh1 1
Releases(1.1.11)
  • 1.1.11(Apr 18, 2022)

    Added support for working with custom Django User Model.

    The following DRF_STRIPE settings can be used to customize how Django creates User instance using Stripe Customer attributes (default values shown):

    DRF_STRIPE = {
        "DJANGO_USER_EMAIL_FIELD": "email",
        "USER_CREATE_DEFAULTS_ATTRIBUTE_MAP": {"username": "email"},
    }
    

    The DJANGO_USER_EMAIL_FIELD specifies name of the Django User attribute to be used to store Stripe Customer email. It will be used to look up existing Django User using Stripe Customer email.

    The USER_CREATE_DEFAULTS_ATTRIBUTE_MAP maps the name of Django User attribute to name of corresponding Stripe Customer attribute, and is used during the automated Django User instance creation.

    Source code(tar.gz)
    Source code(zip)
  • 1.1.8(Feb 13, 2022)

  • 1.1.7(Feb 9, 2022)

  • 1.1.6(Feb 8, 2022)

  • 1.1.5(Jan 16, 2022)

  • 1.1.3(Jan 16, 2022)

    • Added Django management commands to pull data from Stripe. Use python manage.py pull_stripe to fetch and update Products, Prices, Customers, and Subscription data.
    • Added more attributes to SubscriptionItems API to include attributes such as product name, price nickname.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Jan 14, 2022)

    Bug fix: Subscription event handler was not properly updating the SubscriptionItem table when a price plan is deleted from a Subscription.

    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Jan 14, 2022)

    The Subscription model now has a foreign key pointing to the StripeUser model instead of the Django User model. This reduces the coupling across the application.

    Migrating from older version: you will need to drop all drf-stripe tables and run Django migrate command again to recreate new ones.

    Added convenience methods to the StripUser model:

        @property
        def subscription_items(self):
            """Returns a set of SubscriptionItem instances associated with the StripeUser"""
    
        @property
        def current_subscription_items(self):
            """Returns a set of SubscriptionItem instances that grants current access."""
    
        @property
        def subscribed_products(self):
            """Returns a set of Product instances the StripeUser currently has"""
            return {item.price.product for item in self.current_subscription_items}
    
        @property
        def subscribed_features(self):
            """Returns a set of Feature instances the StripeUser has access to."""
            return set(chain.from_iterable(item.price.product.linked_features.all().prefetch_related("feature") for item in
                                           self.current_subscription_items))
    
    
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Jan 13, 2022)

  • 1.0.0(Jan 13, 2022)

Owner
Oscar Y Chen
Software Developer
Oscar Y Chen
A Django app for managing robots.txt files following the robots exclusion protocol

Django Robots This is a basic Django application to manage robots.txt files following the robots exclusion protocol, complementing the Django Sitemap

Jazzband 406 Dec 26, 2022
PostgreSQL with Docker + Portainer + pgAdmin + Django local

django-postgresql-docker Running PostgreSQL with Docker + Portainer + pgAdmin + Django local for development. This project was done with: Python 3.9.8

Regis Santos 4 Jun 12, 2022
Easily share data across your company via SQL queries. From Grove Collab.

SQL Explorer SQL Explorer aims to make the flow of data between people fast, simple, and confusion-free. It is a Django-based application that you can

Grove Collaborative 2.1k Dec 30, 2022
An airlines clone website with django

abc_airlines is a clone website of an airlines system the way it works is that first you add flights to the website then the users can search flights

milad 1 Nov 16, 2021
Duckiter will Automatically dockerize your Django projects.

Duckiter Duckiter will Automatically dockerize your Django projects. Requirements : - python version : python version 3.6 or upper version - OS :

soroush safari 23 Sep 16, 2021
Ugly single sign-on for django projects only

django-usso Ugly single sign-on for django projects only. Do you have many django apps with different users? Do you want to use only one of those apps

Erwin Feser 1 Mar 01, 2022
Djangoblog - A blogging platform built on Django and Python.

djangoblog 👨‍💻 A blogging platform built on Django and Python

Lewis Gentle 1 Jan 10, 2022
File and Image Management Application for django

Django Filer django Filer is a file management application for django that makes handling of files and images a breeze. Contributing This is a an open

django CMS Association 1.6k Dec 28, 2022
Automated image processing for Django. Currently v4.0

ImageKit is a Django app for processing images. Need a thumbnail? A black-and-white version of a user-uploaded image? ImageKit will make them for you.

Matthew Dapena-Tretter 2.1k Jan 04, 2023
Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Wanderson Fontes 2 Sep 21, 2022
A calendaring app for Django. It is now stable, Please feel free to use it now. Active development has been taken over by bartekgorny.

Django-schedule A calendaring/scheduling application, featuring: one-time and recurring events calendar exceptions (occurrences changed or cancelled)

Tony Hauber 814 Dec 26, 2022
A small Django app to easily broadcast an announcement across a website.

django-site-broadcasts The site broadcast application allows users to define short messages and announcements that should be displayed across a site.

Ben Lopatin 12 Jan 21, 2020
🏭 An easy-to-use implementation of Creation Methods for Django, backed by Faker.

Django-fakery An easy-to-use implementation of Creation Methods (aka Object Factory) for Django, backed by Faker. django_fakery will try to guess the

Flavio Curella 93 Oct 12, 2022
A music recommendation REST API which makes a machine learning algorithm work with the Django REST Framework

music-recommender-rest-api A music recommendation REST API which makes a machine learning algorithm work with the Django REST Framework How it works T

The Reaper 1 Sep 28, 2021
Automatically reload your browser in development.

django-browser-reload Automatically reload your browser in development. Requirements Python 3.6 to 3.10 supported. Django 2.2 to 4.0 supported. Are yo

Adam Johnson 254 Jan 04, 2023
This is a repository for a web application developed with Django, built with Crowdbotics

assignment_32558 This is a repository for a web application developed with Django, built with Crowdbotics Table of Contents Project Structure Features

Crowdbotics 1 Dec 29, 2021
Django Course Project - TextCorrector

Django-TextUtils Django Course Project A tool for analyzing text data in Django backend. It is a project where you can do some of the things with you

1 Oct 29, 2021
This is raw connection between redis server and django python app

Django_Redis This repository contains the code for this blogpost. Running the Application Clone the repository git clone https://github.com/xxl4tomxu9

Tom Xu 1 Sep 15, 2022
Modular search for Django

Haystack author: Daniel Lindsley date: 2013/07/28 Haystack provides modular search for Django. It features a unified, familiar API that allows you to

Daniel Lindsley 4 Dec 23, 2022
A Django web application to receive, virus check and validate transfers of digital archival records, and allow archivists to appraise and accession those records.

Aurora Aurora is a Django web application that can receive, virus check and validate transfers of digital archival records, and allows archivists to a

Rockefeller Archive Center 20 Aug 30, 2022