// Example JavaScript code to integrate PhonePe const createPaymentRequest = async (amount, callbackUrl) => { const response = await fetch('https://api.phonepe.com/v3/transaction', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ amount: amount, callbackUrl: callbackUrl, merchantId: 'YOUR_MERCHANT_ID', transactionId: 'UNIQUE_TRANSACTION_ID' }) }); const data = await response.json(); return data; }; // Call this function when the user clicks the payment button document.getElementById('payButton').addEventListener('click', async () => { const amount = 100; // Amount in paise const callbackUrl = 'https://yourwebsite.com/payment-callback'; const paymentData = await createPaymentRequest(amount, callbackUrl); // Redirect user to PhonePe payment page window.location.href = paymentData.paymentUrl; });