First-party app
Loop Returns

Loop Returns

Loop Returns: returns and exchanges, orders, customers, destinations, labels, fraud reports and webhooks.

stable Commerce & PaymentsCustomer Support

About

Loop Returns ships in the w6w first-party pack. It declares 30 actions, 3 health checks, and the host runs its code in a sandbox that never sees the credential.

App id
io.w6w.loop-returns
Version
0.1.0
Author
w6w
Licence
MIT
Categories
Commerce & Payments · Customer Support

Overview

Loop Returns runs the returns and exchanges experience for Shopify merchants. This app drives the Loop API from a workflow.

List and fetch returns, then act on them: process, cancel, flag, close, remove line items, read and add notes, generate a label, or report a return as fraudulent. Pull the advanced shipping notice for warehouse reconciliation, create return deep links and QR codes for a customer’s order, and check which items on an order are still eligible to return.

Read orders and customers held in Loop, upsert customers, list warehouse and donation destinations, inspect label requests and bulk operations, and subscribe webhooks so a workflow reacts to return events instead of polling.

It authenticates with a Loop API key sent as the X-Authorization header; the key’s scopes decide which actions work. Order writes, product, collection, inventory, listing and location data, draft returns, cart and Checkout+ APIs are not part of this app.

Build with Loop Returns

Three routes to the same 30 actions. The Workflow tab is generated from Loop Returns's own manifest and carries its real ids, so it is copy-pasteable; the Code and CLI examples are the same call for any action on any app, so every app-specific value in them is a blank you fill in.

List Bulk Operations

bulk-operation-list

List bulk operations (file imports of orders, products and more), cursor-paginated.

Get Customer

customer-get

Fetch one customer by Loop's customer ID.

Get Customer by External ID

customer-get-by-external-id

Fetch one customer by the id they carry in your own system.

List Customers

customer-list

List customers held in Loop, cursor-paginated.

Upsert Customer

customer-upsert

Create a customer, or update the one that already has this external ID.

Get Destination

destination-get

Fetch one destination by ID.

List Destinations

destination-list

List the warehouse and donation destinations returns can be routed to.

Create Fraud Report

fraud-report-create

Report a return as fraudulent, with an optional category and comment.

Delete Fraud Report

fraud-report-delete

Remove the fraud report from a return.

List Label Requests

label-request-list

List label requests (third-party label integrations), filterable by return, status and time.

Get Order

order-get

Fetch one order by Loop's order ID.

Get Order by External ID

order-get-by-external-id

Fetch one order by the id it carries in your own system.

List Orders

order-list

List orders held in Loop, cursor-paginated.

Check Order Return Eligibility

order-return-eligibility

Look up which items on an order are still eligible to be returned.

Get Advanced Shipping Notice

return-asn-report

Pull the packages in a date range with their tracking status, plus order and return information.

Cancel Return

return-cancel

Cancel a return so the customer can return the same items again.

Close Return

return-close

Close a return without fulfilling its outcomes (no exchange, no gift card).

Create Return Deep Link

return-deep-link-create

Create a link that opens a customer's order directly in Loop's returns portal.

Flag Return

return-flag

Flag a return for human review, which stops automated processing.

Get Return

return-get

Fetch one return in full by return ID, order ID or order name.

Generate Return Label

return-label-generate

Ask Loop to generate a shipping label for a return.

List Returns

return-list

List returns created (or updated) in a time window, newest page first, with cursor pagination.

Create Return Note

return-note-create

Add a note to a return's timeline.

List Return Notes

return-notes-list

Read the notes on a return.

Process Return

return-process

Queue a return for processing: archive it and fulfil its remaining outcomes (exchange orders, gift cards).

Create Return QR Code

return-qr-create

Create a QR code image link that opens a customer's order in Loop's returns portal.

Remove Return Line Items

return-remove-line-items

Remove line items from an open refund or store-credit return.

Create Webhook

webhook-create

Subscribe a URL to a Loop event.

Delete Webhook

webhook-delete

Remove a webhook subscription.

List Webhooks

webhook-list

List webhook subscriptions, whether created through the API or in Loop Admin.

A workflow step names the app and the action, and the editor fills in the connection when you pick one. This is the Step shape from the workflow spec, carrying Loop Returns's real ids.

{
  "manifestVersion": "2",
  "name": "loop-returns-example",
  "steps": [
    {
      "id": "customer-get",
      "uses": {
        "app": "io.w6w.loop-returns",
        "action": "customer-get",
        "connection": "conn_YOUR_CONNECTION_ID"
      },
      "with": {
        "customerId": "<customerId>"
      }
    }
  ]
}

Here are some of the things you can do

  • Get Customer

    read
    customer-get
  • List Bulk Operations

    read
    bulk-operation-list
  • Get Customer by External ID

    read
    customer-get-by-external-id
  • List Customers

    read
    customer-list
  • Upsert Customer

    perform
    customer-upsert

+25 more actions available

Every app-specific value here is a blank you have to fill in. An app action is reached through the connection that authenticates it, so the address is a connection id, not the app id — and connections belong to your account, so a public page cannot know yours. Create one for Loop Returns, then fill in the three blanks: conn_YOUR_CONNECTION_ID, the action key, and the parameters that action declares. The call itself is real — the shape is transcribed from the studio's own snippet builder, which prints the same kind of blanks — but nothing in it is specific to Loop Returns. The Workflow tab is where this app's real ids are.

Install
npm install @w6w/sdk
yarn add @w6w/sdk
pnpm add @w6w/sdk
deno add npm:@w6w/sdk
Code
import { W6wClient, isActionRun } from "@w6w/sdk";

// Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.
const client = new W6wClient();

const envelope = await client.run({
  urn: "conn_YOUR_CONNECTION_ID",
  action: "customer-get",
  payload: {
    customerId: "<value>",
  },
});

if (isActionRun(envelope)) console.log(envelope.value);
Install the CLI
npm install -g @w6w/cli
CLI
w6w run conn_YOUR_CONNECTION_ID --action customer-get --payload '{"customerId":"<value>"}'

Give an AI agent Loop Returns — without giving it Loop Returns's credentials. One MCP endpoint exposes every app, function and workflow the caller is entitled to, as tools it can discover and run. Access is granted per team while we onboard.

One tool call
{
  "name": "w6w_invoke",
  "arguments": {
    "ref": "app:io.w6w.loop-returns#customer-get",
    "input": {
      "customerId": "<customerId>"
    }
  }
}

Every tool names its target with a single ref. The app: form above doesn't name a connection at all — the host resolves which of the caller's Loop Returns connections to sign with, and refuses rather than guesses when the answer is ambiguous.

What the agent gets

Credentials it can't read

The token is attached host-side, at the moment of the call. It is never a tool argument, never in the model's context, and never in a transcript — so a prompt injection has nothing to exfiltrate.

A tool surface scoped to the caller

Tools are derived per end user from what that person has actually connected and is entitled to — not one shared bot identity carrying the union of everyone's access.

A durable workflow in one call

Multi-step work runs on the workflow engine and returns a run handle the agent can poll — retries, branching and state survive the conversation that started them.

Health-aware discovery

Loop Returns's declared health checks are on the surface too, so an agent can tell "the vendor is down" from "your credential expired" before it burns a retry on either.

The MCP surface is part of the hosted platform. Loop Returns itself is MIT, and the runtime that executes it is source-available (FSL).

Request MCP access

Health checks

Loop Returns declares its own checks, so its health is a property of the app rather than something the host guesses at.

service

Loop platform status

dependency

API reachable

Unsigned GET https://api.loopreturns.com/api/v1/webhooks. Loop's gateway answers a schema-correct JSON 401 (GEN-UNAUTHORIZED) when the API is serving; an HTML body or a 5xx is not the API.

quota

API rate-limit headroom