* initialized next.js project * finished markdown sections * added operation schema component * change page metadata * eslint fixes * fixes related to deployment * added response schema * resolve max stack issue * support for different property types * added support for property types * added loading for components * added more loading * type fixes * added oneOf type * removed console * fix replace with push * refactored everything * use static content for description * fixes and improvements * added code examples section * fix path name * optimizations * fixed tag navigation * add support for admin and store references * general enhancements * optimizations and fixes * fixes and enhancements * added search bar * loading enhancements * added loading * added code blocks * added margin top * add empty response text * fixed oneOf parameters * added path and query parameters * general fixes * added base path env variable * small fix for arrays * enhancements * design enhancements * general enhancements * fix isRequired * added enum values * enhancements * general fixes * general fixes * changed oas generation script * additions to the introduction section * added copy button for code + other enhancements * fix response code block * fix metadata * formatted store introduction * move sidebar logic to Tags component * added test env variables * fix code block bug * added loading animation * added expand param + loading * enhance operation loading * made responsive + improvements * added loading provider * fixed loading * adjustments for small devices * added sidebar label for endpoints * added feedback component * fixed analytics * general fixes * listen to scroll for other headings * added sample env file * update api ref files + support new fields * fix for external docs link * added new sections * fix last item in sidebar not showing * move docs content to www/docs * change redirect url * revert change * resolve build errors * configure rewrites * changed to environment variable url * revert changing environment variable name * add environment variable for API path * fix links * fix tailwind settings * remove vercel file * reconfigured api route * move api page under api * fix page metadata * fix external link in navigation bar * update api spec * updated api specs * fixed google lint error * add max-height on request samples * add padding before loading * fix for one of name * fix undefined types * general fixes * remove response schema example * redesigned navigation bar * redesigned sidebar * fixed up paddings * added feedback component + report issue * fixed up typography, padding, and general styling * redesigned code blocks * optimization * added error timeout * fixes * added indexing with algolia + fixes * fix errors with algolia script * redesign operation sections * fix heading scroll * design fixes * fix padding * fix padding + scroll issues * fix scroll issues * improve scroll performance * fixes for safari * optimization and fixes * fixes to docs + details animation * padding fixes for code block * added tab animation * fixed incorrect link * added selection styling * fix lint errors * redesigned details component * added detailed feedback form * api reference fixes * fix tabs * upgrade + fixes * updated documentation links * optimizations to sidebar items * fix spacing in sidebar item * optimizations and fixes * fix endpoint path styling * remove margin * final fixes * change margin on small devices * generated OAS * fixes for mobile * added feedback modal * optimize dark mode button * fixed color mode useeffect * minimize dom size * use new style system * radius and spacing design system * design fixes * fix eslint errors * added meta files * change cron schedule * fix docusaurus configurations * added operating system to feedback data * change content directory name * fixes to contribution guidelines * revert renaming content * added api-reference to documentation workflow * fixes for search * added dark mode + fixes * oas fixes * handle bugs * added code examples for clients * changed tooltip text * change authentication to card * change page title based on selected section * redesigned mobile navbar * fix icon colors * fix key colors * fix medusa-js installation command * change external regex in algolia * change changeset * fix padding on mobile * fix hydration error * update depedencies
664 lines
17 KiB
Plaintext
664 lines
17 KiB
Plaintext
---
|
||
description: "Learn how to manage claims using the admin REST APIs. This guide includes how to view an order's claims, "
|
||
addHowToData: true
|
||
---
|
||
|
||
import Tabs from '@theme/Tabs';
|
||
import TabItem from '@theme/TabItem';
|
||
|
||
# How to Manage Claims
|
||
|
||
In this document, you’ll learn how to manage claims using the admin REST APIs.
|
||
|
||
## Overview
|
||
|
||
Using Medusa’s claim admin REST APIs, you can manage claims and perform related admin functionalities.
|
||
|
||
### Scenario
|
||
|
||
You want to add or use the following admin functionalities:
|
||
|
||
- View an order’s claims
|
||
- Manage claims, including creating, updating, and canceling claims.
|
||
- Manage a claim’s fulfillment, including creating a fulfillment, creating a shipment, and canceling a fulfillment.
|
||
|
||
:::note
|
||
|
||
You can learn about managing returns part of a claim in the [Manage Returns documentation](./manage-returns.mdx).
|
||
|
||
:::
|
||
|
||
---
|
||
|
||
## Prerequisites
|
||
|
||
### Medusa Components
|
||
|
||
It is assumed that you already have a Medusa backend installed and set up. If not, you can follow our [quickstart guide](../../../development/backend/install.mdx) to get started.
|
||
|
||
### JS Client
|
||
|
||
This guide includes code snippets to send requests to your Medusa backend using Medusa’s JS Client, among other methods.
|
||
|
||
If you follow the JS Client code blocks, it’s assumed you already have [Medusa’s JS Client](../../../js-client/overview.md) installed and have [created an instance of the client](../../../js-client/overview.md#configuration).
|
||
|
||
### Medusa React
|
||
|
||
This guide also includes code snippets to send requests to your Medusa backend using Medusa React, among other methods.
|
||
|
||
If you follow the Medusa React code blocks, it's assumed you already have [Medusa React installed](../../../medusa-react/overview.mdx) and have [used MedusaProvider higher in your component tree](../../../medusa-react/overview.mdx#usage).
|
||
|
||
### Authenticated Admin User
|
||
|
||
You must be an authenticated admin user before following along with the steps in the tutorial.
|
||
|
||
You can learn more about [authenticating as an admin user in the API reference](https://docs.medusajs.com/api/admin#authentication).
|
||
|
||
---
|
||
|
||
## View Order’s Claims
|
||
|
||
To view an order’s claims, you can retrieve the order using the [Get Order endpoint](https://docs.medusajs.com/api/admin#orders_getordersorder) and access the order’s claims:
|
||
|
||
<Tabs groupId="request-type" isCodeTabs={true}>
|
||
<TabItem value="client" label="Medusa JS Client" default>
|
||
|
||
```ts
|
||
medusa.admin.orders.retrieve(orderId)
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="medusa-react" label="Medusa React">
|
||
|
||
```tsx
|
||
import { useAdminOrder } from "medusa-react"
|
||
|
||
const Order = () => {
|
||
const {
|
||
order,
|
||
isLoading,
|
||
} = useAdminOrder(orderId)
|
||
|
||
return (
|
||
<div>
|
||
{isLoading && <span>Loading...</span>}
|
||
{order && (
|
||
<>
|
||
<span>{order.display_id}</span>
|
||
{order.claims?.length > 0 && (
|
||
<ul>
|
||
{order.claims.map((claim) => (
|
||
<li key={claim.id}>{claim.id}</li>
|
||
))}
|
||
</ul>
|
||
)}
|
||
</>
|
||
)}
|
||
|
||
</div>
|
||
)
|
||
}
|
||
|
||
export default Order
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="fetch" label="Fetch API">
|
||
|
||
```ts
|
||
fetch(`<BACKEND_URL>/admin/orders/${orderId}`, {
|
||
credentials: "include",
|
||
})
|
||
.then((response) => response.json())
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="curl" label="cURL">
|
||
|
||
```bash
|
||
curl -L -X GET '<BACKEND_URL>/admin/orders/<ORDER_ID>' \
|
||
-H 'Authorization: Bearer <API_TOKEN>'
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
This request requires the order’s ID as a path parameter.
|
||
|
||
The request returns the order as an object. In that object, you can access an array of claim objects using the property `claims` of the order object.
|
||
|
||
---
|
||
|
||
## Create Claim
|
||
|
||
You can create a claim by sending a request to the [Create Claim endpoint](https://docs.medusajs.com/api/admin#orders_postordersorderclaims):
|
||
|
||
<Tabs groupId="request-type" isCodeTabs={true}>
|
||
<TabItem value="client" label="Medusa JS Client" default>
|
||
|
||
```ts
|
||
medusa.admin.orders.createClaim(orderId, {
|
||
type: "refund",
|
||
claim_items: [
|
||
{
|
||
item_id,
|
||
quantity: 1,
|
||
},
|
||
],
|
||
})
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="medusa-react" label="Medusa React">
|
||
|
||
```tsx
|
||
import { useAdminCreateClaim } from "medusa-react"
|
||
|
||
const CreateClaim = () => {
|
||
const createClaim = useAdminCreateClaim(orderId)
|
||
// ...
|
||
|
||
const handleCreate = () => {
|
||
createClaim.mutate({
|
||
type: "refund",
|
||
claim_items: [
|
||
{
|
||
item_id,
|
||
quantity: 1,
|
||
},
|
||
],
|
||
})
|
||
}
|
||
|
||
// ...
|
||
}
|
||
|
||
export default CreateClaim
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="fetch" label="Fetch API">
|
||
|
||
```ts
|
||
fetch(`<BACKEND_URL>/admin/orders/${orderId}/claims`, {
|
||
credentials: "include",
|
||
method: "POST",
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
},
|
||
body: JSON.stringify({
|
||
type: "refund",
|
||
claim_items: [
|
||
{
|
||
item_id,
|
||
quantity: 1,
|
||
},
|
||
],
|
||
}),
|
||
})
|
||
.then((response) => response.json())
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="curl" label="cURL">
|
||
|
||
```bash
|
||
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims' \
|
||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||
-H 'Content-Type: application/json' \
|
||
--data-raw '{
|
||
"type": "refund",
|
||
"claim_items": [
|
||
{
|
||
"item_id": "<ITEM_ID>",
|
||
"quantity": 1
|
||
}
|
||
]
|
||
}'
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
This endpoint requires the order ID to be passed as a path parameter.
|
||
|
||
In the request body, the following parameters are required:
|
||
|
||
- `type`: a string indicating the type of claim to be created. Its value can either be `replace` or `refund`. If the type is `replace`, you can pass the `additional_items` parameter with an array of new items to send to the customer. If the type is `refund`, you can pass the `refund_amount` parameter if you want to specify a custom refund amount.
|
||
- `claim_items`: an array of objects, each object being the item in the order that the claim is being created for. In the object, you must pass the following properties:
|
||
- `item_id`: a string indicating the ID of the line item in the order.
|
||
- `quantity`: a number indicating the quantity of the claim.
|
||
|
||
There are other optional parameters that you can pass. You can also pass a return reason for each of the claim items. You can learn about the optional request body parameters in the [API reference](https://docs.medusajs.com/api/admin#orders_postordersorderclaims).
|
||
|
||
:::note
|
||
|
||
Learn how to manage return reasons in [this documentation](./manage-returns.mdx#manage-return-reasons).
|
||
|
||
:::
|
||
|
||
The request returns the updated order as an object. You can access the order’s claims using the `claims` property of the order object. The value of the `claims` property is an array of claim objects.
|
||
|
||
---
|
||
|
||
## Update a Claim
|
||
|
||
You can update a claim by sending a request to the [Update Claim endpoint](https://docs.medusajs.com/api/admin#orders_postordersorderclaimsclaim):
|
||
|
||
<Tabs groupId="request-type" isCodeTabs={true}>
|
||
<TabItem value="client" label="Medusa JS Client" default>
|
||
|
||
```ts
|
||
medusa.admin.orders.updateClaim(orderId, claimId, {
|
||
no_notification: true,
|
||
})
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="medusa-react" label="Medusa React">
|
||
|
||
```tsx
|
||
import { useAdminUpdateClaim } from "medusa-react"
|
||
|
||
const UpdateClaim = () => {
|
||
const updateClaim = useAdminUpdateClaim(orderId)
|
||
// ...
|
||
|
||
const handleUpdate = () => {
|
||
updateClaim.mutate({
|
||
claim_id,
|
||
no_notification: true,
|
||
})
|
||
}
|
||
|
||
// ...
|
||
}
|
||
|
||
export default UpdateClaim
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="fetch" label="Fetch API">
|
||
|
||
```ts
|
||
fetch(
|
||
`<BACKEND_URL>/admin/orders/${orderId}/claims/${claimId}`,
|
||
{
|
||
credentials: "include",
|
||
method: "POST",
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
},
|
||
body: JSON.stringify({
|
||
no_notification: true,
|
||
}),
|
||
}
|
||
)
|
||
.then((response) => response.json())
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="curl" label="cURL">
|
||
|
||
```bash
|
||
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>' \
|
||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||
-H 'Content-Type: application/json' \
|
||
--data-raw '{
|
||
"no_notification": true
|
||
}'
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
This endpoint requires the ID of the order and the claim to be passed as path parameters.
|
||
|
||
In the request body, you can pass any of the claim’s fields that you want to update as parameters. In the example above, the `no_notification` field is updated.
|
||
|
||
The request returns the updated order as an object. You can access the order’s claims using the `claims` property of the order object. The value of the `claims` property is an array of claim objects.
|
||
|
||
---
|
||
|
||
## Manage a Claim’s Fulfillments
|
||
|
||
### View Claim’s Fulfillments
|
||
|
||
Fulfillments are available on a claim object under the `fulfillments` property, which is an array of fulfillment objects.
|
||
|
||
### Create Fulfillment
|
||
|
||
You can create a fulfillment for a claim by sending a request to the [Create Claim Fulfillment endpoint](https://docs.medusajs.com/api/admin#orders_postordersorderclaimsclaimfulfillments):
|
||
|
||
<Tabs groupId="request-type" isCodeTabs={true}>
|
||
<TabItem value="client" label="Medusa JS Client" default>
|
||
|
||
```ts
|
||
medusa.admin.orders.fulfillClaim(orderId, claimId, {
|
||
})
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="medusa-react" label="Medusa React">
|
||
|
||
```tsx
|
||
import { useAdminFulfillClaim } from "medusa-react"
|
||
|
||
const FulfillClaim = () => {
|
||
const fulfillClaim = useAdminFulfillClaim(orderId)
|
||
// ...
|
||
|
||
const handleFulfill = () => {
|
||
fulfillClaim.mutate({
|
||
claim_id,
|
||
})
|
||
}
|
||
|
||
// ...
|
||
}
|
||
|
||
export default FulfillClaim
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="fetch" label="Fetch API">
|
||
|
||
<!-- eslint-disable max-len -->
|
||
|
||
```ts
|
||
fetch(`<BACKEND_URL>/admin/orders/${orderId}/claims/${claimId}/fulfillments`, {
|
||
credentials: "include",
|
||
method: "POST",
|
||
})
|
||
.then((response) => response.json())
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="curl" label="cURL">
|
||
|
||
```bash
|
||
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/fulfillments' \
|
||
-H 'Authorization: Bearer <API_TOKEN>'
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
This endpoint requires the order and claim IDs as path parameters.
|
||
|
||
In the request body, you can pass optional parameters such as `metadata` or `no_notification`. These parameters will be used to create the fulfillment. You can learn more about available request body parameters in the [API reference](https://docs.medusajs.com/api/admin#orders_postordersorderclaimsclaimfulfillments).
|
||
|
||
The request returns the updated order as an object. You can access the order’s claims using the `claims` property of the order object. The value of the `claims` property is an array of claim objects.
|
||
|
||
### Create a Shipment
|
||
|
||
You can create a shipment for a claim by sending a request to the [Create Claim Shipment endpoint](https://docs.medusajs.com/api/admin#orders_postordersorderclaimsclaimshipments):
|
||
|
||
<Tabs groupId="request-type" isCodeTabs={true}>
|
||
<TabItem value="client" label="Medusa JS Client" default>
|
||
|
||
```ts
|
||
medusa.admin.orders.createClaimShipment(orderId, claimId, {
|
||
fulfillment_id,
|
||
})
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="medusa-react" label="Medusa React">
|
||
|
||
```tsx
|
||
import { useAdminCreateClaimShipment } from "medusa-react"
|
||
|
||
const CreateShipment = () => {
|
||
const createShipment = useAdminCreateClaimShipment(orderId)
|
||
// ...
|
||
|
||
const handleCreate = () => {
|
||
createShipment.mutate({
|
||
claim_id,
|
||
fulfillment_id,
|
||
})
|
||
}
|
||
|
||
// ...
|
||
}
|
||
|
||
export default CreateShipment
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="fetch" label="Fetch API">
|
||
|
||
<!-- eslint-disable max-len -->
|
||
|
||
```ts
|
||
fetch(`<BACKEND_URL>/admin/orders/${orderId}/claims/${claimId}/shipments`, {
|
||
credentials: "include",
|
||
method: "POST",
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
},
|
||
body: JSON.stringify({
|
||
fulfillment_id,
|
||
}),
|
||
})
|
||
.then((response) => response.json())
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="curl" label="cURL">
|
||
|
||
```bash
|
||
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/shipments' \
|
||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||
-H 'Content-Type: application/json' \
|
||
--data-raw '{
|
||
"fulfillment_id": "<FUL_ID>"
|
||
}'
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
This endpoint requires the order and claim IDs as path parameters.
|
||
|
||
In the request body, it’s required to pass the `fulfillment_id` parameter, which is the ID of the fulfillment the shipment is being created for. You can pass other optional parameters, such as an array of tracking numbers. You can learn more in the [API reference](https://docs.medusajs.com/api/admin#orders_postordersorderclaimsclaimshipments).
|
||
|
||
The request returns the updated order as an object. As mentioned before, a claim’s fulfillments can be accessed using the `fulfillments` property of a claim object. You can access the shipments, known as tracking links, of a fulfillment using the `tracking_links` property of a fulfillment object. The value of `tracking_links` is an array of tracking link objects.
|
||
|
||
You can alternatively access the tracking numbers using the `tracking_numbers` property of a fulfillment object, which is an array of strings.
|
||
|
||
You can access the status of a claim’s fulfillment using the `fulfillment_status` property of a claim object.
|
||
|
||
### Cancel Fulfillment
|
||
|
||
:::note
|
||
|
||
You can’t cancel a fulfillment that has a shipment
|
||
|
||
:::
|
||
|
||
You can cancel a fulfillment by sending a request to the [Cancel Fulfillment endpoint](https://docs.medusajs.com/api/admin#orders_postordersclaimfulfillmentscancel):
|
||
|
||
<Tabs groupId="request-type" isCodeTabs={true}>
|
||
<TabItem value="client" label="Medusa JS Client" default>
|
||
|
||
```ts
|
||
medusa.admin.orders.cancelClaimFulfillment(
|
||
orderId,
|
||
claimId,
|
||
fulfillmentId
|
||
)
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="medusa-react" label="Medusa React">
|
||
|
||
```tsx
|
||
import { useAdminCancelClaimFulfillment } from "medusa-react"
|
||
|
||
const CancelFulfillment = () => {
|
||
const cancelFulfillment = useAdminCancelClaimFulfillment(
|
||
orderId
|
||
)
|
||
// ...
|
||
|
||
const handleCancel = () => {
|
||
cancelFulfillment.mutate({
|
||
claim_id,
|
||
fulfillment_id,
|
||
})
|
||
}
|
||
|
||
// ...
|
||
}
|
||
|
||
export default CancelFulfillment
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="fetch" label="Fetch API">
|
||
|
||
<!-- eslint-disable max-len -->
|
||
|
||
```ts
|
||
fetch(`<BACKEND_URL>/admin/orders/${orderId}/claims/${claimId}/fulfillments/${fulfillmentId}/cancel`, {
|
||
credentials: "include",
|
||
method: "POST",
|
||
})
|
||
.then((response) => response.json())
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="curl" label="cURL">
|
||
|
||
```bash
|
||
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/fulfillments/<FUL_ID>/cancel' \
|
||
-H 'Authorization: Bearer <API_TOKEN>'
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
This endpoint requires the order, claim, and fulfillment IDs to be passed as path parameters.
|
||
|
||
The request returns the updated order as an object. You can access the claims using the `claims` property of the order object, which is an array of claim objects.
|
||
|
||
You can check the fulfillment status of a claim using the `fulfillment_status` property of the claim object.
|
||
|
||
---
|
||
|
||
## Cancel Claim
|
||
|
||
:::note
|
||
|
||
You can’t cancel a claim that has been refunded. You must also cancel the claim’s fulfillments and return first.
|
||
|
||
:::
|
||
|
||
You can cancel a claim by sending a request to the [Cancel Claim endpoint](https://docs.medusajs.com/api/admin#orders_postordersclaimcancel):
|
||
|
||
<Tabs groupId="request-type" isCodeTabs={true}>
|
||
<TabItem value="client" label="Medusa JS Client" default>
|
||
|
||
```ts
|
||
medusa.admin.orders.cancelClaim(orderId, claimId)
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="medusa-react" label="Medusa React">
|
||
|
||
```tsx
|
||
import { useAdminCancelClaim } from "medusa-react"
|
||
|
||
const CancelClaim = () => {
|
||
const cancelClaim = useAdminCancelClaim(orderId)
|
||
// ...
|
||
|
||
const handleCancel = () => {
|
||
cancelClaim.mutate(claimId)
|
||
}
|
||
|
||
// ...
|
||
}
|
||
|
||
export default CancelClaim
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="fetch" label="Fetch API">
|
||
|
||
<!-- eslint-disable max-len -->
|
||
|
||
```ts
|
||
fetch(`<BACKEND_URL>/admin/orders/${orderId}/claims/${claimId}/cancel`, {
|
||
credentials: "include",
|
||
method: "POST",
|
||
})
|
||
.then((response) => response.json())
|
||
.then(({ order }) => {
|
||
console.log(order.claims)
|
||
})
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="curl" label="cURL">
|
||
|
||
```bash
|
||
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/cancel' \
|
||
-H 'Authorization: Bearer <API_TOKEN>'
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
This endpoint requires the order and claim IDs as path parameters.
|
||
|
||
The request returns the updated order as an object. You can access the claims using the `claims` property of the order object, which is an array of claim objects.
|
||
|
||
---
|
||
|
||
## See Also
|
||
|
||
- [How to manage returns](./manage-returns.mdx)
|
||
- [How to manage orders](./manage-orders.mdx)
|