title: Redirecting a user to checkout page in Django
body: <p>I want to redirect a user to checkout page that is automatically generated by the payment gateway. Anytime a user submits a request, the payment gateway returns a response in the format below. What i want to do is redirect the user to the checkout page to make payment.</p>
  <pre><code> &quot;status&quot;: true,
    &quot;message&quot;: &quot;Authorization URL created&quot;,
    &quot;data&quot;: {
      &quot;authorization_url&quot;: &quot;https://checkout.paystack.com/eddno1f6rf411p0&quot;,
      &quot;access_code&quot;: &quot;eddno1f6rf411p0&quot;,
      &quot;reference&quot;: &quot;bpozkels2v&quot;
  
  </code></pre>
  <pre><code>def paystack(request):
      url = 'https://api.paystack.co/transaction/initialize'
      transaction_id = random.randint(100000000000, 999999999999)
      data = {
              &quot;key&quot;: &quot;PUBLIC_KEY&quot;,
              &quot;ref&quot;: transaction_id,
              &quot;amount&quot;: &quot;000000000100&quot;,
              &quot;callback&quot;: f&quot;http://127.0.0.1:8000&quot;,
              &quot;email&quot;: &quot;email@me.com&quot;,
          }
      headers =  {
          'Content-Type': 'application/json',
          'Authorization': 'Bearer SECRET_KEY',
          'Cache-Control': 'no-cache'
      }
      res = requests.post(url, data=json.dumps(data), headers=headers)
      response_data = res.json()
      print(response_data[&quot;authorization_url&quot;])
      redirect(response_data[&quot;authorization_url&quot;])
  
  </code></pre>
  <p>The error i get is</p>
  <pre><code> KeyError at /paystack
  'authorization_url'
  
  </code></pre>