भुगतान घटनाओं के होने पर स्वचालित रूप से पेशेवर लेनदेन ईमेल भेजें। Resend के विश्वसनीय ईमेल बुनियादी ढांचे और उत्कृष्ट डिलीवरबिलिटी दरों के साथ भुगतान पुष्टिकरण, सदस्यता अपडेट और महत्वपूर्ण सूचनाएं भेजें।
इस एकीकरण के लिए प्रमाणीकरण के लिए आपका Resend API कुंजी आवश्यक है।
function handler(webhook) { if (webhook.eventType === "subscription.active") { const s = webhook.payload.data; webhook.url = "https://api.resend.com/emails"; webhook.payload = { from: "[email protected]", to: [s.customer.email], subject: "Welcome to Your Subscription!", html: ` <h2>Welcome to Your Subscription!</h2> <p>Hi ${s.customer.name},</p> <p>Your subscription has been activated successfully.</p> <ul> <li><strong>Subscription ID:</strong> ${s.subscription_id}</li> <li><strong>Product:</strong> ${s.product_id}</li> <li><strong>Amount:</strong> $${(s.recurring_pre_tax_amount / 100).toFixed(2)}/${s.payment_frequency_interval}</li> <li><strong>Next Billing:</strong> ${new Date(s.next_billing_date).toLocaleDateString()}</li> </ul> <p>You can manage your subscription anytime from your account dashboard.</p> `, text: `Welcome! Your subscription is now active. Amount: $${(s.recurring_pre_tax_amount / 100).toFixed(2)}/${s.payment_frequency_interval}` }; } return webhook;}