pos-create-order-payment-request
Method: POST
Path: /pos/orders/{order_number}/payments
Tags: Order payments
Summary
Create order payment
Description
Requests a payment of amount toward what is left to pay on an order, with another payment method: to pay after a failed or abandoned payment, or to split the payment across methods. Returns the order's OrderPayments, the pending_amount left to request and, for a gateway, the payment_info to start its payment flow. A shopper's token reaches only their own orders; a POS token, the orders rung up at its location. The payment method must be one the store offers on the token's sales channel (GET /payments/payment-methods lists them); any other is refused with a 400. A manual method the store marks as paid is recorded as paid at once. E-collection, NACH and credit-line methods can't be added, and a cancelled order takes no payment (the order-cancelled error code).
Pos SDK Usage
SDK Method: pos.createOrderPaymentRequest()
Example:
const { data, error } = await pos.createOrderPaymentRequest(
{ order_number: "1234567890" },
{ amount: 500, payment_method: { payment_provider_slug: "cash" } }
);
if (error) {
console.error("Failed to create payment request:", error.message);
} else {
console.log("Pending amount:", data.pending_amount);
console.log("Payments:", data.payments.length);
}TypeScript Definition
"pos-create-order-payment-request": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The unique identifier of the Order. */
order_number: string;
};
cookie?: never;
};
/** @description Request body */
requestBody: {
content: {
"application/json": {
/**
* Format: double
* @description Amount to request for this payment method. The total requested amount cannot exceed the order's `to_be_paid`.
*/
amount: number;
payment_method: components["schemas"]["OrderPaymentMethodPayload"];
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: $Read<string>;
success: $Read<boolean>;
content: {
/** @description All payment records for the order after creating this request. */
payments: components["schemas"]["OrderPaymentRecord"][];
/** @description `true` if the order has a payable amount. */
payment_required: boolean;
/**
* Format: double
* @description Remaining amount that can still be requested for this order: what is left of its `to_be_paid` after the payments requested so far, never below `0`. Payments that failed or were refunded don't count against it, nor do loyalty points or the credit balance the order uses.
*/
pending_amount: number;
/** @description Gateway initiation details when an auto payment method is used; otherwise `null`. */
payment_info: components["schemas"]["JusPayHyperCheckoutResponse"] | components["schemas"]["JusPayExpressCheckoutResponse"] | null | components["schemas"]["PayuPaymentInfo"];
};
};
};
};
/** @description Invalid payment request. `payment-method-already-exists` means this provider already has an active payment; `payment-amount-exceeds-pending` means the amount exceeds what remains payable. */
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["OrderPaymentMethodPayload"] | OrderPaymentMethodPayload |
components["schemas"]["OrderPaymentRecord"] | OrderPaymentRecord |
components["schemas"]["JusPayHyperCheckoutResponse"] | JusPayHyperCheckoutResponse |
components["schemas"]["JusPayExpressCheckoutResponse"] | JusPayExpressCheckoutResponse |
components["schemas"]["PayuPaymentInfo"] | PayuPaymentInfo |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["NotFound"] | NotFound |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- order_number (path): The unique identifier of the Order.
Request Body
Request body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
404
Requested resource not found
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"operationId": "pos-create-order-payment-request",
"summary": "Create order payment",
"description": "Requests a payment of `amount` toward what is left to pay on an order, with another payment method: to pay after a failed or abandoned payment, or to split the payment across methods. Returns the order's `OrderPayment`s, the `pending_amount` left to request and, for a gateway, the `payment_info` to start its payment flow. A shopper's token reaches only their own orders; a POS token, the orders rung up at its location. The payment method must be one the store offers on the token's sales channel (`GET /payments/payment-methods` lists them); any other is refused with a 400. A manual method the store marks as paid is recorded as paid at once. E-collection, NACH and credit-line methods can't be added, and a cancelled order takes no payment (the `order-cancelled` error code).",
"parameters": [
{
"name": "order_number",
"in": "path",
"description": "The unique identifier of the Order.",
"required": true,
"schema": {
"type": "string",
"maxLength": 128,
"minLength": 1,
"pattern": "^[A-Za-z0-9_-]{1,128}$"
}
}
],
"requestBody": {
"description": "Request body",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"amount": {
"description": "Amount to request for this payment method. The total requested amount cannot exceed the order's `to_be_paid`.",
"type": "number",
"format": "double",
"maximum": 9999999999999.99,
"minimum": 0.01,
"multipleOf": 0.01
},
"payment_method": {
"$ref": "#/components/schemas/OrderPaymentMethodPayload"
}
},
"required": [
"amount",
"payment_method"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"readOnly": true
},
"success": {
"type": "boolean",
"readOnly": true
},
"content": {
"properties": {
"payments": {
"description": "All payment records for the order after creating this request.",
"type": "array",
"items": {
"$ref": "#/components/schemas/OrderPaymentRecord"
}
},
"payment_required": {
"description": "`true` if the order has a payable amount.",
"type": "boolean"
},
"pending_amount": {
"description": "Remaining amount that can still be requested for this order: what is left of its `to_be_paid` after the payments requested so far, never below `0`. Payments that failed or were refunded don't count against it, nor do loyalty points or the credit balance the order uses.",
"type": "number",
"format": "double"
},
"payment_info": {
"description": "Gateway initiation details when an auto payment method is used; otherwise `null`.",
"anyOf": [
{
"$ref": "#/components/schemas/JusPayHyperCheckoutResponse"
},
{
"$ref": "#/components/schemas/JusPayExpressCheckoutResponse"
},
{
"type": "null"
},
{
"$ref": "#/components/schemas/PayuPaymentInfo"
}
]
}
},
"required": [
"payments",
"payment_required",
"pending_amount",
"payment_info"
],
"type": "object"
}
},
"required": [
"message",
"success",
"content"
]
}
}
}
},
"400": {
"description": "Invalid payment request. `payment-method-already-exists` means this provider already has an active payment; `payment-amount-exceeds-pending` means the amount exceeds what remains payable.",
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"externalDocs": {
"url": "https://llm-docs.commercengine.io/admin-pos/operations/pos-create-order-payment-request"
},
"security": [
{
"Authorization": []
}
],
"tags": [
"Order payments"
],
"x-speakeasy-group": "pos",
"x-speakeasy-name-override": "createOrderPaymentRequest"
}Auto-generated from OpenAPI spec and TypeScript definitions