here this is my form that getting submited.
`<form id="payment-form" action="{{ route('buyingProduct') }}" method="POST">
<input type="hidden" name="product" id="product" value="{{ $cart->Product_id }}">
@csrf
<input type="hidden" name="final-Price" id="final-price" value="">
<input type="hidden" name="razorpay_order_id" id="razorpay_order_id" value="">
<input type="hidden" name="razorpay_payment_id" id="razorpay_payment_id" value="">
<input type="hidden" name="total_price" id="total_price" value="">
</form>
<button id="pay-button" class="btn btn-block btn-primary" onclick="submitPaymentForm()">Pay</button> `
this is form i am using in my project in cart.blade.php page , here i am using razorpay payment system in myproject.now i am getting payment-id from the form, but i am not getting ‘order-id’. here On click of that button Below Script will be executed
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script>
function submitPaymentForm() {
var form = document.getElementById('payment-form');
var name = document.getElementById('product-name');
var amount = document.getElementById('final-price').value * 100;
var options = {
key: '{{ env("RAZORPAY_KEY") }}',
amount: amount,
name: name,
description: 'test',
image: 'test',
prefill: {
name: '{{ auth()->user()->name }}',
email: '{{ auth()->user()->email }}'
},
theme: {
color: '#ff7529'
},
"handler": function (response){
console.log(response);
document.getElementById('razorpay_order_id').value = response.razorpay_order_id;
document.getElementById('razorpay_payment_id').value = response.razorpay_payment_id;
document.getElementById('final-price').value = amount / 100;
document.getElementById('payment-form').submit();
},
};
var rzp1 = new Razorpay(options);
rzp1.on('payment.failed', function(response){
console.log(response.error.code);
console.log(response.error.description);
console.log(response.error.source);
console.log(response.error.step);
console.log(response.error.reason);
console.log(response.error.metadata.order_id);
console.log(response.error.metadata.payment_id);
});
rzp1.open();
}
</script>
from above form i am not getting value of ‘Order-id’ in response.razorpayorder_id