Skip to content

generate-hash ​

Method: POST
Path: /payments/generate-hash

Tags: PayU

Summary ​

Generate hash

Description ​

Generates a PayU hash for checking a pending payment belonging to the current session. Only verify_payment|\{request_number\} is accepted; other commands or payments return 400.

Storefront SDK Usage ​

SDK Method: sdk.payments.generateHash()

Example:

typescript
const { data, error } = await sdk.payments.generateHash({ payment_gateway: "payu", plain_text: "merchant-key|transaction-id|amount|product|name|email" });

TypeScript Definition ​

typescript
"generate-hash": {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        requestBody: {
            content: {
                "application/json": {
                    /** @constant */
                    payment_gateway: "payu";
                    /** @description `verify_payment|{request_number}`, using the request number of a pending PayU payment on an order placed by or belonging to the current session. */
                    plain_text: string;
                };
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: {
                            hash: string;
                            /** @description The PayU merchant key for the payment. */
                            key: string;
                        };
                    };
                };
            };
            /** @description `validation-error`: missing or invalid input or payment configuration. */
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            403: components["responses"]["Forbidden"];
            500: components["responses"]["InternalServerError"];
            504: components["responses"]["GatewayTimeout"];
        };
    };

Component References ​

ReferenceResolves To
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["Forbidden"]Forbidden
components["responses"]["InternalServerError"]InternalServerError
components["responses"]["GatewayTimeout"]GatewayTimeout

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.

500 ​

The request failed because of an unexpected error.

504 ​

The request timed out.

OpenAPI Definition ​

json
{
  "tags": [
    "PayU"
  ],
  "operationId": "generate-hash",
  "summary": "Generate hash",
  "description": "Generates a PayU hash for checking a pending payment belonging to the current session. Only `verify_payment|{request_number}` is accepted; other commands or payments return 400.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/generate-hash",
    "description": "API reference for the generate-hash operation"
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "payment_gateway",
            "plain_text"
          ],
          "properties": {
            "payment_gateway": {
              "const": "payu"
            },
            "plain_text": {
              "description": "`verify_payment|{request_number}`, using the request number of a pending PayU payment on an order placed by or belonging to the current session.",
              "type": "string",
              "minLength": 16,
              "pattern": "^verify_payment\\|[^|]+$"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "hash": {
                    "type": "string"
                  },
                  "key": {
                    "description": "The PayU merchant key for the payment.",
                    "type": "string"
                  }
                },
                "required": [
                  "hash",
                  "key"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "`validation-error`: missing or invalid input or payment configuration.",
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "500": {
      "$ref": "#/components/responses/InternalServerError"
    },
    "504": {
      "$ref": "#/components/responses/GatewayTimeout"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "payu",
  "x-speakeasy-ignore": true,
  "x-speakeasy-name-override": "generateHash"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: