360 Secure SkillHub
360 安全技能中心

Crossly Returns refunds

提供 Crossly 订单退款、取消、退货和争议处理的 API 集成指引,包含权限范围、幂等退款、退货状态流转、争议证据与 Webhook 事件说明,并给出 TypeScript SDK 与 curl 调用示例。

分类:开发
crossly
热度 13.12
最近更新 2026-11-30 11:11:41

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add crossly/crossly-returns-refunds
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
crossly-returns-refunds
description
Refund, cancel, return and dispute Crossly orders through the API. Check GET /v1/orders/{id}/refund-options, refund in full or part with POST /v1/orders/{id}/refunds (scope orders:refund, dollars, idempotent ledger, never past what the buyer paid), resolve unverified refunds, cancel with GET /v1/orders/{id}/cancel-eligibility and POST /v1/orders/{id}/cancel, run the physical return workflow on /v1/returns (create, received, inspected, restocked), accept or decline Crossly-marketplace return requests, flag disputes and gather delivery evidence, and react to order.refunded, refund.issued, order.cancelled and return.* webhooks. Use when building customer-service, refund, returns-processing or dispute tooling on Crossly.

Refunds, cancellations, returns and disputes

Four separate things, each with its own endpoint:

  • Refund: money back to the buyer, on the order (POST /v1/orders/{id}/refunds).
  • Cancel: the order never ships (POST /v1/orders/{id}/cancel). On a Crossly-marketplace order it refunds the buyer too.
  • Return: the goods come back (/v1/returns). A return record does not move money by itself.
  • Dispute: a case against the order (POST /v1/orders/{id}/dispute), backed by delivery evidence.

Scopes:

Scope Allows
orders:read Refund history and options, cancel eligibility, returns, evidence
orders:refund POST /v1/orders/{id}/refunds and /resolve; needed in addition to orders:write to cancel a Crossly-marketplace order or refund while accepting a return
orders:write Cancel, returns create/update/accept/decline, disputes

orders:write alone cannot call /refunds. fulfillment:write can do none of this. Auth: crossly-api-setup; errors and retries: crossly-api-conventions.

Setup

  1. Create a free Crossly account: https://crossly.net/register
  2. Create a personal access token at https://crossly.net/settings/api/tokens/new (guide: https://crossly.net/guides/personal-access-tokens). Use a crossly_pat_test_ token against the sandbox while building.
  3. Export it as CROSSLY_PAT and send it as Authorization: Bearer $CROSSLY_PAT to https://crossly.net/api/v1/*. Full docs: https://crossly.net/docs

Refunds

1. Ask what the platform allows

import { createClient } from '@crossly/sdk';
const crossly = createClient({ pat: process.env.CROSSLY_PAT! });

// GET /v1/orders/{id}/refund-options
const opts = await crossly.orders.refundOptions(orderId);
// { supported, full, partial, partialCap: 'item' | 'total' | null, beforeShipment,
//   reasons: [{ key, label }] | null, comment, cancelsSale, untilCompleted, windowClosed, note }
  • supported: false: Crossly can't refund this platform's orders; refund on the marketplace.
  • partialCap: 'item' means a partial is capped at the item price, total at what the buyer paid.
  • When reasons is a list, the refund's reason must be one of its keys.
  • cancelsSale (Mercari): the refund IS the cancellation and must be full. windowClosed: the platform's refund window ended when the order completed.

2. Refund

// POST /v1/orders/{id}/refunds  (orders:refund)
const r = await crossly.orders.createRefund(orderId, {
  reason: 'buyer_requested',          // required, 1-500 chars (or a key from refund-options)
  amount: 12.5,                       // DOLLARS; omit for everything left
  comment: 'Sorry about the stain.',  // optional, <= 1000, only where the platform takes one
}, { idempotencyKey: crypto.randomUUID() });
// 201 { id, orderId, amount, full, status, platform, platformRefundId, source, lineItems,
//       totalRefunded, remaining, replayed, createdAt, completedAt }
curl -X POST https://crossly.net/api/v1/orders/$ORDER_ID/refunds \
  -H "Authorization: Bearer $CROSSLY_PAT" -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" -d '{"reason":"Item arrived damaged","amount":12.50}'
  • Money is dollars (12.5 = $12.50, max 1,000,000). lineItems (1-50 entries of { quantity, orderId?, amount? }) refunds units of the order instead of an amount.
  • Idempotency is built in. The ledger keys on the Idempotency-Key header, or on a hash of the body when you send none: the same request twice refunds once (the replay answers 200 with replayed: true). Two deliberate, identical partial refunds therefore need two different keys.
  • Crossly-marketplace orders refund the buyer's card; crossposted orders refund through the marketplace where Crossly can (eBay, Shopify, Etsy, WooCommerce, BigCommerce, Square, Walmart, Reverb, Allegro, Kaufland, Amazon, TikTok Shop and others: trust refund-options, not this list).
  • A partial refund keeps the order's status. Fires order.refunded and the older refund.issued.

Refund status: pending, reconciling, succeeded, failed, unverified (and pending_app when an app that manages the order must carry it out).

Code Status What to do
refund_exceeds_remaining 422 Lower the amount; details.remaining (dollars) is what is left
already_refunded 409 Nothing left to refund
refund_exceeds_item_amount 422 Over the item price on a partialCap: item platform (details.itemAmount)
partial_refund_unsupported, full_refund_unsupported, invalid_refund_reason 400 Outside the platform's capability; read refund-options
amount_required 422 The sale price isn't known yet (detailsPending): name the amount
invalid_amount, invalid_line_item 400 Fix the body
refund_in_progress 409 Retry later with the same key to read the outcome
refund_unverified 409 Check the marketplace, then resolve (below)
not_supported_on_platform 422 Refund on the marketplace
conflict (details.reason: refund_window_closed) 409 The platform's window is over
refund_unavailable 503 Temporary; retry with the same key
refund_failed 502 The marketplace refused; a retry with the same key tries again

Unverified refunds: when Crossly couldn't confirm a marketplace refund after an interruption, check the marketplace and settle it: crossly.orders.resolveRefund(orderId, refundId, { outcome: 'succeeded', amount?, platformRefundId? }) (POST /v1/orders/{id}/refunds/{refundId}/resolve). failed means nothing moved and the same Idempotency-Key may try again. Crossly-marketplace refunds are confirmed by support instead.

History: crossly.orders.listRefunds(orderId) (GET /v1/orders/{id}/refunds, newest first, dollars). The order also carries refundAmount, refundReason, refundedAt.

POST /v1/orders/{id}/refund (singular) is deprecated: same ledger, accepts orders:refund or orders:write, answers with a Deprecation header. Use /refunds.

Cancellations

// GET /v1/orders/{id}/cancel-eligibility  (orders:read)
const el = await crossly.orders.cancelEligibility(orderId);   // { eligible, eligibleCancelReason[], failureReason[], source }

// POST /v1/orders/{id}/cancel  (orders:write; + orders:refund on a Crossly-marketplace order)
const c = await crossly.orders.cancel(orderId,
  { reason: 'Out of stock' },                // <= 80 chars; where eligibleCancelReason lists codes, send one
  { idempotencyKey: crypto.randomUUID() });
// { orderId, platform, cancelledInCrossly, platformCancel, jobId?, error?, refund? }
  • Only before shipment: a shipped order answers 409 already_shipped (refund or open a return instead).
  • A 200 does not mean the marketplace cancelled. Read platformCancel: sent, queued, relayed (a managing app will do it), failed, unsupported, no_platform_order_id, recorded_only, already_cancelled.
  • Platform can't cancel through Crossly: 422 not_supported_on_platform. Cancel on the marketplace, then call again with recordOnly: true to record it.
  • Crossly-marketplace orders: refunds the buyer in full first (idempotent per order) and restocks; if the refund fails, nothing is cancelled. Without orders:refund: 403 insufficient_scope.
  • Fires order.cancelled.

Returns (physical workflow)

// POST /v1/returns  (orders:write)
const ret = await crossly.returns.create(
  { orderId, reason: 'Fit runs small.' },               // reason <= 2000
  { idempotencyKey: crypto.randomUUID() }) as { id: string };

// PATCH /v1/returns/{id}
await crossly.returns.update(ret.id, { status: 'received' }, { idempotencyKey: crypto.randomUUID() });
await crossly.returns.update(ret.id, {
  status: 'restocked',
  restockedToInventoryItemId: inventoryItemId,          // where stock goes back
  notes: 'Tags attached. Bin B-3.',                      // <= 4000
}, { idempotencyKey: crypto.randomUUID() });

Statuses: open requested, in_transit, received, inspected; closed restocked, damaged, resold, cancelled. Transitions are not enforced. The first move into received, inspected and restocked stamps receivedAt, inspectedAt, restockedAt. Moving to restocked with a restockedToInventoryItemId adds the order's quantity back to that item, once (repeating is a no-op).

  • GET /v1/returns?status=open|closed|<exact>&page=&limit=&assignee= (crossly.returns.list), GET /v1/returns/{id} (crossly.returns.get).
  • One open return per order: a second create is 409 open_return_exists with details.existingReturnId. Unknown order: 404 order_not_found.
  • refundAmount on a return is informational; refund the order with /refunds.

Crossly-marketplace return requests

Buyers on the Crossly marketplace ask to return; you answer.

  • List: crossly.returns.listRequests() (GET /v1/returns?source=request): reason, buyerNote, photoUrls, state, awaitingParty, actionable, respondBy, returnTracking.
  • Accept: crossly.returns.accept(id, { refund: { amount?, reason? } }) (POST /v1/returns/{id}/accept): issues a prepaid return label to the store's return address (the buyer has 14 days to ship) and a linked return record. With refund, also refunds now (dollars; needs orders:refund, else 403 insufficient_scope); without it, the rest is refunded when the return is delivered. Safe to repeat.
  • Decline: crossly.returns.decline(id, { reason }) (POST /v1/returns/{id}/decline, reason 8-2000 chars, sent to the buyer). It doesn't close the request: the buyer can reply or ask Crossly to decide. Not after the label is issued.
  • Errors: not_found, already_accepted, return_closed, with_crossly (Crossly is deciding), not_a_return, order_missing, message_blocked, not_supported_on_platform (crossposted orders), label_failed (502).

Returns under your storefront return policy or try-at-home: GET /v1/policy-returns?orderId= (orders:read) and POST /v1/policy-returns/{id}/received (orders:write), which refunds the buyer less your restocking or try fee (refundCents).

Disputes and evidence

  • crossly.orders.dispute(orderId, { reason, platformCaseId? }) (POST /v1/orders/{id}/dispute, orders:write; reason 1-1000, case id <= 200): flags the order disputed through the same path auto-detection uses. POST /v1/orders/bulk-mark-disputed takes { orderIds, reason }.
  • Evidence for the marketplace: GET /v1/orders/{id}/proof-of-delivery (carrier scans, signature, postalCodeMatches, gaps), GET /v1/orders/{id}/delivery-photo, GET /v1/orders/{id}/evidence (packing capture, seal comparison, arrival condition), GET /v1/orders/{id}/units (serials that shipped). See crossly-shipping-labels.

Webhooks

Event When
order.refunded A refund on an order, full or partial: amount, running total, anything left
refund.issued The older refund event, still sent alongside order.refunded
order.cancelled Cancelled before it shipped
return.requested A Crossly-marketplace buyer asked to return: reason, note, photos
return.resolved A return request closed: refunded in full or part, no refund, or withdrawn
order.returned A return closed with the item back
order.disputed A buyer opened a case or chargeback: reason and response deadline
order.dispute_closed A case closed: who it was decided for, any amount refunded

An OAuth app needs orders:read to receive them. Setup and signatures: crossly-webhooks.

Rules

  • Read refund-options (and cancel-eligibility) before offering a refund or cancel in your UI.
  • Always confirm the amount with the seller before refunding; refunds can't be undone.
  • One Idempotency-Key per intended refund. Reuse it when retrying; use a new one only for a genuinely new refund.
  • Amounts on refunds are dollars (convert to integer cents before summing); policy-return and funding amounts are cents.
  • After a cancel, check platformCancel, not the HTTP status.
  • Don't log buyer notes, photos or addresses longer than the case needs.

Docs: https://crossly.net/docs/api-returns · https://crossly.net/docs/api-orders · https://crossly.net/docs/returns · https://crossly.net/docs/orders-and-shipping