Scope
I deleted an invoice by mistake. How do I restore it?
How to restore the deleted invoice?
How find the source through which the invoice was created (imported or scheduled activity)?
How to check the exchange rate using invoice content?
Summary
You can gather the deleted invoice data by navigating to the subscription details page > events > 'invoice deleted' event > Click on event id> Show V2 content.
Once you have the data of the deleted invoice, you can restore the deleted invoice in one of the two ways:
Import Invoice API for a single invoice
Bulk operation for multiple Invoices.
Solution
Firstly, we need to gather the details of the deleted invoice
Navigate to the Events from the Subscription detail page or from to Events Index page under logs.
Once we locate and open the Invoice Deleted event, click ‘Show V2 Content’
You can also check the exchange rate using the invoice content like given below.
Option 1: Import Invoice API
Step 1: Now, you have all the data to import the deleted invoice. Now, use import an invoice API. Refer to these links for the relevant APIs to Import an Invoice: PC 1.0, PC 2.0.
Note: If you have product family and charges under Product Catalog then you are in PC 2.0 version. Click here to know more.
Sample request Sample response
Note:
Importing an invoice status as ‘Paid’ status is only when you are trying to move from different billing provider to Chargebee. If we import an invoice in Paid status for deleted invoice, it would create an invoice with a new payment.
The previously deleted invoice will have payments moved to excess payments which will not be linked to the invoice created in Paid status that would cause duplicate payments for the same invoice.
Once the invoice is imported successfully, you will see the same invoice created in Chargebee.
Step 2: To link the payment that was used to the invoice that was deleted, you can use the ‘Apply Payments’ option from the invoice.
You will be prompted to link the excess payment, and click ‘Apply’
Option 2: Bulk Operation
Step 1: You can perform this action from Settings > Configure Chargebee > Import & Export Data > Choose a Bulk Operation > Invoices > Import Invoice
Step 2: Download the sample CSV file
This file contains sample records that you can replace with your own records. Note that the data needs to be added to the sheet in the same format the sample data is in.
Upon downloading the CSV ‘import_invoice_sample_data.csv’ file, update the current data from your site to in the sample CSV
Now, you can update the invoice data into the ‘import_invoice_sample_data.csv’
Step 5: Drag and drop your data file into the web interface or upload it:
Once you've added all the information and the data file is ready, upload it.
To find the source activity of the invoice (imported or scheduled activity)
Please navigate to logs->Events->Select the event type as mentioned below:
Also, you can go to invoices->Load the invoice for that specific period->Check the invoice activity->Click on details->See the source
To import invoice from deleted subscription, you need to capture the invoice generated logs from Customers > Activity Logs > View Details of the Specific Invoice Events using the subscription ID (You can find the subscription ID from the deleted subscription deleted event).
Please refer to this link Bulk operations if you have received any errors while uploading the file.