type Shopify = {
token: string;
store_name: string;
};
/**
* Rejects a fulfillment request
* Rejects a fulfillment request sent to a fulfillment service for a fulfillment order.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
fulfillment_order_id: string,
body: {
fulfillment_request?: { message?: string; [k: string]: unknown };
[k: string]: unknown;
}
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/fulfillment_orders/${fulfillment_order_id}/fulfillment_request/reject.json`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 337 days ago
type Shopify = {
token: string;
store_name: string;
};
/**
* Rejects a fulfillment request
* Rejects a fulfillment request sent to a fulfillment service for a fulfillment order.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
fulfillment_order_id: string,
body: {
fulfillment_request?: { message?: string; [k: string]: unknown };
[k: string]: unknown;
}
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/fulfillment_orders/${fulfillment_order_id}/fulfillment_request/reject.json`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 883 days ago