pos-refund-shortfall
Method: POST
Path: /pos/shipping/shipments/{order_number}/refund-shortfall
Tags: Shipments
Summary
Refund shortfall
Description
Refunds items of an order's unscheduled shipment that won't be shipped: the shortfall moves to a shipment of its own and is refunded by the original payment or by bank transfer, never beyond what the order's payments have left. Fails with a 409, changing nothing, while refunds are briefly unavailable or the order's payment is held for an admin's review. A refund of a cash or other offline payment in the original mode is manual: done at once when the store marks that payment method paid, else pending until an admin marks it paid or forfeits it.
Pos SDK Usage
SDK Method: pos.refundShortfall()
Example:
const { data, error } = await pos.refundShortfall(
{ order_number: "ORD-2024-001234" },
{
items: [
{
sku: "SKU-123",
quantity: 2,
free_quantity: 0
}
],
payment_method: "original-payment-mode"
}
);
if (error) {
console.error("Failed to process refund:", error.message);
} else {
console.log("Refund processed:", data.message);
console.log("Success:", data.success);
}
// Refund to bank transfer
const { data: bankData, error: bankError } = await pos.refundShortfall(
{ order_number: "ORD-2024-001234" },
{
items: [{ sku: "SKU-123", quantity: 1 }],
payment_method: "bank-transfer",
bank_account_id: "BANK_ACC_123"
}
);TypeScript Definition
"pos-refund-shortfall": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Order Number */
order_number: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
items: {
product_id: string;
/** @description The unique identifier of the product variant. Use `null` if the product has no variants. */
variant_id: string | null;
quantity: number;
/** @default 0 */
free_quantity?: number;
}[];
/** @enum {unknown} */
payment_method: "original-payment-mode" | "bank-transfer";
/** @description required if payment_method = bank-transfer */
bank_account_id?: string | null;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message?: string;
success?: boolean;
};
};
};
400: components["responses"]["AdminBadRequest"];
/** @description The shortfall can't be refunded at the moment. Nothing is changed. */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/**
* @example A shortfall refund waits for the payment ledger update to finish; try again shortly
* @example The order's payment is held for an admin to resolve; it cannot be refunded until then.
*/
message: string;
/** @default false */
success: boolean;
};
};
};
};
};Component References
| Reference | Resolves To |
|---|---|
components["responses"]["AdminBadRequest"] | AdminBadRequest |
Parameters
- order_number (path): Order Number
Request Body
Content Types: application/json
Responses
200
OK
400
409
The shortfall can't be refunded at the moment. Nothing is changed.
OpenAPI Definition
{
"operationId": "pos-refund-shortfall",
"summary": "Refund shortfall",
"description": "Refunds items of an order's unscheduled shipment that won't be shipped: the shortfall moves to a shipment of its own and is refunded by the original payment or by bank transfer, never beyond what the order's payments have left. Fails with a 409, changing nothing, while refunds are briefly unavailable or the order's payment is held for an admin's review. A refund of a cash or other offline payment in the original mode is `manual`: done at once when the store marks that payment method paid, else `pending` until an admin marks it paid or forfeits it.",
"parameters": [
{
"name": "order_number",
"in": "path",
"description": "Order Number",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"required": [
"product_id",
"variant_id",
"quantity"
],
"properties": {
"product_id": {
"type": "string"
},
"variant_id": {
"description": "The unique identifier of the product variant. Use `null` if the product has no variants.",
"type": [
"string",
"null"
]
},
"quantity": {
"type": "integer"
},
"free_quantity": {
"type": "integer",
"default": 0
}
}
}
},
"payment_method": {
"enum": [
"original-payment-mode",
"bank-transfer"
]
},
"bank_account_id": {
"description": "required if payment_method = bank-transfer",
"type": [
"string",
"null"
]
}
},
"required": [
"items",
"payment_method"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/AdminBadRequest"
},
"409": {
"description": "The shortfall can't be refunded at the moment. Nothing is changed.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"examples": [
"A shortfall refund waits for the payment ledger update to finish; try again shortly",
"The order's payment is held for an admin to resolve; it cannot be refunded until then."
]
},
"success": {
"type": "boolean",
"default": false
}
},
"required": [
"message",
"success"
]
}
}
}
}
},
"security": [
{
"Authorization": []
}
],
"tags": [
"Shipments"
],
"x-speakeasy-group": "pos"
}Auto-generated from OpenAPI spec and TypeScript definitions