Recommended data flow
This section describes the end-to-end data flow between an external return portal and TRAEDE, from the moment the brand configures the portal to the moment the customer's credit note is booked.
1. Brand configures the portal in TRAEDE
- A brand administrator creates an external return portal inside TRAEDE and picks its
type(reversio,returnflows,floatorcustom). - TRAEDE generates a
public_idand awebhook_secretfor the portal. The admin enters the portal'swebhook_endpointwhere TRAEDE should deliver webhooks. - The admin shares the
public_idandwebhook_secretwith the integrator, out-of-band.
See Installing the Return Portal in TRAEDE for the full setup steps.
2. A customer starts a return on the external portal
- The customer authenticates with their email and order number.
- The portal fetches the eligible order and claim causes from its own systems or from TRAEDE.
- The customer selects which lines to return, the claim type (
return,claimorexchange) and a claim cause. - The portal decides on return fees and any Shopify gift-card refund options.
3. The portal registers the return in TRAEDE
- The portal calls Upsert a return with the customer email, order number, its own
rmaidentifier and the return lines. - TRAEDE validates the order, the variants and the claim causes, then creates the return in
approvedstatus and responds withcreated: true. - The portal stores the TRAEDE
return.idfor reference if needed. All subsequent calls can still use just the portal's ownrma- TRAEDE's numeric ID is not required.
4. The portal books the return shipment and reports tracking info
- The portal books the return label or dropoff code with its carrier. TRAEDE does not book return labels for external portals.
- Once the carrier has returned a
labelless_code,track_traceortrack_trace_link, the portal replays the Upsert a return call with the samermaand those fields populated. This updates the return in place; the numeric return ID and the existing line IDs are preserved.
5. The warehouse receives the goods
- The customer ships the goods.
- When the goods arrive, the warehouse marks the return as received inside TRAEDE. This can happen by a warehouse operator clicking in TRAEDE, or by a 3PL integration marking the return as received via the 3PL API.
- TRAEDE regulates inventory and creates a credit note for the return in
OPENstatus. External portals always getOPENcredit notes - the brand's "book immediately" settings are ignored for external portals. - TRAEDE dispatches a
return_receivedwebhook to the portal'swebhook_endpoint. See Working with TRAEDE webhooks for the payload and signature format.
6. The portal issues the refund
- On receiving the webhook, the portal issues the refund in the customer's payment provider (typically Shopify).
- The portal computes the final refunded amount.
7. The portal finalizes the return
- The portal calls Finalize a return with the refunded
total_price_after_vat, keyed by the same externalrma. - TRAEDE compares the provided amount against the sum of
total_price_after_vatacross the return's credit notes, with a ±0.01 tolerance. - If the amounts match, TRAEDE books all
OPENcredit notes for the return, which moves it tocredited. - If the amounts do not match, TRAEDE returns a validation error and the portal must either adjust the return with another Upsert a return call and retry, or contact the brand.
Replaying the PUT
The upsert endpoint is idempotent. A portal can safely re-send the same PUT body for the same rma at any time. Between creation and the return being received, each PUT replaces the line set:
- A line that is present in the new body and already exists on the return keeps its TRAEDE line ID (first by exact natural key, then by
variant_id). - A line in the new body that has no match creates a new line on the return.
- A line on the return that is absent from the new body is deleted.
See Line merge behavior for the full matching rules.
Line updates are not accepted once the return has transitioned to received or credited.