{"id":14972885,"url":"https://github.com/101loop/drf_paytm","last_synced_at":"2025-10-26T20:32:12.507Z","repository":{"id":57424080,"uuid":"160660689","full_name":"101Loop/drf_paytm","owner":"101Loop","description":"PayTM Integration based on Django REST Framework","archived":false,"fork":false,"pushed_at":"2019-06-13T15:17:18.000Z","size":34,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T00:14:45.586Z","etag":null,"topics":["django","django-application","django-payments","django-rest-framework","django2","himanshu-shankar","payment-request","paytm","paytm-api","paytm-app","paytm-merchant","paytm-payments","paytmsdk","transaction"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/101Loop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-06T10:47:41.000Z","updated_at":"2023-01-20T06:28:32.000Z","dependencies_parsed_at":"2022-09-14T08:40:13.081Z","dependency_job_id":null,"html_url":"https://github.com/101Loop/drf_paytm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/101Loop%2Fdrf_paytm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/101Loop%2Fdrf_paytm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/101Loop%2Fdrf_paytm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/101Loop%2Fdrf_paytm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/101Loop","download_url":"https://codeload.github.com/101Loop/drf_paytm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238397209,"owners_count":19465134,"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","django-application","django-payments","django-rest-framework","django2","himanshu-shankar","payment-request","paytm","paytm-api","paytm-app","paytm-merchant","paytm-payments","paytmsdk","transaction"],"created_at":"2024-09-24T13:47:41.484Z","updated_at":"2025-10-26T20:32:07.200Z","avatar_url":"https://github.com/101Loop.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PayTM | Django REST Framework\n\n**A package for PayTM integration in Django REST Framework**\u003cbr\u003e\n\n`PayTM | Django REST Framework` is a Django packaged app that provides necessary `views` based in Django REST Framework.\nIt enables easy integration of PayTM Payment Gateway with Web/Mobile Application with a RESTful API based server.\n\nContributors: **WE'RE LOOKING FOR SOMEONE WHO CAN CONTRIBUTE IN DOCS**\n- **[Civil Machines Technologies Private Limited](https://github.com/civilmahines)**: For providing me platform and\nfunds for research work. This project is hosted currently with `CMT` only. \n- **[Himanshu Shankar](https://github.com/iamhssingh)**: Himanshu Shankar has initiated this project and worked on this\nproject to collect useful functions and classes that are being used in various projects.\n\n#### Installation\n\n- Download and Install via `pip`\n```\npip install drf_paytm\n```\nor\u003cbr\u003e\nDownload and Install via `easy_install`\n```\neasy_install drf_paytm\n```\n- Add, if wanted, `drfaddons` in `INSTALLED_APPS` (This is although not required!)\n```\nINSTALLED_APPS = [\n    ...\n    'drf_paytm',\n    ...\n]\n```\n- Also add other dependencies in `INSTALLED_APPS`\u003cbr\u003e\n```\nINSTALLED_APPS = [\n    ...\n    'drfaddons',\n    ...\n]\n```\n- Include urls of `drf_paytm` in `urls.py`\n```\nurlpatterns = [\n    ...\n    path('api/paytm/', include('drf_paytm.urls')),\n    ...\n]\n\n# or\n\nurlpatterns = [\n    ...\n    url(r'^api/paytm/', include('drf_paytm.urls')),\n    ...\n]\n```\n- Run migrate command:\n```\npython manage.py migrate\n```\n\n### Frontend API Integration Guideline\n1. Prepare `json` data to post on `request/` view: `{\"oid\": \"ORDER_ID\", \"amount\": \"200\", \"callback_url\": \"FRONT_END APP URL\"}`\n2. `callback_url`: FrontEnd URL to open when payment is successful. Must not have any queryset as `?oid=ORDER_ID` is \nappended.\n3. Post to `request/` and parse response to prepare a HTML form as per code shown below.\n4. Don't add `\u003cinput\u003e` for empty and `null` fields from json response of `request/` API.\n5. Set `CALLBACK_URL` in HTML from `paytm_callback_url` of JSON.\n6. Once the payment is done, user is redirected to `response/` view which will verify payment.\n7. If payment is verified by Django Backend, user is redirected to `http://callback_url?oid=ORDER_ID`.\n8. Access `order/ORDER_ID/` API to get `is_completed` status. If it's `false`, check `last_payment_status`.\n\n**Note: In case of critical failure, server's JSON response is shown.**\n\nSample HTML Code to be generated by FrontEnd App(from PayTM)\n```\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003ctitle\u003eMerchant Check Out Page\u003c/title\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003ccenter\u003e\u003ch1\u003ePlease do not refresh this page...\u003c/h1\u003e\u003c/center\u003e\n        \u003cform method=\"post\" action=\"https://securegw-stage.paytm.in/theia/processTransaction\" name=\"f1\"\u003e\n            \u003ctable border=\"1\"\u003e\n                \u003ctbody\u003e\n                    \u003cinput type=\"hidden\" name=\"MID\" value=\"rxazcv89315285244163\"\u003e\n                    \u003cinput type=\"hidden\" name=\"WEBSITE\" value=\"WEBSTAGING\"\u003e\n                    \u003cinput type=\"hidden\" name=\"ORDER_ID\" value=\"order1\"\u003e\n                    \u003cinput type=\"hidden\" name=\"CUST_ID\" value=\"cust123\"\u003e\n                    \u003cinput type=\"hidden\" name=\"MOBILE_NO\" value=\"7777777777\"\u003e\n                    \u003cinput type=\"hidden\" name=\"EMAIL\" value=\"username@emailprovider.com\"\u003e\n                    \u003cinput type=\"hidden\" name=\"INDUSTRY_TYPE_ID\" value=\"Retail\"\u003e\n                    \u003cinput type=\"hidden\" name=\"CHANNEL_ID\" value=\"WEB\"\u003e\n                    \u003cinput type=\"hidden\" name=\"TXN_AMOUNT\" value=\"100.12\"\u003e\n                    \u003cinput type=\"hidden\" name=\"CALLBACK_URL\" value=\"https://Merchant_Response_URL\u003e\"\u003e\n                    \u003cinput type=\"hidden\" name=\"CHECKSUMHASH\" value=\"ZWdMJOr1yGiFh1nns2U8sDC9VzgUDHVnQpG\n                    pVnHyrrPb6bthwro1Z8AREUKdUR/K46x3XvFs6Xv7EnoSOLZT29qbZJKXXvyEuEWQIJGkw=\"\u003e\n                \u003c/tbody\u003e\n            \u003c/table\u003e\n        \u003cscript type=\"text/javascript\"\u003e\n            document.f1.submit();\n        \u003c/script\u003e\n        \u003c/form\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### MODELS\nThe application has three models:\n\n- `PayTMConfiguration`: You need to define your PayTM configurations in this model. Only one object can have\n`is_active` set to `True` which will be used with PayTM API.\n- `TransactionRequest`: This will contain all the PayTM Transaction Request that one will create with PayTM.\n- `TransactionResponse`: This will contain all the responses received from PayTM API against transaction.\n\n### VIEWS\nThe application has following views:\n\n- `ListAddTransactionRequestView`: All payment request should be made on this view. Requires a logged in user.\nIt'll provide user with required data, including `checksum hash` that will be used with PayTM API.\n- `AddTransactionResponseView`: Response from PayTM is posted on this view. URL for this view should go as \n`CALLBACK_URL`. This view then redirects user to FrontEnd app with `OID` as queryset parameter.\n- `PayNowTransaction`: This view is for testing w/o a frontend client. It will open PayTM payment page.\n\n### URLS\n- `request/`: All payment request to be made via this URL.\n- `response/`: All response from PayTM is posted on this URL.\n- `order/OID/`: Retrieve specific payment request data.\n- `now/`: For immediate testing of API, open this url.\n\n### Quickstart Guide\n\n- Complete `Installation Steps` (mentioned above)\n- Create a configuration via `Django Admin` in `PayTM Configuration`.\n- Provide `base_url` of your Backend Server.\n- Set `is_active` to `True`\n- Note: Use sandbox mode credential at first\n- Test API by accessing `/api/paytm/now/` endpoint\n- Use `PayTM Testing Credential`:\n```\nMobile: 7777777777\nOTP: 489871\nPassword: Paytm12345\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F101loop%2Fdrf_paytm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F101loop%2Fdrf_paytm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F101loop%2Fdrf_paytm/lists"}