E-Commerce / Payments#
Pegasus (version 2023.9.1 and up) includes an out-of-the-box E-Commerce/Payments demo. In a few clicks you can have a fully functional digital storefront in your application, allowing you to collect and track one-time or recurring payments with Stripe.
Watch a video#
To see how this feature works, you can watch the following video:
Set up Stripe Products#
First add your products in the Stripe dashboard. Be sure to add readable product names, descriptions, and images, as these will be used for the in-app store. Additionally, make sure each product includes at least one Price.
Set up your development environment#
Setting up your development is similar to the process for subscriptions, but has fewer steps.
If you haven’t already, update the
settings.pyor in your os environment variables to match the keys from Stripe. See this page to find your API keys.
python manage.py djstripe_sync_models priceto sync your Stripe products and prices to your local database.
Note: if this command fails you may also need to add your Stripe API keys to the database via the Django admin as described here.
Add the product IDs you want to include to the
ACTIVE_ECOMMERCE_PRODUCT_IDSsetting/environment variable. In your
.envfile, you can add a list of products by separating them with commas. E.g.
Once you’ve done this, login and click on the e-commerce tab in the navigation, and you should see your store.
Like subscriptions, it’s recommended to use webhooks to ensure you receive all updates from Stripe.
For the e-commerce store, the only required webhook is
Follow the subscriptions documentation to set up webhooks in development and production.