title: 'NoneType' object is not subscriptable in django rest framework
body: <p>Im trying to receive data in json format in django restframework and utilize the data immediately but i realize i get error that 'NoneType' object is not subscriptable' and i feel that i need to use cleaned_data but i dont know how to use cleaned_data in rest framework...here is my code:</p>
  <pre><code>@api_view(['GET', &quot;POST&quot;])
  def home(request):
      if request.method == 'POST':     
          name = request.data.get('name')
          email = request.data.get(&quot;email&quot;)
          amount = request.data.get(&quot;amount&quot;)
          phone = request.data.get(&quot;phone&quot;)
  
          return redirect(str(process_payment(name, email, amount, phone)))
      else:    
          responseData = {  
              &quot;Homepage&quot;: &quot;Payment&quot;
          }
          return Response(responseData)
  </code></pre>
  <p>Here is my traceback error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/core/handlers/exception.py&quot;, line 47, in inner
      response = get_response(request)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/core/handlers/base.py&quot;, line 181, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/views/decorators/csrf.py&quot;, line 54, in wrapped_view
      return view_func(*args, **kwargs)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/views/generic/base.py&quot;, line 70, in view
      return self.dispatch(request, *args, **kwargs)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/rest_framework/views.py&quot;, line 509, in dispatch
      response = self.handle_exception(exc)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/rest_framework/views.py&quot;, line 469, in handle_exception
      self.raise_uncaught_exception(exc)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/rest_framework/views.py&quot;, line 480, in raise_uncaught_exception
      raise exc
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/rest_framework/views.py&quot;, line 506, in dispatch
      response = handler(request, *args, **kwargs)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/rest_framework/decorators.py&quot;, line 50, in handler
      return func(*args, **kwargs)
    File &quot;/Users/williamdapper/Desktop/payment/electronics/views.py&quot;, line 21, in home
      return redirect(process_payment(name, email, amount, phone))
    File &quot;/Users/williamdapper/Desktop/payment/electronics/views.py&quot;, line 55, in process_payment
      link=response['data']['link']
  TypeError: 'NoneType' object is not subscriptable
  [11/Oct/2021 15:19:25] &quot;POST / HTTP/1.1&quot; 500 95799
  </code></pre>
  <p>[That is the image of the error im getting below][1]
  [1]: https://i.stack.imgur.com/wkOwa.png</p>