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"]["PosPaymentMethodPayload"];
};
};
};
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"]["OrderPayment"][];
/** @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;
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
404: components["responses"]["NotFound"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["PosPaymentMethodPayload"] | PosPaymentMethodPayload |
components["schemas"]["OrderPayment"] | OrderPayment |
components["schemas"]["JusPayHyperCheckoutResponse"] | JusPayHyperCheckoutResponse |
components["schemas"]["JusPayExpressCheckoutResponse"] | JusPayExpressCheckoutResponse |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["NotFound"] | NotFound |
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
Not authorized for given operation on the Resource
404
Requested resource not found
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"
}
}
],
"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",
"exclusiveMinimum": 0
},
"payment_method": {
"$ref": "#/components/schemas/PosPaymentMethodPayload"
}
},
"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/OrderPayment"
}
},
"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`.",
"oneOf": [
{
"$ref": "#/components/schemas/JusPayHyperCheckoutResponse"
},
{
"$ref": "#/components/schemas/JusPayExpressCheckoutResponse"
},
{
"type": "null"
}
]
}
},
"required": [
"payments",
"payment_required",
"pending_amount",
"payment_info"
],
"type": "object"
}
},
"required": [
"message",
"success",
"content"
]
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"Authorization": []
}
],
"tags": [
"Order payments"
],
"x-speakeasy-group": "pos",
"x-speakeasy-name-override": "createOrderPaymentRequest"
}Auto-generated from OpenAPI spec and TypeScript definitions