Skip to content

Commit

Permalink
Update installation.rst to match README quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
therefromhere committed Oct 22, 2019
1 parent faf97cb commit 025f4df
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ Add ``djstripe`` to your ``INSTALLED_APPS``:
...
)
Add to urls.py:

.. code-block:: python
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 set the operating mode:
Expand All @@ -75,12 +81,6 @@ Add your Stripe keys and set the operating mode:
Add some payment plans via the Stripe.com dashboard.

Add to urls.py:

.. code-block:: python
path("stripe/", include("djstripe.urls", namespace="djstripe")),
Run the commands::

python manage.py migrate
Expand Down
38 changes: 21 additions & 17 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,59 @@ Installation
Get the distribution
---------------------

At the command line::
Install dj-stripe:

$ pip install dj-stripe
.. code-block:: bash
pip install dj-stripe
Configuration
---------------


Add ``djstripe`` to your ``INSTALLED_APPS``:

.. code-block:: python
INSTALLED_APPS += [
'django.contrib.sites',
# ...,
INSTALLED_APPS =(
...
"djstripe",
]
...
)
Add your Stripe keys and set the operating mode:
Add to urls.py:

.. code-block:: python
STRIPE_LIVE_PUBLIC_KEY = os.environ.get("STRIPE_LIVE_PUBLIC_KEY", "<your publishable key>")
STRIPE_LIVE_SECRET_KEY = os.environ.get("STRIPE_LIVE_SECRET_KEY", "<your secret key>")
STRIPE_TEST_PUBLIC_KEY = os.environ.get("STRIPE_TEST_PUBLIC_KEY", "<your publishable key>")
STRIPE_TEST_SECRET_KEY = os.environ.get("STRIPE_TEST_SECRET_KEY", "<your secret key>")
STRIPE_LIVE_MODE = <True or False>
path("stripe/", include("djstripe.urls", namespace="djstripe")),
Add some payment plans via the Stripe.com dashboard or the django ORM.
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 the following to the `urlpatterns` in your `urls.py` to expose the webhook endpoint:
Add your Stripe keys and set the operating mode:

.. code-block:: python
url(r"^stripe/", include("djstripe.urls", namespace="djstripe")),
STRIPE_LIVE_PUBLIC_KEY = os.environ.get("STRIPE_LIVE_PUBLIC_KEY", "<your publishable key>")
STRIPE_LIVE_SECRET_KEY = os.environ.get("STRIPE_LIVE_SECRET_KEY", "<your secret key>")
STRIPE_TEST_PUBLIC_KEY = os.environ.get("STRIPE_TEST_PUBLIC_KEY", "<your publishable key>")
STRIPE_TEST_SECRET_KEY = os.environ.get("STRIPE_TEST_SECRET_KEY", "<your 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
Then 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 some payment plans via the Stripe.com dashboard.

Run the commands::

python manage.py migrate

python manage.py djstripe_init_customers

python manage.py djstripe_sync_plans_from_stripe

Running Tests
--------------

Assuming the tests are run against PostgreSQL::

createdb djstripe
pip install tox
tox

0 comments on commit 025f4df

Please sign in to comment.