Razorpay integration error on python django
Unrecognized feature:
'otp-credentials'. error occured in browser console while razorpay integration and Method Not Allowed (POST): /checkout/ in terminal
[TerminalBrowser Console](https://i.sstatic.net/Kn6QfxTG.png)
HTML script and button already loaded above
<script>
var options = {
"key": "rzp_test_THuJCWTGTSyCOm", // Enter the Key ID generated from the Dashboard
"amount": "{{ razoramount }}", // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise
"currency": "INR",
"name": "Anasulfiros", //your business name
"description": "Purchase Product",
"order_id": "{{ order_id }}", //This is a sample Order ID. Pass the `id` obtained in the response of Step 1
"handler": function(response){
console.log("success")
var form = document.getElementById("myform");
// alert(form.elements["custid"].value);
// alert(response.razorpay_payment_id);
// alert(response.razorpay_order_id);
// alert(response.razorpay_signature);
window.location.href = "http://localhost:8000/paymentdone?order_id=${response.razorpay_order_id}&payment_id=${response.razorpay_payment_id}&cust_id=${form.elements["custid"].value}"
},
"theme": {
"color": "#3399cc"
}
};
var rzp1 = new Razorpay(options);
rzp1.on('payment.failed',function(response){
alert(response.error.description);
});
document.getElementById('rzp-button1').onclick = function(e){
console.log("button click");
rzp1.open();
e.preventDefault();
}
</script>
{% endblock payment-gateway %}
views
class checkout(View):
def get(self,request):
user = request.user
add = Customer.objects.filter(user=user)
cart_items=Cart.objects.filter(user=user)
famount = 0
for p in cart_items:
value = p.quantity * p.product.discounted_price
famount = famount + value
totalamount = famount + 40
razoramount = int(totalamount * 100)
client = razorpay.Client(auth=(settings.RAZOR_KEY_ID, settings.RAZOR_KEY_SECRET))
data = {"amount":razoramount,"currency":"INR","receipt":"order_rcptid_12"}
client.set_app_details({"title" : "Django", "version" : "1.8.17"})
payment_response = client.order.create(data=data)
print(payment_response)
order_id = payment_response['id']
order_status = payment_response['status']
if order_status == 'created':
payment = Payment(
user=user,
amount=totalamount,
razorpay_order_id=order_id,
razorpay_payment_status = order_status
)
payment.save()
return render(request,'app/checkout.html',locals())
Please help me to find solution