# Export revenue recognition reports

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Idempotency Supported](/docs/api/idempotency)

[Eventually Consistent](/docs/api/read-consistency)

**Important:** This report is deprecated. Therefore, the endpoint is also deprecated.

This API triggers export for the revenue recognition report.

**Note:** This API call is asynchronous.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. In case you are using any of the client libraries, use the **wait for export completion** function provided as an instance method in the library.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait\_for\_export\_completion** on the returned **export** resource which will wait until the export status changes.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait\_for\_export\_completion** on the returned **export** resource which will wait until the export status changes.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **WaitForExportCompletion** on the returned **Export** resource which will wait until the export status changes.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait\_for\_export\_completion** on the returned **export** resource which wait until the export status changes.

You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait\_for\_export\_completion** on the returned **export** resource which wait until the export status changes.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/exports/revenue_recognition \
     -u {site_api_key}:\
     -d report_by="INVOICE" \
     -d report_from_month=6 \
     -d report_from_year=2020 \
     -d report_to_month=7 \
     -d report_to_year=2020 \
     -d "invoice[status][is_not]"="PAID" \
     -d "invoice[total][lt]"="1000" \
     -d "subscription[status][is]"="ACTIVE" \
     -d "customer[first_name][is]"="John" \
     -d "customer[last_name][is]"="Doe" \
     -d "customer[email][is]"="john@test.com"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;
using ChargeBee.Models.Enums;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Export.RevenueRecognition()
		.ReportBy(ReportByEnum.Invoice)
		.ReportFromMonth(6)
		.ReportFromYear(2020)
		.ReportToMonth(7)
		.ReportToYear(2020)
		.InvoiceStatus().IsNot(Invoice.StatusEnum.Paid)
		.InvoiceTotal().Lt(1000)
		.SubscriptionStatus().Is(Subscription.StatusEnum.Active)
		.CustomerFirstName().Is("John")
		.CustomerLastName().Is("Doe")
		.CustomerEmail().Is("john@test.com")
		.Request();

Export export = result.Export;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    "github.com/chargebee/chargebee-go/v3/filter"
    exportAction "github.com/chargebee/chargebee-go/v3/actions/export"
    "github.com/chargebee/chargebee-go/v3/models/export"
    enum "github.com/chargebee/chargebee-go/v3/enum"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := exportAction.RevenueRecognition(&export.RevenueRecognitionRequestParams{
        ReportBy : enum.ReportByInvoice,
        ReportFromMonth : chargebee.Int32(6),
        ReportFromYear : chargebee.Int32(2020),
        ReportToMonth : chargebee.Int32(7),
        ReportToYear : chargebee.Int32(2020),
        Invoice : &export.RevenueRecognitionInvoiceParams{
            Status : &filter.EnumFilter{
                IsNot : "paid",
            },
            Total : &filter.NumberFilter{
                Lt : 1000,
            },
        },
        Subscription : &export.RevenueRecognitionSubscriptionParams{
            Status : &filter.EnumFilter{
                Is : "active",
            },
        },
        Customer : &export.RevenueRecognitionCustomerParams{
            FirstName : &filter.StringFilter{
                Is : "John",
            },
            LastName : &filter.StringFilter{
                Is : "Doe",
            },
            Email : &filter.StringFilter{
                Is : "john@test.com",
            },
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Export := res.Export
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.ExportRevenueRecognitionRequest{
    ReportBy : chargebee.ReportByInvoice,
    ReportFromMonth : chargebee.Int32(6),
    ReportFromYear : chargebee.Int32(2020),
    ReportToMonth : chargebee.Int32(7),
    ReportToYear : chargebee.Int32(2020),
    Invoice : &chargebee.ExportRevenueRecognitionInvoice{
        Status : &chargebee.EnumFilter{
            IsNot : "paid",
        },
        Total : &chargebee.NumberFilter{
            Lt : 1000,
        },
    },
    Subscription : &chargebee.ExportRevenueRecognitionSubscription{
        Status : &chargebee.EnumFilter{
            Is : "active",
        },
    },
    Customer : &chargebee.ExportRevenueRecognitionCustomer{
        FirstName : &chargebee.StringFilter{
            Is : "John",
        },
        LastName : &chargebee.StringFilter{
            Is : "Doe",
        },
        Email : &chargebee.StringFilter{
            Is : "john@test.com",
        },
    },
}
  res, err := client.Export.RevenueRecognition(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Export := res.Export
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Export.revenueRecognition()
            .reportBy(ReportBy.INVOICE)
            .reportFromMonth(6)
            .reportFromYear(2020)
            .reportToMonth(7)
            .reportToYear(2020)
            .invoiceStatus().isNot(Invoice.Status.PAID)
            .invoiceTotal().lt(1000L)
            .subscriptionStatus().is(Subscription.Status.ACTIVE)
            .customerFirstName().is("John")
            .customerLastName().is("Doe")
            .customerEmail().is("john@test.com")
            .request();

        Export export = result.export();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.export.Export;
import com.chargebee.v4.models.export.params.ExportRevenueRecognitionParams;
import com.chargebee.v4.models.export.responses.ExportRevenueRecognitionResponse;

public class ExportRevenueRecognition {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        ExportRevenueRecognitionParams.InvoiceParams invoice =
            ExportRevenueRecognitionParams.InvoiceParams.builder()
                .status()
                .isNot(ExportRevenueRecognitionParams.InvoiceParams.Status.PAID)
                .total()
                .lt(1000L)
                .build();

        ExportRevenueRecognitionParams.SubscriptionParams subscription =
            ExportRevenueRecognitionParams.SubscriptionParams.builder()
                .status()
                .is(ExportRevenueRecognitionParams.SubscriptionParams.Status.ACTIVE)
                .build();

        ExportRevenueRecognitionParams.CustomerParams customer =
            ExportRevenueRecognitionParams.CustomerParams.builder()
                .firstName()
                .is("John")
                .lastName()
                .is("Doe")
                .email()
                .is("john@test.com")
                .build();

        ExportRevenueRecognitionParams params = ExportRevenueRecognitionParams.builder()
            .reportBy(ExportRevenueRecognitionParams.ReportBy.INVOICE)
            .reportFromMonth(6)
            .reportFromYear(2020)
            .reportToMonth(7)
            .reportToYear(2020)
            .invoice(invoice)
            .subscription(subscription)
            .customer(customer)
            .build();

        ExportRevenueRecognitionResponse response = client.exports().revenueRecognition(params);

        Export export = response.getExport();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.export.revenueRecognition({
        report_by: "invoice",
        report_from_month: 6,
        report_from_year: 2020,
        report_to_month: 7,
        report_to_year: 2020,
        invoice: {
            status: {
                is_not: "paid"
            },
            total: {
                lt: 1000
            }
        },
        subscription: {
            status: {
                is: "active"
            }
        },
        customer: {
            first_name: {
                is: "John"
            },
            last_name: {
                is: "Doe"
            },
            email: {
                is: "john@test.com"
            }
        }
    });

    console.log(result);
    const export_response = result.export;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->export()->revenueRecognition([
    "report_by" => "invoice",
    "report_from_month" => 6,
    "report_from_year" => 2020,
    "report_to_month" => 7,
    "report_to_year" => 2020,
    "invoice" => [
        "status" => [
            "is_not" => "paid"
        ],
        "total" => [
            "lt" => 1000
        ]
    ],
    "subscription" => [
        "status" => [
            "is" => "active"
        ]
    ],
    "customer" => [
        "first_name" => [
            "is" => "John"
        ],
        "last_name" => [
            "is" => "Doe"
        ],
        "email" => [
            "is" => "john@test.com"
        ]
    ]
]);
$export = $result->export;
```

#### Python

```python
import chargebee
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Export.revenue_recognition(
    cb_client.Export.RevenueRecognitionParams(
        report_by=chargebee.ReportBy.INVOICE,
        report_from_month=6,
        report_from_year=2020,
        report_to_month=7,
        report_to_year=2020,
        invoice=cb_client.Export.RevenueRecognitionInvoiceParams(
            status=Filters.EnumFilter(IS_NOT=chargebee.Invoice.Status.PAID),
            total=Filters.NumberFilter(LT="1000")
        ),
        subscription=cb_client.Export.RevenueRecognitionSubscriptionParams(
            status=Filters.EnumFilter(IS=chargebee.Subscription.Status.ACTIVE)
        ),
        customer=cb_client.Export.RevenueRecognitionCustomerParams(
            first_name=Filters.StringFilter(IS="John"),
            last_name=Filters.StringFilter(IS="Doe"),
            email=Filters.StringFilter(IS="john@test.com")
        )
    )
)
export = response.export
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Export.revenue_recognition({
  :report_by => "INVOICE",
  :report_from_month => 6,
  :report_from_year => 2020,
  :report_to_month => 7,
  :report_to_year => 2020,
  "invoice[status][is_not]" => "paid",
  "invoice[total][lt]" => 1000,
  "subscription[status][is]" => "active",
  "customer[first_name][is]" => "John",
  "customer[last_name][is]" => "Doe",
  "customer[email][is]" => "john@test.com"
})

export = result.export
```

## Sample Response

```json
{
  "export": {
    "created_at": 1612968382,
    "id": "__test__8aszcSOcsxGt7u",
    "mime_type": "zip",
    "object": "export",
    "operation_type": "Revenue Recognition Report",
    "status": "in_process"
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/exports/revenue_recognition

## Input Parameters

- `report_by` (required, enumerated string)
  Determines the scope of the report. Returns the report based on the value specified.
  Possible enum values:
    - `customer`
      Customer
    - `invoice`
      Invoice
    - `product`
      Product (Includes Plan, Addon and Adhoc)
    - `subscription`
      Subscription

- `currency_code` (optional, string, max chars=3)
  Value must be in [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format. Generates the report based on the value specified. If no currency\_code value is specified, then consolidated report based on base currency is returned.

- `report_from_month` (required, integer)
  Obtains report data from the specified month, combined with the value specified for report\_from\_year. Values must be between 1 and 12, where 1 is January and 12 is December.

- `report_from_year` (required, integer)
  Obtains report data from the specified year, combined with the value specified for report\_from\_month.

- `report_to_month` (required, integer)
  Obtains report data from the specified month, combined with the value specified for report\_to\_year. Values must be between 1 and 12, where 1 is January and 12 is December.

- `report_to_year` (required, integer)
  Obtains report data until the specified year, combined with the value specified for report\_to\_month.

- `include_discounts` (optional, boolean, default=true)
  Returns amount with discount in the report. If value specified is false, it returns amount without discount.

- `payment_owner` (optional, string)
  optional, string filter
  
  Payment owner of an invoice. **Supported operators :** is, is\_not, starts\_with, in, not\_in
  
  **Example →** _payment\_owner\[is\] = "payment\_customer"_

- `item_id` (optional, string)
  optional, string filter
  
  The plan item code. **Supported operators :** is, is\_not, starts\_with, in, not\_in
  
  **Example →** _item\_id\[is\] = "silver"_

- `item_price_id` (optional, string)
  optional, string filter
  
  The plan item price code. **Supported operators :** is, is\_not, starts\_with, in, not\_in
  
  **Example →** _item\_price\_id\[is\] = "silver-USD-monthly"_

- `cancel_reason_code` (optional, string)
  optional, string filter
  
  Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. **Supported operators :** is, is\_not, starts\_with, in, not\_in
  
  **Example →** _cancel\_reason\_code\[is\] = "Not Paid"_

- `business_entity_id` (optional, string)
  optional, string filter
  
  The unique ID of the [business entity](/docs/api/getting-started) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions/subscription-object#customer_id) of the customer.
  
  **Supported operators :** is, is\_not, starts\_with
  
  **Example →** _business\_entity\_id\[is\_not\] = "business\_entity\_id"_

- `invoice` (optional, string)
  Parameters for invoice
  - `id` (optional, string)
    The invoice number. Acts as a identifier for invoice and typically generated sequentially.
  - `recurring` (optional, enumerated string)
    Boolean indicating whether this invoice belongs to a subscription
  - `status` (optional, enumerated string)
    Current status of this invoice.
  - `price_type` (optional, enumerated string)
    The price type of the invoice.
  - `total` (optional, number)
    Invoiced amount displayed in cents; that is, a decimal point is not present between the whole number and the decimal part. For example, $499.99 is displayed as 49999, and so on.
  - `amount_paid` (optional, number)
    Payments collected successfully for the invoice. This is the sum of `[linked_payments[].txn_amount](/docs/api/invoices/invoice-object#linked_payments)` for all `linked_payments[]` that have `txn_status` as `success`.
  - `amount_adjusted` (optional, number)
    Total adjustments made against this invoice.
  - `credits_applied` (optional, number)
    Total credits applied against this invoice.
  - `amount_due` (optional, number)
    The unpaid amount that is due on the invoice. This is calculated as: `[total](/docs/api/invoices/invoice-object#total)`
    
    -   `[amount_paid](/docs/api/invoices/invoice-object#amount_paid)`
    -   sum of `[applied_credits](/docs/api/invoices/invoice-object#applied_credits).applied_amount`
    -   sum of `[adjustment_credit_notes](/docs/api/invoices/invoice-object#adjustment_credit_notes).cn_total`
    -   sum of `[linked_taxes_withheld](/docs/api/invoices/invoice-object#linked_taxes_withheld).amount`.
  - `dunning_status` (optional, enumerated string)
    Current dunning status of the invoice.
  - `channel` (optional, enumerated string)
    The subscription channel this object originated from and is maintained in.
  - `date` (optional, timestamp(UTC) in seconds)
    The document date displayed on the invoice PDF.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `paid_at` (optional, timestamp(UTC) in seconds)
    Timestamp indicating the date & time this invoice got paid.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `updated_at` (optional, timestamp(UTC) in seconds)
    To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)

- `subscription` (optional, string)
  Parameters for subscription
  - `id` (optional, string)
    A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
  - `customer_id` (optional, string)
    Identifier of the customer with whom this subscription is associated.
  - `status` (optional, enumerated string)
    Current state of the subscription
  - `cancel_reason` (optional, enumerated string)
    The reason for canceling the subscription. Set by Chargebee automatically.
  - `remaining_billing_cycles` (optional, number)
    -   When the subscription is not on a contract term: this value is the number of billing cycles remaining after the current cycle, at the end of which, the subscription cancels.
    -   When the subscription is on a [contract term](/docs/api/contract_terms): this value is the number of billing cycles remaining in the contract term after the current billing cycle.
  - `has_scheduled_changes` (optional, enumerated string)
    If `true` , there are subscription changes scheduled on next renewal.
  - `offline_payment_method` (optional, enumerated string)
    The preferred offline payment method for the subscription.
  - `auto_close_invoices` (optional, enumerated string)
    Set to `false` to override for this subscription, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the [customer level](/docs/api/customers/customer-object#auto_close_invoices) .
  - `channel` (optional, enumerated string)
    The subscription channel this object originated from and is maintained in.
  - `created_at` (optional, timestamp(UTC) in seconds)
    The time at which the subscription was created.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `activated_at` (optional, timestamp(UTC) in seconds)
    Time at which the subscription `status` last changed to `active`. For example, this value is updated when an `in_trial` or `cancelled` subscription activates.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `next_billing_at` (optional, timestamp(UTC) in seconds)
    The date/time at which the next billing for the subscription happens. This is usually right after `current_term_end` unless multiple subscription terms were invoiced in advance using the `terms_to_charge` parameter.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `cancelled_at` (optional, timestamp(UTC) in seconds)
    Time at which subscription was cancelled or is set to be cancelled.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `updated_at` (optional, timestamp(UTC) in seconds)
    To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)

- `customer` (optional, string)
  Parameters for customer
  - `id` (optional, string)
    Identifier of the customer.
  - `first_name` (optional, string)
    First name of the customer
  - `last_name` (optional, string)
    Last name of the customer
  - `email` (optional, string)
    Email of the customer. Configured email notifications will be sent to this email.
  - `company` (optional, string)
    Company name of the customer.
  - `phone` (optional, string)
    Phone number of the customer
  - `auto_collection` (optional, enumerated string)
    Whether payments needs to be collected automatically for this customer
  - `taxability` (optional, enumerated string)
    Specifies if the customer is liable for tax
  - `offline_payment_method` (optional, enumerated string)
    The preferred offline payment method for the customer.
  - `auto_close_invoices` (optional, enumerated string)
    Override for this customer, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the [subscription level](/docs/api/subscriptions/subscription-object#auto_close_invoices) which takes precedence.
  - `channel` (optional, enumerated string)
    The subscription channel this object originated from and is maintained in.
  - `created_at` (optional, timestamp(UTC) in seconds)
    Timestamp indicating when this customer resource is created.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `updated_at` (optional, timestamp(UTC) in seconds)
    To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)

- `relationship` (optional, string)
  Parameters for relationship
  - `parent_id` (optional, string)
    Immediate parent with whom we will link our new customer(child)
  - `payment_owner_id` (optional, string)
    Parent who is going to pay
  - `invoice_owner_id` (optional, string)
    Parent who is going to handle invoices

## Returns

- `export` (Export object)
  Resource object representing export
