Django: return the response to view function

青春壹個敷衍的年華 提交于 2020-01-06 07:59:07

问题


I have html checkout from that returns success/failure response. I want to pass this response back to view function.

<html>
  <body>
    <button id="rzp-button">Authenticate</button>
    <script src="https://checkout.razorpay.com/v1/checkout.js"></script>
    <script>
      var options = {
        "key": "test_key",
        "subscription_id": "{{ sub_id }}",
        "name": "My Billing Label",
        "description": "Auth txn for sub_8seKGNhVEOwnjj",
        "handler": function (response){
          alert(response.razorpay_payment_id);
        }
      };
      var rzp1 = new Razorpay(options);
      document.getElementById('rzp-button').onclick = function(e){
        rzp1.open();
      }
    </script>
  </body>
</html>

I think I have to write something inside

  "handler": function (response){
              alert(response.razorpay_payment_id);
            }

to return to view with response. Could someone help me with this? Thanks.

来源:https://stackoverflow.com/questions/54846973/django-return-the-response-to-view-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!