{"id":19622379,"url":"https://github.com/carrington-dev/dj-payfast","last_synced_at":"2026-02-12T19:01:16.604Z","repository":{"id":238994437,"uuid":"798202681","full_name":"Carrington-dev/dj-payfast","owner":"Carrington-dev","description":"An implementation of a payfast payment gateway with django","archived":false,"fork":false,"pushed_at":"2026-01-20T12:26:39.000Z","size":252,"stargazers_count":37,"open_issues_count":32,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-20T21:26:04.462Z","etag":null,"topics":["billing","django","finance","finance-application","fintech","payfast","payments","python","subscriptions"],"latest_commit_sha":null,"homepage":"https://dj-payfast.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Carrington-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["stemgon","khanoit"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":["https://www.paypal.com/ncp/payment/D7J7QSRR3WQFA","https://khanoit.co.za/support-me","https://buymeacoffee.com/crn96mmu"]}},"created_at":"2024-05-09T09:52:03.000Z","updated_at":"2026-01-20T12:27:23.000Z","dependencies_parsed_at":"2025-12-25T10:05:30.319Z","dependency_job_id":null,"html_url":"https://github.com/Carrington-dev/dj-payfast","commit_stats":null,"previous_names":["carrington-dev/dj-payfast"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Carrington-dev/dj-payfast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carrington-dev%2Fdj-payfast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carrington-dev%2Fdj-payfast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carrington-dev%2Fdj-payfast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carrington-dev%2Fdj-payfast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Carrington-dev","download_url":"https://codeload.github.com/Carrington-dev/dj-payfast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carrington-dev%2Fdj-payfast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29377895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T18:59:55.292Z","status":"ssl_error","status_checked_at":"2026-02-12T18:59:44.289Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["billing","django","finance","finance-application","fintech","payfast","payments","python","subscriptions"],"created_at":"2024-11-11T11:27:29.525Z","updated_at":"2026-02-12T19:01:16.592Z","avatar_url":"https://github.com/Carrington-dev.png","language":"Python","readme":"# dj-payfast - Django + Payfast Made Easy\n\n[![payfast Verified Partner](https://img.shields.io/static/v1?label=payfast\u0026message=Verified%20Partner\u0026color=red\u0026style=for-the-badge)](https://payfast.com/docs/libraries#community-libraries)\n\u003cbr\u003e\n\n\u003c!-- [![CI tests](https://github.com/Carrington-dev/dj-payfast/blob/main/assets/img/badge.svg)](https://github.com/dj-payfast/dj-payfast/actions/workflows/ci.yml) --\u003e\n[![Package Downloads](https://img.shields.io/pypi/dm/dj-payfast)](https://pypi.org/project/dj-payfast/)\n\n[![Documentation](https://img.shields.io/static/v1?label=Docs\u0026message=READ\u0026color=informational\u0026style=plastic)](https://carrington-dev.github.io/dj-payfast/)\n[![Sponsor dj-payfast](https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=red\u0026style=plastic)](https://github.com/sponsors/dj-payfast)\n[![MIT License](https://img.shields.io/static/v1?label=License\u0026message=MIT\u0026color=informational\u0026style=plastic)](https://github.com/sponsors/dj-payfast)\n\nPayFast Models for Django.\n\n## Introduction\n\ndj-payfast implements all of the Payfast models intergration, for Django. Set up your\nwebhook endpoint and start receiving model updates. You will then have\na copy of all the payfast models available in Django models, as soon as\nthey are updated!\n\nThe full documentation is available [on Read the Docs](https://carrington-dev.github.io/dj-payfast/).\n\n## Features\n\n-   Payfast Core\n-   Payfast Billing\n-   Payfast Cards (JS v2) and Sources (JS v3)\n-   Payment Methods and Payment Intents (SCA support)\n-   Support for multiple accounts and API keys\n-   Payfast Connect (partial support)\n-   Tested with Payfast API `2020-08-27` (see [API versions](api_versions.md#dj-payfast_latest_tested_version))\n\n## Requirements\n\n-   Django \u003e=4.2\n-   Django Rest Framework (Portable)\n-   Python \u003e=3.9\n-   PostgreSQL engine (recommended) \u003e=12\n-   MySQL engine: MariaDB \u003e=10.5 or MySQL \u003e=8.0\n-   SQLite: Not recommended in production. Version \u003e=3.26 required.\n-   Nginx, Gunicorn, Docker\n-   Celery is included\n-   Email setup\n\n## Installation\n\nSee [installation](https://carrington-dev.github.io/dj-payfast/installation/) instructions.\n\n\n### 1. Install via pip\n\n```bash\npip install dj-payfast\n```\n\n### 2. Add to `INSTALLED_APPS`\n\n```python\n# settings.py\n\nINSTALLED_APPS = [\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.staticfiles',\n    \n    # Third-party apps\n    'rest_framework',  # Optional, for API support\n    'payfast',         # Add this\n    \n    # Your apps\n    'myapp',\n]\n```\n\n### 3. Configure URLs\n\n```python\n# urls.py\n\nfrom django.contrib import admin\nfrom django.urls import path, include\n\nurlpatterns = [\n    path('admin/', admin.site.urls),\n    path('payfast/', include('payfast.urls')),  # Add this\n    # Your other URLs\n]\n```\n\nThis creates the webhook endpoint at: `/payfast/notify/`\n\n### 4. Run Migrations\n\n```bash\npython manage.py migrate\n```\n\n---\n\n## Configuration\n\n### Basic Configuration\n\nAdd your PayFast credentials to `settings.py`:\n\n```python\n# settings.py\n\n# PayFast Configuration\nPAYFAST_MERCHANT_ID = '10023192'           # Your merchant ID\nPAYFAST_MERCHANT_KEY = 'ecs5ue9vb4i70'     # Your merchant key\nPAYFAST_PASSPHRASE = 'jt7NOE43FZPn'        # Your passphrase (recommended)\nPAYFAST_TEST_MODE = True                    # False for production\n```\n\n### Environment Variables (Recommended)\n\n**Never commit credentials to version control!** Use environment variables:\n\n```python\n# settings.py\nimport os\n\nPAYFAST_MERCHANT_ID = os.environ.get('PAYFAST_MERCHANT_ID')\nPAYFAST_MERCHANT_KEY = os.environ.get('PAYFAST_MERCHANT_KEY')\nPAYFAST_PASSPHRASE = os.environ.get('PAYFAST_PASSPHRASE')\nPAYFAST_TEST_MODE = os.environ.get('PAYFAST_TEST_MODE', 'True') == 'True'\n```\n\nCreate a `.env` file:\n\n```bash\n# .env\nPAYFAST_MERCHANT_ID=10023192\nPAYFAST_MERCHANT_KEY=ecs5ue9vb4i70\nPAYFAST_PASSPHRASE=jt7NOE43FZPn\nPAYFAST_TEST_MODE=True\n```\n\n### Getting PayFast Credentials\n\n**Sandbox (Testing):**\n1. Sign up at [sandbox.payfast.co.za](https://sandbox.payfast.co.za)\n2. Navigate to **Home → Account Information**\n3. Copy your Merchant ID and Merchant Key\n4. Generate a passphrase\n\n**Production:**\n1. Sign up at [www.payfast.co.za](https://www.payfast.co.za)\n2. Complete merchant verification\n3. Navigate to **Settings → Integration**\n4. Copy your credentials\n\n---\n\n\n## Usage Examples\n### Steps Taken When Using API Calls (To make it dynamic)\n\nCreate a payment (post) endpoint at: `/payfast/payments/`\n\n```json\n// some fields are not required\n// This is a post request\n{\n    \"m_payment_id\": \"\",\n    \"user\": null,\n    \"amount\": null,\n    \"item_name\": \"\",\n    \"item_description\": \"\",\n    \"name_first\": \"\",\n    \"name_last\": \"\",\n    \"email_address\": \"\",\n    \"cell_number\": \"\",\n    \"custom_str1\": \"\",\n    \"custom_str2\": \"\",\n    \"custom_str3\": \"\",\n    \"custom_str4\": \"\",\n    \"custom_str5\": \"\",\n    \"custom_int1\": null,\n    \"custom_int2\": null,\n    \"custom_int3\": null,\n    \"custom_int4\": null,\n    \"custom_int5\": null\n}\n```\nThis request returns something like this\n```json\n{\n    \"amount\": \"99.99\",\n    \"item_name\": \"Premium Subscription\",\n    \"item_description\": \"1 month premium access\",\n    \"name_first\": \"\",\n    \"name_last\": \"\",\n    \"email_address\": \"your.email@gmail.com\",\n    \"m_payment_id\": \"3a280ceb-344c-48d1-8e9c-7945f3f1194a\",\n    \"payfast_url\": \"http://127.0.0.1:2000/payments/checkout/2\"\n}\n```\n\n__if you are using a frontend app like REACTJS just redirect to 'payfast_url'__\n\nAfter the completion of this payment payfast will redirect to complete endpoint or cancelled endpoint\n\n\n### Steps Taken Using Query Parameters (To make it dynamic)\n\n#### Example 1: E-commerce Checkout\n\n```python\n# views.py\nfrom django.shortcuts import redirect, reverse\nfrom urllib.parse import urlencode\nfrom .models import Order\n\ndef process_order_checkout(request, order_id):\n    \"\"\"\n    Process order and redirect to PayFast checkout\n    \"\"\"\n    order = Order.objects.get(id=order_id, user=request.user)\n    \n    # Calculate total\n    total = order.calculate_total()\n    \n    # Build item description\n    items = ', '.join([f\"{item.quantity}x {item.product.name}\" \n                       for item in order.items.all()])\n    \n    params = urlencode({\n        'amount': total,\n        'item_name': f'Order #{order.id}',\n        'item_description': items,\n        'custom_str1': f'order_{order.id}',\n        'custom_int1': order.items.count(),\n        'email_address': request.user.email,\n    })\n    \n    url = f\"{reverse('payfast:checkout')}?{params}\"\n    return redirect(url)\n```\n\n## Changelog\n\n[See release notes on Read the Docs](history/2_7_0/).\n\n\u003c!-- This link *will* get stale again eventually. There should be an index page for the\n     changelog that can be linked to.\n\n     For example:\n     https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#section-index-pages --\u003e\n\n## Funding and Support\n\n\u003c!-- \u003ca href=\"https://payfast.io\"\u003e\n  \u003cimg alt=\"Payfast Logo\" src=\"https://github.com/Carrington-dev/dj-payfast/blob/main/assets/img/payfast.webp\" width=\"250px\" /\u003e\n\u003c/a\u003e --\u003e\n[![payfast Verified Partner](https://img.shields.io/static/v1?label=payfast\u0026message=Verified%20Partner\u0026color=red\u0026style=for-the-badge)](https://payfast.com/docs/libraries#community-libraries)\n\u003cbr\u003e\n\nYou can now become a sponsor to dj-payfast with [GitHub Sponsors](https://github.com/sponsors/dj-payfast).\n\nWe've been bringing dj-payfast to the world for over 10 years and are excited to be able to start\ndedicating some real resources to the project.\n\nYour sponsorship helps us keep a team of maintainers actively working to improve dj-payfast and\nensure it stays up-to-date with the latest payfast changes. If you use dj-payfast commercially, we would encourage you to invest in its continued\ndevelopment by [signing up for a paid plan](https://github.com/sponsors/dj-payfast).\nCorporate sponsors [receive priority support and development time](project/support.md).\n\nAll contributions through GitHub sponsors flow into our [Open Collective](https://opencollective.com/dj-payfast), which holds our funds and keeps\nan open ledger on how donations are spent.\n\n## Our Gold sponsors\n\n[![payfast Verified Partner](https://img.shields.io/static/v1?label=payfast\u0026message=Verified%20Partner\u0026color=red\u0026style=for-the-badge)](https://payfast.com/docs/libraries#community-libraries)\n\u003cbr\u003e\n\n\u003c!--   \u003cimg alt=\"Stemgon Logo\" src=\"./logos/payfast_blurple.svg\" width=\"250px\" /\u003e --\u003e\n\u003c!-- \u003ca href=\"https://payfast.io\"\u003e\n  \u003cimg alt=\"Payfast Logo\" src=\"https://github.com/Carrington-dev/dj-payfast/blob/main/assets/img/payfast.webp\" width=\"250px\" /\u003e\n\u003c/a\u003e --\u003e\n\n## Similar libraries\n\n-   [dj-paypal](https://github.com/HearthSim/dj-paypal)\n    ([PayPal](https://www.paypal.com/))\n-   [dj-paddle](https://github.com/paddle-python/dj-paddle)\n    ([Paddle](https://paddle.com/))\n","funding_links":["https://github.com/sponsors/stemgon","https://github.com/sponsors/khanoit","https://www.paypal.com/ncp/payment/D7J7QSRR3WQFA","https://khanoit.co.za/support-me","https://buymeacoffee.com/crn96mmu","https://github.com/sponsors/dj-payfast","https://opencollective.com/dj-payfast","https://www.paypal.com/"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarrington-dev%2Fdj-payfast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarrington-dev%2Fdj-payfast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarrington-dev%2Fdj-payfast/lists"}