retry-order-payment
Method: POST
Path: /orders/{order_number}/retry-payment
Tags: Order payments
Summary
Retry payment
Description
To generate new payment request if first payment request is failed or expired. Retry payment request can be made after 15 mins of last request or immediately after last payment request is marked as failed. An order not on the customer's credit line that its loyalty points, credit balance or discounts pay in full has nothing to retry: the request fails with the payment-retry-not-allowed error code, or payment-already-successful once the order is paid. 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.
Storefront SDK Usage
SDK Method: sdk.order.retryOrderPayment()
Example:
// Juspay Hyper Checkout - Redirects to hosted payment page
const { data, error } = await sdk.order.retryOrderPayment(
{ order_number: "ORD-2024-001" },
{
payment_method: {
payment_provider_slug: "juspay",
integration_type: "hyper-checkout",
gateway_reference_id: "gateway_ref_123",
return_url: "https://yourapp.com/payment/return",
action: "paymentPage"
}
}
);
// Juspay Express Checkout - UPI Collect
const { data, error } = await sdk.order.retryOrderPayment(
{ order_number: "ORD-2024-001" },
{
payment_method: {
payment_provider_slug: "juspay",
integration_type: "express-checkout",
gateway_reference_id: "gateway_ref_123",
return_url: "https://yourapp.com/payment/return",
payment_method_type: "UPI",
payment_method: "UPI_COLLECT",
upi_vpa: "user@upi"
}
}
);
if (error) {
console.error("Failed to retry payment:", error.message);
} else {
console.log("Payment retry initiated");
console.log("Payment info:", data.payment_info);
// For hyper-checkout, redirect to payment page
if ("payment_links" in data.payment_info) {
window.location.href = data.payment_info.payment_links?.web;
}
}TypeScript Definition
"retry-order-payment": {
parameters: {
query?: never;
header?: never;
path: {
/** @description order number */
order_number: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
payment_method?: components["schemas"]["PaymentMethodPayload"];
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
/** @description Gateway initiation details for the new payment attempt. `null` when the retry starts no gateway payment: a manual payment method (such as cash on delivery) or a bank transfer. */
payment_info: components["schemas"]["JusPayHyperCheckoutResponse"] | components["schemas"]["JusPayExpressCheckoutResponse"] | components["schemas"]["PayuPaymentInfo"] | null;
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
404: components["responses"]["NotFound"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["PaymentMethodPayload"] | PaymentMethodPayload |
components["schemas"]["JusPayHyperCheckoutResponse"] | JusPayHyperCheckoutResponse |
components["schemas"]["JusPayExpressCheckoutResponse"] | JusPayExpressCheckoutResponse |
components["schemas"]["PayuPaymentInfo"] | PayuPaymentInfo |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["NotFound"] | NotFound |
Parameters
- order_number (path): order number
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
{
"tags": [
"Order payments"
],
"operationId": "retry-order-payment",
"summary": "Retry payment",
"description": "To generate new payment request if first payment request is failed or expired. Retry payment request can be made after 15 mins of last request or immediately after last payment request is marked as failed. An order not on the customer's credit line that its loyalty points, credit balance or discounts pay in full has nothing to retry: the request fails with the `payment-retry-not-allowed` error code, or `payment-already-successful` once the order is paid. 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.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/retry-order-payment",
"description": "API reference for the retry-order-payment operation"
},
"parameters": [
{
"name": "order_number",
"in": "path",
"description": "order number",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"payment_method": {
"$ref": "#/components/schemas/PaymentMethodPayload"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"payment_info": {
"description": "Gateway initiation details for the new payment attempt. `null` when the retry starts no gateway payment: a manual payment method (such as cash on delivery) or a bank transfer.",
"oneOf": [
{
"$ref": "#/components/schemas/JusPayHyperCheckoutResponse"
},
{
"$ref": "#/components/schemas/JusPayExpressCheckoutResponse"
},
{
"$ref": "#/components/schemas/PayuPaymentInfo"
},
{
"type": "null"
}
]
}
},
"required": [
"payment_info"
],
"type": "object"
}
}
}
}
},
"links": {
"PollRetryPaymentStatus": {
"operationId": "get-payment-status",
"parameters": {
"order_number": "$request.path.order_number"
},
"description": "Poll the payment status after retrying payment."
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "orders",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "retryOrderPayment"
}Auto-generated from OpenAPI spec and TypeScript definitions