├── .gitignore ├── Pipfile ├── Pipfile.lock ├── README.md ├── manage.py └── payment_integration ├── __init__.py ├── apps ├── __init__.py └── razorpay_integration │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── constants.py │ ├── migrations │ ├── 0001_initial.py │ ├── 0002_alter_order_status.py │ └── __init__.py │ ├── models.py │ ├── templates │ ├── base.html │ ├── callback.html │ ├── index.html │ └── payment.html │ ├── tests.py │ ├── urls.py │ └── views.py └── config ├── __init__.py ├── settings ├── __init__.py └── django.py ├── urls.py └── wsgi.py /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | db.sqlite3 3 | -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | django = "*" 8 | razorpay = "*" 9 | black = "*" 10 | ipdb = "*" 11 | django-environ = "*" 12 | 13 | [dev-packages] 14 | 15 | [requires] 16 | python_version = "3.8" 17 | -------------------------------------------------------------------------------- /Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "9d31c3a27770b5a5c215ec2de6bc20f025ffba3557409f8454755b5b6e0ea475" 5 | }, 6 | "pipfile-spec": 6, 7 | "requires": { 8 | "python_version": "3.8" 9 | }, 10 | "sources": [ 11 | { 12 | "name": "pypi", 13 | "url": "https://pypi.org/simple", 14 | "verify_ssl": true 15 | } 16 | ] 17 | }, 18 | "default": { 19 | "asgiref": { 20 | "hashes": [ 21 | "sha256:4ef1ab46b484e3c706329cedeff284a5d40824200638503f5768edb6de7d58e9", 22 | "sha256:ffc141aa908e6f175673e7b1b3b7af4fdb0ecb738fc5c8b88f69f055c2415214" 23 | ], 24 | "markers": "python_version >= '3.6'", 25 | "version": "==3.4.1" 26 | }, 27 | "asttokens": { 28 | "hashes": [ 29 | "sha256:0844691e88552595a6f4a4281a9f7f79b8dd45ca4ccea82e5e05b4bbdb76705c", 30 | "sha256:9a54c114f02c7a9480d56550932546a3f1fe71d8a02f1bc7ccd0ee3ee35cf4d5" 31 | ], 32 | "version": "==2.0.5" 33 | }, 34 | "backcall": { 35 | "hashes": [ 36 | "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e", 37 | "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255" 38 | ], 39 | "version": "==0.2.0" 40 | }, 41 | "backports.zoneinfo": { 42 | "hashes": [ 43 | "sha256:17746bd546106fa389c51dbea67c8b7c8f0d14b5526a579ca6ccf5ed72c526cf", 44 | "sha256:1b13e654a55cd45672cb54ed12148cd33628f672548f373963b0bff67b217328", 45 | "sha256:1c5742112073a563c81f786e77514969acb58649bcdf6cdf0b4ed31a348d4546", 46 | "sha256:4a0f800587060bf8880f954dbef70de6c11bbe59c673c3d818921f042f9954a6", 47 | "sha256:5c144945a7752ca544b4b78c8c41544cdfaf9786f25fe5ffb10e838e19a27570", 48 | "sha256:7b0a64cda4145548fed9efc10322770f929b944ce5cee6c0dfe0c87bf4c0c8c9", 49 | "sha256:8439c030a11780786a2002261569bdf362264f605dfa4d65090b64b05c9f79a7", 50 | "sha256:8961c0f32cd0336fb8e8ead11a1f8cd99ec07145ec2931122faaac1c8f7fd987", 51 | "sha256:89a48c0d158a3cc3f654da4c2de1ceba85263fafb861b98b59040a5086259722", 52 | "sha256:a76b38c52400b762e48131494ba26be363491ac4f9a04c1b7e92483d169f6582", 53 | "sha256:da6013fd84a690242c310d77ddb8441a559e9cb3d3d59ebac9aca1a57b2e18bc", 54 | "sha256:e55b384612d93be96506932a786bbcde5a2db7a9e6a4bb4bffe8b733f5b9036b", 55 | "sha256:e81b76cace8eda1fca50e345242ba977f9be6ae3945af8d46326d776b4cf78d1", 56 | "sha256:e8236383a20872c0cdf5a62b554b27538db7fa1bbec52429d8d106effbaeca08", 57 | "sha256:f04e857b59d9d1ccc39ce2da1021d196e47234873820cbeaad210724b1ee28ac", 58 | "sha256:fadbfe37f74051d024037f223b8e001611eac868b5c5b06144ef4d8b799862f2" 59 | ], 60 | "markers": "python_version < '3.9'", 61 | "version": "==0.2.1" 62 | }, 63 | "black": { 64 | "hashes": [ 65 | "sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3", 66 | "sha256:a615e69ae185e08fdd73e4715e260e2479c861b5740057fde6e8b4e3b7dd589f" 67 | ], 68 | "index": "pypi", 69 | "version": "==21.12b0" 70 | }, 71 | "certifi": { 72 | "hashes": [ 73 | "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872", 74 | "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569" 75 | ], 76 | "version": "==2021.10.8" 77 | }, 78 | "charset-normalizer": { 79 | "hashes": [ 80 | "sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721", 81 | "sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c" 82 | ], 83 | "markers": "python_version >= '3'", 84 | "version": "==2.0.9" 85 | }, 86 | "click": { 87 | "hashes": [ 88 | "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3", 89 | "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b" 90 | ], 91 | "markers": "python_version >= '3.6'", 92 | "version": "==8.0.3" 93 | }, 94 | "decorator": { 95 | "hashes": [ 96 | "sha256:7b12e7c3c6ab203a29e157335e9122cb03de9ab7264b137594103fd4a683b374", 97 | "sha256:e59913af105b9860aa2c8d3272d9de5a56a4e608db9a2f167a8480b323d529a7" 98 | ], 99 | "markers": "python_version >= '3.5'", 100 | "version": "==5.1.0" 101 | }, 102 | "django": { 103 | "hashes": [ 104 | "sha256:59304646ebc6a77b9b6a59adc67d51ecb03c5e3d63ed1f14c909cdfda84e8010", 105 | "sha256:d5a8a14da819a8b9237ee4d8c78dfe056ff6e8a7511987be627192225113ee75" 106 | ], 107 | "index": "pypi", 108 | "version": "==4.0" 109 | }, 110 | "executing": { 111 | "hashes": [ 112 | "sha256:32fc6077b103bd19e6494a72682d66d5763cf20a106d5aa7c5ccbea4e47b0df7", 113 | "sha256:c23bf42e9a7b9b212f185b1b2c3c91feb895963378887bb10e64a2e612ec0023" 114 | ], 115 | "version": "==0.8.2" 116 | }, 117 | "idna": { 118 | "hashes": [ 119 | "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", 120 | "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d" 121 | ], 122 | "markers": "python_version >= '3'", 123 | "version": "==3.3" 124 | }, 125 | "ipdb": { 126 | "hashes": [ 127 | "sha256:951bd9a64731c444fd907a5ce268543020086a697f6be08f7cc2c9a752a278c5" 128 | ], 129 | "index": "pypi", 130 | "version": "==0.13.9" 131 | }, 132 | "ipython": { 133 | "hashes": [ 134 | "sha256:570b813470ffd4b807ec84103844a18fe9558b5e3c096d8774c2364707fbda00", 135 | "sha256:72d45dc63bdd630c36d07259e9d9572b391229a0686ff2349e00c67fadd276e3" 136 | ], 137 | "markers": "python_version >= '3.8'", 138 | "version": "==8.0.0a1" 139 | }, 140 | "jedi": { 141 | "hashes": [ 142 | "sha256:637c9635fcf47945ceb91cd7f320234a7be540ded6f3e99a50cb6febdfd1ba8d", 143 | "sha256:74137626a64a99c8eb6ae5832d99b3bdd7d29a3850fe2aa80a4126b2a7d949ab" 144 | ], 145 | "markers": "python_version >= '3.6'", 146 | "version": "==0.18.1" 147 | }, 148 | "matplotlib-inline": { 149 | "hashes": [ 150 | "sha256:a04bfba22e0d1395479f866853ec1ee28eea1485c1d69a6faf00dc3e24ff34ee", 151 | "sha256:aed605ba3b72462d64d475a21a9296f400a19c4f74a31b59103d2a99ffd5aa5c" 152 | ], 153 | "markers": "python_version >= '3.5'", 154 | "version": "==0.1.3" 155 | }, 156 | "mypy-extensions": { 157 | "hashes": [ 158 | "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", 159 | "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8" 160 | ], 161 | "version": "==0.4.3" 162 | }, 163 | "parso": { 164 | "hashes": [ 165 | "sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0", 166 | "sha256:c001d4636cd3aecdaf33cbb40aebb59b094be2a74c556778ef5576c175e19e75" 167 | ], 168 | "markers": "python_version >= '3.6'", 169 | "version": "==0.8.3" 170 | }, 171 | "pathspec": { 172 | "hashes": [ 173 | "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a", 174 | "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1" 175 | ], 176 | "version": "==0.9.0" 177 | }, 178 | "pexpect": { 179 | "hashes": [ 180 | "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937", 181 | "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c" 182 | ], 183 | "markers": "sys_platform != 'win32'", 184 | "version": "==4.8.0" 185 | }, 186 | "pickleshare": { 187 | "hashes": [ 188 | "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", 189 | "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56" 190 | ], 191 | "version": "==0.7.5" 192 | }, 193 | "platformdirs": { 194 | "hashes": [ 195 | "sha256:367a5e80b3d04d2428ffa76d33f124cf11e8fff2acdaa9b43d545f5c7d661ef2", 196 | "sha256:8868bbe3c3c80d42f20156f22e7131d2fb321f5bc86a2a345375c6481a67021d" 197 | ], 198 | "markers": "python_version >= '3.6'", 199 | "version": "==2.4.0" 200 | }, 201 | "prompt-toolkit": { 202 | "hashes": [ 203 | "sha256:1bb05628c7d87b645974a1bad3f17612be0c29fa39af9f7688030163f680bad6", 204 | "sha256:e56f2ff799bacecd3e88165b1e2f5ebf9bcd59e80e06d395fa0cc4b8bd7bb506" 205 | ], 206 | "markers": "python_full_version >= '3.6.2'", 207 | "version": "==3.0.24" 208 | }, 209 | "ptyprocess": { 210 | "hashes": [ 211 | "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35", 212 | "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220" 213 | ], 214 | "version": "==0.7.0" 215 | }, 216 | "pure-eval": { 217 | "hashes": [ 218 | "sha256:0f04483b16c9429532d2c0ddc96e2b3bb6b2dc37a2bfb0e986248dbfd0b78873", 219 | "sha256:94eeb505a88721bec7bb21a4ac49758b8b1a01530da1a70d4ffc1d9937689d71" 220 | ], 221 | "version": "==0.2.1" 222 | }, 223 | "pygments": { 224 | "hashes": [ 225 | "sha256:b8e67fe6af78f492b3c4b3e2970c0624cbf08beb1e493b2c99b9fa1b67a20380", 226 | "sha256:f398865f7eb6874156579fdf36bc840a03cab64d1cde9e93d68f46a425ec52c6" 227 | ], 228 | "markers": "python_version >= '3.5'", 229 | "version": "==2.10.0" 230 | }, 231 | "razorpay": { 232 | "hashes": [ 233 | "sha256:0bea9e11aca8024af0cd741b779cb6d3b0a689a8488e21b5e4b345f8840a0fe4", 234 | "sha256:8bae5ba6e3d8c7aebf7e4b297d15dfdb4a4b05e6fabd8d56405ac0d2677539bd" 235 | ], 236 | "index": "pypi", 237 | "version": "==1.2.0" 238 | }, 239 | "requests": { 240 | "hashes": [ 241 | "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24", 242 | "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7" 243 | ], 244 | "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", 245 | "version": "==2.26.0" 246 | }, 247 | "six": { 248 | "hashes": [ 249 | "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", 250 | "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" 251 | ], 252 | "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", 253 | "version": "==1.16.0" 254 | }, 255 | "sqlparse": { 256 | "hashes": [ 257 | "sha256:0c00730c74263a94e5a9919ade150dfc3b19c574389985446148402998287dae", 258 | "sha256:48719e356bb8b42991bdbb1e8b83223757b93789c00910a616a071910ca4a64d" 259 | ], 260 | "markers": "python_version >= '3.5'", 261 | "version": "==0.4.2" 262 | }, 263 | "stack-data": { 264 | "hashes": [ 265 | "sha256:5cb2aff8164a81901160078ea2f5e39de978f08c96ac69e552a5c5345f892a81", 266 | "sha256:e3f4e54cde03af62e9afd680b3407d38f2e4f3d0e23c3d53371c088c9bea299d" 267 | ], 268 | "version": "==0.1.3" 269 | }, 270 | "toml": { 271 | "hashes": [ 272 | "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", 273 | "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f" 274 | ], 275 | "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", 276 | "version": "==0.10.2" 277 | }, 278 | "tomli": { 279 | "hashes": [ 280 | "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f", 281 | "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c" 282 | ], 283 | "markers": "python_version >= '3.6'", 284 | "version": "==1.2.3" 285 | }, 286 | "traitlets": { 287 | "hashes": [ 288 | "sha256:059f456c5a7c1c82b98c2e8c799f39c9b8128f6d0d46941ee118daace9eb70c7", 289 | "sha256:2d313cc50a42cd6c277e7d7dc8d4d7fedd06a2c215f78766ae7b1a66277e0033" 290 | ], 291 | "markers": "python_version >= '3.7'", 292 | "version": "==5.1.1" 293 | }, 294 | "typing-extensions": { 295 | "hashes": [ 296 | "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e", 297 | "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b" 298 | ], 299 | "markers": "python_version >= '3.6'", 300 | "version": "==4.0.1" 301 | }, 302 | "urllib3": { 303 | "hashes": [ 304 | "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece", 305 | "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844" 306 | ], 307 | "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", 308 | "version": "==1.26.7" 309 | }, 310 | "wcwidth": { 311 | "hashes": [ 312 | "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784", 313 | "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83" 314 | ], 315 | "version": "==0.2.5" 316 | } 317 | }, 318 | "develop": {} 319 | } 320 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Razorpay Payment Integration in Django :boom: 2 | [](https://postimg.cc/21j4thSw) 3 | ### In this project Razorpay payment gateway 💳 is integrated with Django by breaking down the whole process into simple steps 🪜. 4 | - Setting up Razorpay account 5 | - Store the downloaded API keys in your .env file 6 | - Create the Order Schema 7 | - Creating Razorpay order 8 | - Making payment 9 | - Handling Successful and Failed payment. 10 | 11 | :bulb:To generate new API keys🗝️ signup on razorpay.com, visit the dashboard and generate:rocket: the API keys from the settings. 12 | 13 | 14 | ## Getting started: 15 | ### Clone this repository: 16 | ``` 17 | git clone https://github.com/scalereal/razorpay-integration-django.git 18 | ``` 19 | ### Install pipenv 20 | ``` 21 | pip install pipenv 22 | ``` 23 | ### Activate environment: 24 | ``` 25 | pipenv shell 26 | ``` 27 | ### Install dependencies: 28 | ``` 29 | pipenv install 30 | ``` 31 | ### Start the server: 32 | ``` 33 | python manage.py runserver 34 | ``` 35 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault( 9 | "DJANGO_SETTINGS_MODULE", "payment_integration.config.settings.django" 10 | ) 11 | try: 12 | from django.core.management import execute_from_command_line 13 | except ImportError as exc: 14 | raise ImportError( 15 | "Couldn't import Django. Are you sure it's installed and " 16 | "available on your PYTHONPATH environment variable? Did you " 17 | "forget to activate a virtual environment?" 18 | ) from exc 19 | execute_from_command_line(sys.argv) 20 | 21 | 22 | if __name__ == "__main__": 23 | main() 24 | -------------------------------------------------------------------------------- /payment_integration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scalereal/razorpay-integration-django/e6f681a8d0e00cc87a422ae7b112a92b7abff0b1/payment_integration/__init__.py -------------------------------------------------------------------------------- /payment_integration/apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scalereal/razorpay-integration-django/e6f681a8d0e00cc87a422ae7b112a92b7abff0b1/payment_integration/apps/__init__.py -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scalereal/razorpay-integration-django/e6f681a8d0e00cc87a422ae7b112a92b7abff0b1/payment_integration/apps/razorpay_integration/__init__.py -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Order 3 | 4 | # Register your models here. 5 | admin.site.register(Order) 6 | -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class RazorpayIntegrationConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'razorpay_integration' 7 | -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/constants.py: -------------------------------------------------------------------------------- 1 | class PaymentStatus: 2 | SUCCESS = "Success" 3 | FAILURE = "Failure" 4 | PENDING = "Pending" 5 | -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.9 on 2021-12-08 16:58 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Order', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=254, verbose_name='Customer Name')), 19 | ('amount', models.FloatField(verbose_name='Amount')), 20 | ('status', models.CharField(max_length=254, verbose_name='Payment Status')), 21 | ('provider_order_id', models.CharField(max_length=40, verbose_name='Order ID')), 22 | ('payment_id', models.CharField(max_length=36, verbose_name='Payment ID')), 23 | ('signature_id', models.CharField(max_length=128, verbose_name='Signature ID')), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/migrations/0002_alter_order_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0 on 2021-12-09 19:45 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('razorpay_integration', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='order', 15 | name='status', 16 | field=models.CharField(default='Pending', max_length=254, verbose_name='Payment Status'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scalereal/razorpay-integration-django/e6f681a8d0e00cc87a422ae7b112a92b7abff0b1/payment_integration/apps/razorpay_integration/migrations/__init__.py -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.db.models.fields import CharField 3 | from django.utils.translation import gettext_lazy as _ 4 | from .constants import PaymentStatus 5 | 6 | 7 | class Order(models.Model): 8 | name = CharField(_("Customer Name"), max_length=254, blank=False, null=False) 9 | amount = models.FloatField(_("Amount"), null=False, blank=False) 10 | status = CharField( 11 | _("Payment Status"), 12 | default=PaymentStatus.PENDING, 13 | max_length=254, 14 | blank=False, 15 | null=False, 16 | ) 17 | provider_order_id = models.CharField( 18 | _("Order ID"), max_length=40, null=False, blank=False 19 | ) 20 | payment_id = models.CharField( 21 | _("Payment ID"), max_length=36, null=False, blank=False 22 | ) 23 | signature_id = models.CharField( 24 | _("Signature ID"), max_length=128, null=False, blank=False 25 | ) 26 | 27 | def __str__(self): 28 | return f"{self.id}-{self.name}-{self.status}" 29 | -------------------------------------------------------------------------------- /payment_integration/apps/razorpay_integration/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 |