File: /var/www/html/owlcrm/resources/views/subscriptions/checkout.blade.php
<!DOCTYPE html>
<html>
<head>
<title>Razorpay Subscription Checkout</title>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
</head>
<body>
<button id="pay-button">Subscribe</button>
<script>
// 1 ajax with plan id
// chek on fuction if user login
// 1 ajax responce suscription id
const options = {
key: "{{ $key }}",
subscription_id: "{{ $subscription_id }}",
name: "Your Company Name",
description: "Subscription for premium features",
prefill: {
name: "{{ $user['name'] }}",
email: "{{ $user['email'] }}",
contact: "{{ $user['contact'] }}"
},
handler: function (response) {
alert('Subscription successful! Payment ID: ' + response.razorpay_payment_id);
},
modal: {
ondismiss: function () {
alert('Payment canceled.');
}
}
};
const rzp = new Razorpay(options);
document.getElementById('pay-button').onclick = function (e) {
rzp.open();
e.preventDefault();
};
</script>
</body>
</html>