New in Chargebee: Explore Reveal and understand your payment performance end-to-end.Try Now
Docschargebee docs
HomeBillingPaymentsRevRecGrowthReveal
Support

Product Updates


  • Release Notes

Getting Started


  • Overview
  • Chargebee Billing Data Centers
  • Object Relationship Model
  • Understanding Sites
  • Chargebee Tech Glossary
  • Articles and FAQ

Implementing Chargebee


  • Implementation Guide
  • Go-live Checklist
  • Articles and FAQ

AI in Chargebee


  • Chargebee Copilot
  • Chargebee Model Context Protocol (MCP) Server

Developer Resources


  • Developer Resources Overview
  • API Explorer
  • Articles and FAQ

Product Catalog


  • Product Catalog Overview
  • Coupons
  • Articles and FAQ

Subscriptions


  • Working with Subscriptions
  • Billing
  • Orders
  • Articles and FAQ

Customers


  • Managing Customers
  • Account Hierarchy
  • Email Notifications
  • Branding
  • Configure Multiple Languages
  • Articles and FAQ

Entitlements


  • Entitlements Overview
  • Features Overview
  • Feature Management
  • Managing Product Entitlements
  • Subscription Entitlements
  • Customer Entitlements
  • Grandfathering Entitlements
  • Articles and FAQ

Usage Based Billing


  • Understanding Usages
  • Setting up Usage Based Billing
  • Usage Alerts
  • Prepaid credits
  • Metered Billing
  • Articles and FAQ

Chargebee CPQ


  • Chargebee CPQ
  • Chargebee CPQ for Salesforce
  • Chargebee CPQ for HubSpot

Invoices, Credit Notes, and Quotes


  • Invoices
  • Credit Notes
  • Quotes [Legacy]
  • Transactions
  • Articles and FAQ

Taxes


  • Overview
  • Configuring Taxes
  • Country-specific Taxes
  • Articles and FAQ

Hosted Capabilities


  • Overview
  • Hosted Checkout
  • Hosted Self-Serve Portal
  • Hosted Pages Features
  • Additional Hosted Pages
  • Payment Components
  • Pricing Table
  • Managing Payments with Chargebee.js
  • Mobile-Optimized Hosted Pages
  • Articles and FAQ

Site Configuration


  • Users & Roles
  • Custom Fields & Metadata
  • Approvals
  • Mandatory Fields
  • File Attachments & Comments
  • Advanced Filter Options
  • Multicurrency Pricing
  • Multi-decimal Support
  • Configuring Reason Codes
  • Events and Webhooks
  • API Keys
  • Time Zone
  • Time Machine
  • Transfer Configurations
  • Articles and FAQ

Multi Business Entity


  • Multi Business Entity Overview
  • Customer Transfer Overview
  • Articles and FAQ

Mobile Subscriptions


  • Overview
  • Omnichannel Subscriptions
  • Omnichannel One-Time Orders
  • Mobile Subscriptions (Legacy)

Reports and Analytics


  • RevenueStory
  • Home Dashboard
  • Frequently Asked Questions
  • FAQs for Classic Reports Sunset
  • Articles and FAQ

Integrations


  • Sales
  • Customer Support and Success
  • Finance
  • Tax
  • eInvoicing
  • Marketing
  • Stitch
  • Collaboration
  • Contract Management
  • Ecommerce Management
  • Articles and FAQ

Data Privacy & Security


  • Two Factor Authentication
  • SAML Single Sign-On
  • System for Cross-Domain Identity Management (SCIM)
  • EU-GDPR
  • Consent Management
  • Personal Data Management
  • Compliance Certificates
  • HIPAA Guidelines
  • PCI Recommendations and Integration Types
  • Articles and FAQ

Data Operations


  • Bulk Operations
  • Migration
  • Articles and FAQ
  1. Billing
  2. Site Configuration
  3. Articles and FAQ
  4. Events & Webhooks
  1. Billing
  2. Site Configuration
  3. Articles and FAQ
  4. Events & Webhooks

How to import a deleted invoice?

Problem Statement

You want to know how to import a deleted invoice.

Solution

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:

  1. Import Invoice API for a single invoice

  2. 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.

image

Once we locate and open the Invoice Deleted event, click 'Show V2 Content'

image

You can also check the exchange rate using the invoice content, as given below.

image

Option 1: Import Invoice API

Step 1: Now, you have all the data to import the deleted invoice. Now, use the import an invoice API. Refer to these links for the relevant APIs to Import an Invoice: Latest Product Catalog.

Note: If you have a product family and charges under the Product Catalog, then you are in Latest Product Catalog version. Click here to know more.

Sample request


  curl https://{your-site}.chargebee.com/api/v2/invoices/import_invoice

        -u {site_api_key}

        -d id="202223000164"

        -d customer_id="16CIZnT1eDlAr2vJK"

        -d subscription_id="169loNT1erQllJT6"

        -d date=1653985256

        -d total=5000

        -d status="payment_due"

        -d billing_address[first_name]="John"

        -d billing_address[last_name]="Doe"

        -d billing_address[line1]="PO Box 9999"

        -d billing_address[city]="Walnut"

        -d billing_address[state]="California"

        -d billing_address[zip]="91789"

        -d billing_address[country]="US"

        -d line_items[date_from][1]=1651318752

        -d line_items[date_to][1]=1653997152

        -d line_items[description][1]="Basic50"

        -d line_items[unit_amount][1]=5000

        -d line_items[quantity][1]=1

        -d line_items[entity_type][1]="plan"

        -d line_items[entity_id][1]="basic50"

Sample response

{
  "invoice": {
    "id": "202223000164",
    "customer_id": "16CIZnT1eDlAr2vJK",
    "subscription_id": "169loNT1erQllJT6",
    "recurring": true,
    "status": "payment_due",
    "price_type": "tax_exclusive",
    "date": 1653985256,
    "due_date": 1653985256,
    "net_term_days": 0,
    "exchange_rate": 1.0,
    "total": 5000,
    "amount_paid": 0,
    "amount_adjusted": 0,
    "write_off_amount": 0,
    "credits_applied": 0,
    "amount_due": 5000,
    "updated_at": 1654778558,
    "resource_version": 1654778558486,
    "deleted": false,
    "object": "invoice",
    "first_invoice": false,
    "amount_to_collect": 5000,
    "round_off_amount": 0,
    "has_advance_charges": false,
    "currency_code": "USD",
    "base_currency_code": "USD",
    "generated_at": 1653985256,
    "is_gifted": false,
    "term_finalized": true,
    "channel": "web",
    "tax": 0,
    "line_items": [{
      "id": "li_AzqMNsT8GQBxNCb2",
      "date_from": 1651318752,
      "date_to": 1653997152,
      "unit_amount": 5000,
      "quantity": 1,
      "amount": 5000,
      "pricing_model": "flat_fee",
      "is_taxed": false,
      "tax_amount": 0,
      "object": "line_item",
      "subscription_id": "169loNT1erQllJT6",
      "customer_id": "16CIZnT1eDlAr2vJK",
      "description": "Basic50",

      "entity_type": "plan",
      "entity_id": "basic50",
      "discount_amount": 0,
      "item_level_discount_amount": 0
    }],
    "sub_total": 5000,
    "linked_payments": [],
    "applied_credits": [],
    "adjustment_credit_notes": [],
    "issued_credit_notes": [],
    "linked_orders": [],
    "dunning_attempts": [],
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "line1": "PO Box 9999",
      "city": "Walnut",
      "state": "California",
      "country": "US",
      "zip": "91789",
      "validation_status": "not_validated",
      "object": "billing_address"
         }
   }
 }

Note: Importing an invoice status as 'Paid' status is only when you are trying to move from a different billing provider to Chargebee. If we import an invoice in Paid status for a 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, which 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 used to the deleted invoice, use the 'Apply Payments' option on the invoice.

image

You will be prompted to link the excess payment, and click 'Apply'

image

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

image

Step 2: Download the sample CSV file

image

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 as the sample data.

image
  • Upon downloading the CSV 'import_invoice_sample_data.csv' file, update the current data from your site to the sample CSV

Step 4: This file will contain sample records that you can replace with the current data records. The data that needs to be added to the sheet should be in the same format as the sample data.

Now, you can update the invoice data in the 'import_invoice_sample_data.csv'

Step 5: Drag and drop your data file into the web interface or upload it:

image

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:

image

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 invoices from deleted subscriptions, 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 event).

image

Please refer to this link Bulk operations if you have received any errors while uploading the file.

Related Articles

Accepted SSL certificates
How to create events for subscriptions?
My test webhooks events are not getting delivered. What should I do?
Can I filter events for a specific customer using API?
How can I be notified of only certain events using webhooks?
How to download Event logs?
Webhooks - SSL Communication Error
TLS 1.2 Handshake - Testing Code
My SSL certificate is not supported?
How would I know if the configured webhook URL in my Chargebee site is failing?
I received a webhook failure email from Chargebee. How to fix this?
How do I find failed webhooks and resend them?
301 or 302 Redirection error for Webhooks URL
Delay in webhooks notifications
How to do bulk Webhook Re-submit?
How to test webhooks on staging which requires VPN?
At which rate can we expect the webhook calls in Chargebee & Will there be any performance disruption?
Unable to view Webhook Failures from the email received from Chargebee
Meaning of 'optional' in Webhook events
How to track portal logs?

Show more

Was this article helpful?