> For the complete documentation index, see [llms.txt](https://docs.changeup.com/salesforce/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.changeup.com/salesforce/salesforce-b2c-commerce/setup-and-configuration/donation-reporting.md).

# Donation Reporting

ChangeUp requires donation data reporting after the order payment has been captured. For that, we have developed a job that will send order data to our API; below is an example of that job definition:

{% code lineNumbers="true" %}

```xml
    <job job-id="ChangeUp" priority="0">
        <description>Calls the ChangeUp donation api and flags the order as imported into ChangeUp.</description>
        <parameters/>
        <flow>
            <context site-id="ChangeUp"/>
            <step step-id="ChangeUpExportOrders" type="ExecuteScriptModule" enforce-restart="false">
                <description/>
                <parameters>
                    <parameter name="ExecuteScriptModule.Module">bm_changeup/cartridge/controllers/ChangeUp.js</parameter>
                    <parameter name="ExecuteScriptModule.FunctionName">SendDonations</parameter>
                    <parameter name="ExecuteScriptModule.Transactional">true</parameter>
                </parameters>
            </step>
        </flow>
        <rules>
            <on-running runtime-threshold="60m" enabled="false">
                <mark-job-as-hanging/>
            </on-running>
        </rules>
        <triggers>
            <run-recurring enabled="false">
                <recurrence>
                    <date-from>2023-01-19Z</date-from>
                    <start-time>14:36:53.000Z</start-time>
                    <interval>12M</interval>
                    <day-of-week/>
                </recurrence>
            </run-recurring>
        </triggers>
    </job>

</jobs>
```

{% endcode %}

### Commerce Cloud Injection

The merchant should point you to where they capture order payments in their code base. Within this code, you will need to construct an Object resembling the request example above from the orders being processed. To make the process more efficient, you could pre-flight a check on each order’s custom attribute **changeupAgreedToDonate** to see if it should be sent to the donation reporting code. After you have constructed the object, inject this line of code and pass the object to the constructor (**data** is the object in the example). The **result** can be used to throw errors or ensure the capture reporting is successful.

{% code overflow="wrap" lineNumbers="true" %}

```
var result=require('~/cartridge/scripts/changeup/services/captureReporting')(data);
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.changeup.com/salesforce/salesforce-b2c-commerce/setup-and-configuration/donation-reporting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
