Skip to main content

How to Set Up a Returns Report

S
Written by Sam E.

Use the Order Return Recurring Export Service to automatically send return data to an SFTP server. Acenda runs this export automatically every 30 minutes.

Step-by-Step Setup

  1. Navigate to the Integration:

    In Acenda, go to Integrations and select Order Return Recurring Export Service.

  2. Enter SFTP Credentials:

    Under SFTP Credentials, enter the information provided by your IT team or reporting partner:

    • Server

    • Port

    • Username

    • Password or Key

    • Destination Folder

  3. Select Render Engine:

    Under Template Control, select Twig as your render engine.

  4. Paste Template:

    Copy the Twig template code block below into the Body Template field.

  5. Customize Mappings:

    Edit the Twig logic to match your specific sales channels, trading partner requirements, return-reason mappings, account identifiers, and file format rules.

  6. Configure Output Options:

    Under Output File Name Options, enter your filename template.

    Note: Only select One File Per Record if the recipient explicitly requires a separate file for each return. Otherwise, Acenda aggregates returns into a single report file per run.

  7. Configure Return Filters:

    Under Order Return Filters:

    • Standard Rolling Export: Leave all filter fields blank to export returns created within the previous 3 days.

    • Backfill / Resend: Enter specific Return IDs, Order IDs, or a Starting Return ID only when resending historical data.

  8. Save & Test:

    Click Save. After the next scheduled 30-minute run, check your destination SFTP folder to confirm the file arrived.

Body Template (Twig)

Copy and paste the code below into the Body Template field, then adjust the Twig variable mappings to match your system.

Twig

{% apply spaceless %} {% if ship_advice.sales_channel_id == 1 %}     {% set account_id = "MACYMARKET     " %}     {% set gs_identifier = "MACYMARKET" %}   {% elseif ship_advice.sales_channel_id == 2 %}      {% set account_id = "URBNMARKET     " %}     {% set gs_identifier = "URBNMARKET" %}   {% elseif ship_advice.sales_channel_id == 3 %}     {% set account_id = "TARGETPLUS     " %}     {% set gs_identifier = "TARGETPLUS" %}   {% elseif ship_advice.sales_channel_id == 4 %}     {% set account_id = "AMAZONFBM      " %}     {% set gs_identifier = "AMAZONFBM" %}   {% elseif ship_advice.sales_channel_id == 5 %}     {% set account_id = "WALMARTMARKETPL" %}     {% set gs_identifier = "WALMARTMARKETPL" %} {% endif %}  {% if return.reason == 'CR-DEFECTIVE' %}     {% set return_reason = "Defective" %}   {% elseif return.reason == 'AMZ-PG-APP-TOO-SMALL' %}     {% set return_reason = "Too Small" %}   {% elseif return.reason == 'AMZ-PG-APP-TOO-LARGE' %}     {% set return_reason = "Too Large" %}   {% elseif return.reason == 'CR-SWITCHEROO' %}     {% set return_reason = "Incorrect Item Received" %}   {% elseif return.reason == 'CR-UNWANTED_ITEM' %}     {% set return_reason = "No longer want/need" %}   {% elseif return.reason == 'DID_NOT_LIKE_FABRIC' %}     {% set return_reason = "Not As Pictured" %}   {% elseif return.reason == 'DID_NOT_LIKE_COLOR' %}     {% set return_reason = "Not As Pictured" %}   {% elseif return.reason == 'AMZ-PG-APP-STYLE' %}     {% set return_reason = "Not As Pictured" %}   {% elseif return.reason == 'CR-QUALITYQualityBLE' %}     {% set return_reason = "Quality" %}   {% elseif return.reason == 'AMZ-PG-BAD-DESC' %}     {% set return_reason = "Not As Pictured" %}   {% else %}     {% set return_reason = "Miscellaneous" %} {% endif %}  {{ "ISA" }}*{{ "00" }}*{{ "          " }}*{{ "00" }}*{{ "          " }}*{{ "ZZ" }}*{{ account_id }}*{{ "12" }}*{{ "MINNETONKA     " }}*{{ ship_advice.created_at|date("ymd") }}*{{ ship_advice.created_at|date("Hi") }}*{{ "U" }}*{{ "00401" }}*{{ "000011110" }}*{{ "0" }}*{{ "P" }}*{{ ">" }} {{ "GS" }}*{{ "AN" }}*{{ gs_identifier }}*{{ "MINNETONKA" }}*{{ ship_advice.created_at|date("Ymd") }}*{{ ship_advice.created_at|date("Hi") }}*{{ "14" }}*{{ "X" }}*{{ "004010" }} {{ "ST" }}*{{ "180" }}*{{ "0001" }} {{ "BGN" }}*{{ "00" }}*{{ return.id }}*{{ return.created_at|date("Ymd") }}*** {{ "RDR" }}*{{ "CR" }}*{{ "ZZ" }}**{{ return_reason }} {{ "PRF" }}*{{ ship_advice.purchase_order }}~  {% for item in ship_advice.ship_advice_item %} {{ "BLI" }}*{{ "UP" }}*{{ item.upc }}*{{ return_quantity }}*{{ "EA" }}*{{ "SEL" }}*{{ item.unit_price }}******* {{ "N9" }}*{{ "RTL" }}*{{ "1" }} {% endfor %}  {{ "SE" }}*{{ 5 + (ship_advice.ship_advice_item | length * 2) }}*{{ "0001" }} {{ "GE" }}*{{ "1" }}*{{ "14" }} {{ "IEA" }}*{{ "1" }}*{{ "000011110" }} {% endapply %}{{ "\n" }}

What to Edit

⚠️ Important: The sample code contains values specific to an example trading partner. Do not assume these default values will work for your recipient.

Review and update these parameters in the Twig template before turning on the export:

  • Sales Channel IDs & Account IDs

  • GS & Trading Partner Identifiers

  • Return-Reason Codes & Mapped Descriptions

  • EDI Control Numbers

  • Purchase Order & Item Identifier Fields

  • Return Quantity & Pricing Fields

🔒 Protecting Customer Information (PII)

Include only operational data required to process the return:

  • Return ID / Order ID / Purchase Order

  • SKU / UPC & Quantity

  • Status, Dates, & Return Reason

Warning: Do not include customer names, email addresses, phone numbers, physical addresses, or payment details unless an approved data-sharing policy explicitly requires it.

Troubleshooting

If your exported file does not arrive as expected, verify the following:

  • SFTP Credentials: Confirm the server host, port, username, and password/key are exact.

  • Folder Permissions: Check that Acenda has write access to the specified destination path.

  • Twig Syntax: Ensure there are no invalid Acenda fields or Twig syntax errors in your template code.

  • Channel Mappings: Verify that all active sales channels and return reasons are accounted for in the template logic.

  • Notifications: Review integration error logs inside Acenda for failed connections or rendering issues.

  • Filter Conflicts: Ensure custom export filters aren't inadvertently excluding incoming returns.

Did this answer your question?