# Django Stripe
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-stripe-plus)
![PyPI version](https://img.shields.io/pypi/v/django-stripe-plus?color=00bcd4&label=version)
[![Downloads](https://pepy.tech/badge/django-stripe-plus)](https://pepy.tech/project/django-stripe-plus)
[![Build Status](https://github.com/purnendukar/django-stripe/actions/workflows/django-package.yml/badge.svg)](https://github.com/purnendukar/django-stripe/actions/workflows/django-package.yml)
[![codecov](https://codecov.io/github/purnendukar/django-stripe/graph/badge.svg?token=DCKZTJ86YG)](https://codecov.io/github/purnendukar/django-stripe)
![License](https://img.shields.io/pypi/l/django-stripe-plus?color=orange)
`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](#-installation)
- [🚀 Quickstart](#-quickstart)
- [📜 Code of Conduct](#code-of-conduct)
## 💾 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:
```commandline
pip install django-stripe-plus
```
2. Add `django_stripe` to your INSTALLED_APPS setting:
```python
INSTALLED_APPS = [
...,
'django_stripe',
]
```
3. 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
```
4. In your settings, update the model paths in `STRIPE_CONFIG`:
```python
STRIPE_CONFIG = {
"API_VERSION": "2024-06-20", # Stripe API Version
"API_KEY": "api_key", # Stripe Secret Key
}
```
5. 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
```python
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](CODE_OF_CONDUCT.md). We ask you to treat everyone as a smart human programmer that shares an interest in Python and `django-stripe` with you.
Raw data
{
"_id": null,
"home_page": "https://purnendukar.github.io/django-stripe",
"name": "django-stripe-plus",
"maintainer": "Purnendu Kar",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": "purnendu.kar8@gmail.com",
"keywords": "django-stripe",
"author": "Purnendu Kar",
"author_email": "purnendu.kar8@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a4/6b/272b712ba7e410ec4d8fe835d4fec6ed5e32bd86fa801e3a7d96b0e77bbb/django_stripe_plus-0.2.0.tar.gz",
"platform": null,
"description": "# Django Stripe\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-stripe-plus)\n![PyPI version](https://img.shields.io/pypi/v/django-stripe-plus?color=00bcd4&label=version)\n[![Downloads](https://pepy.tech/badge/django-stripe-plus)](https://pepy.tech/project/django-stripe-plus)\n[![Build Status](https://github.com/purnendukar/django-stripe/actions/workflows/django-package.yml/badge.svg)](https://github.com/purnendukar/django-stripe/actions/workflows/django-package.yml)\n[![codecov](https://codecov.io/github/purnendukar/django-stripe/graph/badge.svg?token=DCKZTJ86YG)](https://codecov.io/github/purnendukar/django-stripe)\n![License](https://img.shields.io/pypi/l/django-stripe-plus?color=orange)\n\n\n`django-stripe` is an open source Python package that simplifies the integration of Stripe payments into your Django web application. Its key features include:\n\n- Full support for Stripe's B2C Subscription.\n- Built-in webhook handling for secure communication with Stripe.\n- A wide range of functions for creating and managing customers, subscriptions, and other Stripe-related operations within your Django web application.\n\n## Table of Contents\n\n- [\ud83d\udcbe Installation](#-installation)\n- [\ud83d\ude80 Quickstart](#-quickstart)\n- [\ud83d\udcdc Code of Conduct](#code-of-conduct)\n\n## \ud83d\udcbe Installation\n\nYou can easily install or upgrade to the latest version of the package using pip:\n\n```\npip install django-stripe-plus\n```\n\n## \ud83d\ude80 Quickstart\n\nTo get started quickly, follow these steps:\n\n1. Install the package using pip:\n\n```commandline\npip install django-stripe-plus\n```\n\n2. Add `django_stripe` to your INSTALLED_APPS setting:\n\n```python\nINSTALLED_APPS = [\n ...,\n 'django_stripe',\n]\n```\n\n3. Database migration\n\nAfter implementing the models, create a migration file using the following command:\n\n```\npython manage.py makemigrations\n```\n\nOnce the migration file has been created, apply the migrations to the database using the following command:\n\n```\npython manage.py migrate\n```\n\n4. In your settings, update the model paths in `STRIPE_CONFIG`:\n\n```python\nSTRIPE_CONFIG = {\n \"API_VERSION\": \"2024-06-20\", # Stripe API Version\n \"API_KEY\": \"api_key\", # Stripe Secret Key\n}\n```\n\n5. Implement APIs\n\nYou can use the appropriate actions to build payment APIs. Here are some examples:\nYou can use the appropriate actions to build payment APIs. Here are some examples:\n\n- Syncing a customer\n\n```python\nfrom django.contrib.auth.models import User\nfrom django_stripe.actions import StripeCustomerAction\nfrom django_stripe.models import StripeCustomer\nimport stripe\n\nuser = User.objects.get(email=\"test@example.com\")\naction = StripeCustomerAction()\nstripe_customer = StripeCustomer.objects.get(user=user)\n\nstripe_customer_data = stripe.Customer.retrieve(stripe_customer.stripe_id)\n\ncustomer = StripeCustomerAction().sync(stripe_data=stripe_customer_data)\n```\n\n## Code of Conduct\n\nIn order to foster a kind, inclusive, and harassment-free community, we have a code of conduct, which can be found [here](CODE_OF_CONDUCT.md). We ask you to treat everyone as a smart human programmer that shares an interest in Python and `django-stripe` with you.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django + Stripe made easy",
"version": "0.2.0",
"project_urls": {
"Documentation": "https://purnendukar.github.io/django-stripe",
"Homepage": "https://purnendukar.github.io/django-stripe",
"Repository": "https://github.com/purnendukar/django-stripe"
},
"split_keywords": [
"django-stripe"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c05f204e59a09f66310877f32a8b28afa53774f82f096d9dadf8d8aa3607b9ee",
"md5": "ad0394c9303a37852259bb39a56a41c8",
"sha256": "1f453943de29505186bb318e996a0577d3c5a7af6aeabde87d7e6ced742de0e1"
},
"downloads": -1,
"filename": "django_stripe_plus-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ad0394c9303a37852259bb39a56a41c8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 49361,
"upload_time": "2024-10-13T15:30:12",
"upload_time_iso_8601": "2024-10-13T15:30:12.735189Z",
"url": "https://files.pythonhosted.org/packages/c0/5f/204e59a09f66310877f32a8b28afa53774f82f096d9dadf8d8aa3607b9ee/django_stripe_plus-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a46b272b712ba7e410ec4d8fe835d4fec6ed5e32bd86fa801e3a7d96b0e77bbb",
"md5": "262f7a6beae7f3dc015b14013b16543e",
"sha256": "80ffab3d1fbc2e39cdf805998a5298143b9b876b2ae407b0726e9785b2141953"
},
"downloads": -1,
"filename": "django_stripe_plus-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "262f7a6beae7f3dc015b14013b16543e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 26841,
"upload_time": "2024-10-13T15:30:14",
"upload_time_iso_8601": "2024-10-13T15:30:14.392060Z",
"url": "https://files.pythonhosted.org/packages/a4/6b/272b712ba7e410ec4d8fe835d4fec6ed5e32bd86fa801e3a7d96b0e77bbb/django_stripe_plus-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-13 15:30:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "purnendukar",
"github_project": "django-stripe",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "django-stripe-plus"
}