Facebook Pixel

How do I handle failed payments?

Handle the payment.failed webhook: update the payment status to 'failed', store the failure reason and code, notify the user via email, and provide a retry endpoint that creates a new order. Users can retry the payment with the new order ID.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Handling Razorpay Refunds and Failed Payments in Node.js

Use razorpay.payments.refund(paymentId, { amount: payment.amount, notes: { reason } }). For a partial refund, specify a smaller amount. Update the payment status to 'refunded' in the database, store the refund ID, and revoke premium access if applicable.

Handle refund.processed (refund completed successfully update status and notify user) and refund.failed (refund could not be processed investigate and retry). Always verify the webhook signature before processing.

Create a new Razorpay order with the same amount: razorpay.orders.create({ amount, currency, receipt: 'retry_' + Date.now() }). Update the payment record with the new order ID and status 'created'. Return the new order ID to the frontend for a new checkout attempt.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.