There are two ways you can handle a failed charge:
When an auto-charge fails, you can manually attempt to charge the invoice as long as the invoice is in the
For example, the customer's account might have insufficient balance when the auto-charge is attempted. When they receive the payment failure email, they add money to their account and inform you about this. You can now attempt a manual charge on the invoice.
An authentication charge of ₹5 is made to authenticate the card. Once the manual charge is successful, the customer receives an email and you receive a webhook.
If you have the
subscription.halted webhook events enabled, you receive notifications every time a subscription moves to one of these states. You can then decide to hold off the delivery of the service as per your business model. We also send an email to the customer notifying them about the payment failure. This email contains a link that the customer can use to change the card that is associated with the subscription.
When an auto-charge fails, we send the customer an email about the payment failure. This email has a link that the customer can use to change the card linked to the subscription.
You can ask the customer to do this as well.
You can ask the customer to change the card linked to the subscription via your checkout using our APIs. Use the
subscription_card_change parameter to control this feature:
- 1 = Allow the customer to change the card from your checkout
- 0 = Do not allow the customer to change the card from your checkout
Handler Function vs Callback URL:
- Handler Function:
When you use the handler function, the response object of the successful payment (
razorpay_signature) is submitted to the Checkout Form. You need to collect these and send them to your server.
- Callback URL:
When you use a Callback URL, the response object of the successful payment (
razorpay_signature) is submitted to the Callback URL.
You can use our ready-made hosted page solution to handle payment failures when an auto-charge is attempted. Here is how the hosted page handles payment failure:
- The customer is notified via email about the payment failure.
- The payment failure email contains a link that allows the customer to take further action on the failed payment.
- The action could either be retrying the payment on the same card or updating the card, both of which are handled seamlessly by the hosted page.
A sample hosted page is shown below:
To use our Hosted Page solution, pass
1 against the
customer_notify parameter (that is,
customer_notify=1) when creating the subscription via APIs.
Refer to the API reference page for more information.