# dj-stripe
[![Documentation](https://readthedocs.org/projects/dj-stripe/badge/)](https://dj-stripe.readthedocs.io/)
[![Sponsor dj-stripe](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/dj-stripe)
Stripe Models for Django.
## Introduction
dj-stripe implements all of the Stripe models, for Django. Set up your
webhook endpoint and start receiving model updates. You will then have
a copy of all the Stripe models available in Django models, as soon as
they are updated!
The full documentation is available [on Read the Docs](https://dj-stripe.readthedocs.io/).
## Features
- Stripe Core
- Stripe Billing
- Stripe Cards (JS v2) and Sources (JS v3)
- Payment Methods and Payment Intents (SCA support)
- Support for multiple accounts and API keys
- Stripe Connect (partial support)
- Tested with Stripe API `2020-08-27` (see [API versions](https://dj-stripe.readthedocs.io/en/latest/api_versions.html))
## Requirements
- Django 2.2+
- Python 3.6+
- PostgreSQL engine (recommended) 9.5+
- MySQL engine: MariaDB 10.2+ or MySQL 5.7+
- SQLite: Not recommended in production. Version 3.26+ required.
## Quickstart
Install dj-stripe with pip:
pip install dj-stripe
Or with [Poetry](https://python-poetry.org/) (recommended):
poetry add dj-stripe
Add `djstripe` to your `INSTALLED_APPS`:
INSTALLED_APPS =(
...
"djstripe",
...
)
Add to urls.py:
path("stripe/", include("djstripe.urls", namespace="djstripe")),
Tell Stripe about the webhook (Stripe webhook docs can be found
[here](https://stripe.com/docs/webhooks)) using the full URL of your
endpoint from the urls.py step above (e.g.
`https://example.com/stripe/webhook`).
Add your Stripe keys and other settings:
```py
STRIPE_LIVE_SECRET_KEY = os.environ.get("STRIPE_LIVE_SECRET_KEY", "<live secret key>")
STRIPE_TEST_SECRET_KEY = os.environ.get("STRIPE_TEST_SECRET_KEY", "<test secret key>")
STRIPE_LIVE_MODE = False # Change to True in production
DJSTRIPE_WEBHOOK_SECRET = "whsec_xxx" # Get it from the section in the Stripe dashboard where you added the webhook endpoint
DJSTRIPE_USE_NATIVE_JSONFIELD = True # We recommend setting to True for new installations
DJSTRIPE_FOREIGN_KEY_TO_FIELD = "id" # Set to `"id"` for all new 2.4+ installations
```
Add some payment plans via the Stripe.com dashboard.
Run the commands:
python manage.py migrate
python manage.py djstripe_sync_models
See <https://dj-stripe.readthedocs.io/en/latest/stripe_elements_js.html>
for notes about usage of the Stripe Elements frontend JS library.
## Running the Tests
Assuming the tests are run against PostgreSQL:
createdb djstripe
pytest
# Changelog
[See release notes on Read the Docs](https://dj-stripe.readthedocs.io/en/latest/history/2_4_0/).
# Funding this project
[![Stripe Logo](./docs/logos/stripe_blurple.svg)](https://stripe.com)
You can now become a sponsor to dj-stripe with [GitHub Sponsors](https://github.com/sponsors/dj-stripe).
We've been bringing dj-stripe to the world for over 7 years and are excited to be able to start
dedicating some real resources to the project.
Your sponsorship helps us keep a team of maintainers actively working to improve dj-stripe and
ensure it stays up-to-date with the latest Stripe changes. If you're using dj-stripe in a commercial
capacity and have the ability to start a sponsorship, we'd greatly appreciate the contribution.
All contributions through GitHub sponsors flow into our [Open Collective](https://opencollective.com/dj-stripe),
which holds our funds and keeps an open ledger on how donations are spent.
## Similar libraries
- [dj-paypal](https://github.com/HearthSim/dj-paypal)
([PayPal](https://www.paypal.com/))
- [dj-paddle](https://github.com/paddle-python/dj-paddle)
([Paddle](https://paddle.com/))
没有合适的资源?快使用搜索试试~ 我知道了~
PyPI 官网下载 | dj-stripe-2.4.2.tar.gz
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 160 浏览量
2022-01-10
15:09:06
上传
评论
收藏 134KB GZ 举报
温馨提示
共61个文件
py:53个
po:2个
md:2个
资源来自pypi官网。 资源全名:dj-stripe-2.4.2.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
dj-stripe-2.4.2.tar.gz (61个子文件)
dj-stripe-2.4.2
setup.py 5KB
pyproject.toml 1KB
djstripe
checks.py 10KB
templates
djstripe
admin
change_form.html 415B
signals.py 7KB
urls.py 639B
enums.py 23KB
__init__.py 814B
views.py 1KB
event_handlers.py 12KB
middleware.py 3KB
models
sigma.py 1KB
billing.py 70KB
__init__.py 2KB
base.py 32KB
checkout.py 3KB
account.py 8KB
connect.py 7KB
api.py 4KB
payment_methods.py 23KB
orders.py 0B
core.py 75KB
webhooks.py 6KB
fraud.py 0B
managers.py 3KB
contrib
__init__.py 112B
rest_framework
urls.py 604B
__init__.py 94B
views.py 3KB
serializers.py 949B
permissions.py 957B
context_managers.py 672B
sync.py 579B
utils.py 5KB
admin.py 14KB
mixins.py 2KB
fields.py 5KB
migrations
0007_2_4.py 58KB
__init__.py 0B
0006_2_3.py 7KB
0005_2_2.py 48KB
0001_initial.py 228KB
decorators.py 2KB
locale
fr
LC_MESSAGES
django.po 17KB
ru
LC_MESSAGES
django.po 20KB
management
__init__.py 106B
commands
djstripe_process_events.py 4KB
djstripe_sync_customers.py 887B
djstripe_sync_plans_from_stripe.py 626B
djstripe_sync_models.py 5KB
__init__.py 85B
djstripe_clear_expired_idempotency_keys.py 271B
djstripe_update_invoiceitem_ids.py 3KB
djstripe_init_customers.py 832B
webhooks.py 3KB
settings.py 7KB
exceptions.py 372B
CONTRIBUTING.md 7KB
LICENSE 1KB
README.md 4KB
PKG-INFO 5KB
共 61 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功