file-circle-exclamationEdit Return API

Use this endpoint to apply post-registration edit operations to a return.

Production endpoint URL:

https://returns-api.parcellab.com/prod/editReturnById

For details on access, view the overview here:

square-codeRMA Actions APIchevron-right

Supported Operation

Currently supported:

  • cancel_exchange

What cancel_exchange Achieves

This operation reverts an exchange-oriented return back to refund-oriented processing.

When successful, it may:

  • Convert exchange compensation methods to refund

  • Clear uneven-exchange items

  • Ensure a refund method exists (defaults to original-payment-method if missing)

  • Attempt to delete related Shopify draft order

  • Remove stored Shopify draft-order references from return data

  • Propagate changes to backend tracking

  • Tag Shopify order with parcellab_exchange_cancelled (best effort)

Request

Headers

Header
Required
Type

user

yes

string

Content-Type

yes

string (application/json)

JSON Body

Field
Required
Type
Rules
Description

returnId

yes

string

24-character ID

Return to edit.

lang

yes

string

min length 1

Language context.

country

yes

string

min length 1

Country/market context.

operation

yes

string

must be cancel_exchange

Edit operation.

draft

no

string

optional

Set to true for draft config.

operationPayload

no

object

optional

Operation-specific payload.

operationPayload.cancelReason

no

string

optional

Currently accepted, not persisted by this operation.

Example Request

Success Responses (200 OK)

Updated

Skipped

Common reason values:

  • return_already_closed

  • no_changes_required

Shopify Behavior

For Shopify-connected returns:

  1. If a draft order exists, deletion is attempted.

  2. If draft deletion fails, the operation can still continue and return shopifyDraftOrder.error.

  3. A Shopify order tag (parcellab_exchange_cancelled) is attempted in best-effort mode (tag failure does not fail the endpoint).

Error Responses

Status
Error value
Meaning

400

Payload schema validation failed.

Missing/invalid request input.

400

Invalid request body format.

Invalid JSON body.

400

Update return failed.

Persisting return changes failed.

400

No modifiers to update is set

No valid state change could be applied.

403

FORBIDDEN

returnId is not accessible in caller context.

404

User not found.

Merchant context not found.

404

Order does not exist.

returnId not found.

500

implementation-defined

Unexpected server error.

Last updated

Was this helpful?