{"id":25363802,"url":"https://github.com/dinoperovic/django-salesman-stripe","last_synced_at":"2025-10-30T01:31:59.136Z","repository":{"id":62568492,"uuid":"471290505","full_name":"dinoperovic/django-salesman-stripe","owner":"dinoperovic","description":"Stripe payment integration for Salesman.","archived":false,"fork":false,"pushed_at":"2023-02-23T15:27:37.000Z","size":74,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T14:19:55.090Z","etag":null,"topics":["django","e-commerce","salesman","shop","stripe","stripe-api","wagtail"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dinoperovic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2022-03-18T08:31:10.000Z","updated_at":"2024-09-04T14:52:13.000Z","dependencies_parsed_at":"2023-02-15T07:31:06.235Z","dependency_job_id":null,"html_url":"https://github.com/dinoperovic/django-salesman-stripe","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoperovic%2Fdjango-salesman-stripe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoperovic%2Fdjango-salesman-stripe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoperovic%2Fdjango-salesman-stripe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoperovic%2Fdjango-salesman-stripe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dinoperovic","download_url":"https://codeload.github.com/dinoperovic/django-salesman-stripe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238921059,"owners_count":19552678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","e-commerce","salesman","shop","stripe","stripe-api","wagtail"],"created_at":"2025-02-14T22:39:09.364Z","updated_at":"2025-10-30T01:31:58.825Z","avatar_url":"https://github.com/dinoperovic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Salesman Stripe\n\n[![PyPI](https://img.shields.io/pypi/v/django-salesman-stripe)](https://pypi.org/project/django-salesman-stripe/)\n[![Test](https://github.com/dinoperovic/django-salesman-stripe/actions/workflows/test.yml/badge.svg)](https://github.com/dinoperovic/django-salesman-stripe/actions/workflows/test.yml)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-salesman-stripe)](https://pypi.org/project/django-salesman-stripe/)\n[![PyPI - Django Version](https://img.shields.io/pypi/djversions/django-salesman-stripe)](https://pypi.org/project/django-salesman-stripe/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n[Stripe](https://stripe.com/) payment integration for [Salesman](https://github.com/dinoperovic/django-salesman).\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install django-salesman-stripe\n```\n\nAdd to your setting file:\n\n```python\nINSTALLED_APPS += ['salesman_stripe']\nSALESMAN_PAYMENT_METHODS = ['salesman_stripe.payment.StripePayment']\nSALESMAN_STRIPE_SECRET_KEY = '\u003cstripe-secret-key\u003e'\nSALESMAN_STRIPE_WEBHOOK_SECRET = '\u003cstripe-webhook-secret\u003e'\n```\n\n### Local setup\n\nTo simulate webhooks while in development you can use the [Stripe CLI](https://stripe.com/docs/stripe-cli).\nAfter you've installed the CLI, you can run:\n\n```bash\nstripe listen --forward-to localhost:8000/api/payment/stripe/webhook/\n```\n\nThis will connect the webhook and output the signing secret for `SALESMAN_STRIPE_WEBHOOK_SECRET` setting.\n\n### Additional settings\n\nOptional additional settings that you can override:\n\n```python\n# Payment method label used when displayed in the basket.\nSALESMAN_STRIPE_PAYMENT_LABEL = 'Pay with Stripe'\n\n# Default ISO currency used for payments (https://stripe.com/docs/currencies)\nSALESMAN_STRIPE_DEFAULT_CURRENCY = 'usd'\n\n# URL to redirect to when Stripe payment is cancelled.\nSALESMAN_STRIPE_CANCEL_URL = '/stripe/cancel/'\n\n# URL to redirect to when Stripe payment is successfull.\nSALESMAN_STRIPE_SUCCESS_URL = '/stripe/success/'\n\n# Default paid status for fullfiled orders.\nSALESMAN_STRIPE_PAID_STATUS = 'PROCESSING'\n```\n\n### Customer syncing\n\nIt is recommended to enable Stripe customer syncronization with your User model.\nThis will require an extra field on your User model which will hold the Stripe customer ID.\nEasiest way to do this is to define a custom user model:\n\n```python\n# shop/models.py\nfrom salesman_stripe.models import StripeCustomerMixin\n\nclass User(StripeCustomerMixin, AbstractUser):\n    pass\n```\n\nYou should then register your custom user model in `settings.py`:\n\n```python\nAUTH_USER_MODEL = 'shop.User'\n```\n\nAn alternative approach would be to override the `get_stripe_customer_id` and `save_stripe_customer_id`\nmethods in a custom `StripePayment` class, see more in advanced usage section below.\n\n## Advanced usage\n\nTo gain more control feel free to extend the `StripePayment` class with your custom functionality:\n\n```python\n# shop/payment.py\nfrom salesman_stripe.payment import StripePayment\nfrom salesman_stripe.conf import app_settings\n\nclass MyStripePayment(StripePayment):\n    def get_stripe_customer_data(self, obj, request):\n        # https://stripe.com/docs/api/customers/create\n        data = super().get_stripe_customer_data(obj, request)\n        if obj.user and obj.user.phone_number:\n            data['phone'] = obj.user.phone_number\n        return data\n\n    def get_currency(self, request):\n        currency = request.GET.get('currency', None)\n        # Check currency is valid for Stripe...\n        return currency or app_settings.SALESMAN_STRIPE_DEFAULT_CURRENCY\n```\n\nMake sure to use your payment method in `settings.py`:\n\n```python\nSALESMAN_PAYMENT_METHODS = ['shop.payment.MyStripePayment']\n```\n\nThe `StripePayment` class is setup with extending in mind, feel free to explore other methods.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoperovic%2Fdjango-salesman-stripe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdinoperovic%2Fdjango-salesman-stripe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoperovic%2Fdjango-salesman-stripe/lists"}