---
updatedAt: 2025-12-23T15:23:48.000Z
agentTools:
  siteIndex: https://developer.paymentology.com/llms.txt
  projectIndex: https://developer.paymentology.com/lume/llms.txt
---

# Generate Time Based Secret

This web service generates time based secret

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "PayApi Docs",
    "description": "OpenAPI 3.0 spec for PayAPI with required fields sorted first",
    "version": "3.0.0"
  },
  "servers": [
    {
      "url": "https://api.uat.paymentology.com/ppws/api"
    }
  ],
  "tags": [
    {
      "name": "Card V2"
    }
  ],
  "paths": {
    "/pws/pws_generate_time_based_secret/": {
      "post": {
        "tags": [
          "Card V2"
        ],
        "summary": "Generate Time Based Secret",
        "operationId": "pws_generate_time_based_secret",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateTimeBasedSecretModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateTimeBasedSecretResponseModel"
                }
              }
            }
          },
          "404": {
            "description": "Webservices does not exist"
          },
          "500": {
            "description": "Internal Server error"
          }
        },
        "description": "This web service generates time based secret",
        "x-codeSamples": [
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://api.uat.paymentology.com/ppws/api/pws/pws_generate_time_based_secret/\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\\"api_call_unique_identifier\\\":\\\"438574845790657485\\\",\\\"client_id\\\":760131,\\\"token\\\":311012081,\\\"user_id\\\":\\\"string\\\",\\\"remarks\\\":\\\"string\\\",\\\"timeStep\\\":60,\\\"cardSecretLength\\\":8,\\\"algorithm\\\":\\\"HmacSHA512\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Java + Okhttp",
            "source": "OkHttpClient client = new OkHttpClient();\n\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\\"api_call_unique_identifier\\\":\\\"438574845790657485\\\",\\\"client_id\\\":760131,\\\"token\\\":311012081,\\\"user_id\\\":\\\"string\\\",\\\"remarks\\\":\\\"string\\\",\\\"timeStep\\\":60,\\\"cardSecretLength\\\":8,\\\"algorithm\\\":\\\"HmacSHA512\\\"}\");\nRequest request = new Request.Builder()\n  .url(\"https://api.uat.paymentology.com/ppws/api/pws/pws_generate_time_based_secret/\")\n  .post(body)\n  .addHeader(\"content-type\", \"application/json\")\n  .build();\n\nResponse response = client.newCall(request).execute();"
          },
          {
            "lang": "Javascript + Jquery",
            "source": "const settings = {\n  \"async\": true,\n  \"crossDomain\": true,\n  \"url\": \"https://api.uat.paymentology.com/ppws/api/pws/pws_generate_time_based_secret/\",\n  \"method\": \"POST\",\n  \"headers\": {\n    \"content-type\": \"application/json\"\n  },\n  \"processData\": false,\n  \"data\": \"{\\\"api_call_unique_identifier\\\":\\\"438574845790657485\\\",\\\"client_id\\\":760131,\\\"token\\\":311012081,\\\"user_id\\\":\\\"string\\\",\\\"remarks\\\":\\\"string\\\",\\\"timeStep\\\":60,\\\"cardSecretLength\\\":8,\\\"algorithm\\\":\\\"HmacSHA512\\\"}\"\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"
          },
          {
            "lang": "Php + Http1",
            "source": "<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://api.uat.paymentology.com/ppws/api/pws/pws_generate_time_based_secret/');\n$request->setMethod(HTTP_METH_POST);\n\n$request->setHeaders([\n  'content-type' => 'application/json'\n]);\n\n$request->setBody('{\"api_call_unique_identifier\":\"438574845790657485\",\"client_id\":760131,\"token\":311012081,\"user_id\":\"string\",\"remarks\":\"string\",\"timeStep\":60,\"cardSecretLength\":8,\"algorithm\":\"HmacSHA512\"}');\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"
          },
          {
            "lang": "Python + Python3",
            "source": "import http.client\n\nconn = http.client.HTTPSConnection(\"uat.banking.live:55555\")\n\npayload = \"{\\\"api_call_unique_identifier\\\":\\\"438574845790657485\\\",\\\"client_id\\\":760131,\\\"token\\\":311012081,\\\"user_id\\\":\\\"string\\\",\\\"remarks\\\":\\\"string\\\",\\\"timeStep\\\":60,\\\"cardSecretLength\\\":8,\\\"algorithm\\\":\\\"HmacSHA512\\\"}\"\n\nheaders = { 'content-type': \"application/json\" }\n\nconn.request(\"POST\", \"/ppws/api/pws/pws_generate_time_based_secret/\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"
          },
          {
            "lang": "Shell + Curl",
            "source": "curl --request POST \\\n  --url https://api.uat.paymentology.com/ppws/api/pws/pws_generate_time_based_secret/ \\\n  --header 'content-type: application/json' \\\n  --data '{\"api_call_unique_identifier\":\"438574845790657485\",\"client_id\":760131,\"token\":311012081,\"user_id\":\"string\",\"remarks\":\"string\",\"timeStep\":60,\"cardSecretLength\":8,\"algorithm\":\"HmacSHA512\"}'"
          },
          {
            "lang": "Go + Native",
            "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.uat.paymentology.com/ppws/api/pws/pws_generate_time_based_secret/\"\n\n\tpayload := strings.NewReader(\"{\\\"api_call_unique_identifier\\\":\\\"438574845790657485\\\",\\\"client_id\\\":760131,\\\"token\\\":311012081,\\\"user_id\\\":\\\"string\\\",\\\"remarks\\\":\\\"string\\\",\\\"timeStep\\\":60,\\\"cardSecretLength\\\":8,\\\"algorithm\\\":\\\"HmacSHA512\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
          },
          {
            "lang": "Node + Native",
            "source": "const http = require(\"https\");\n\nconst options = {\n  \"method\": \"POST\",\n  \"hostname\": \"uat.banking.live\",\n  \"port\": \"55555\",\n  \"path\": \"/ppws/api/pws/pws_generate_time_based_secret/\",\n  \"headers\": {\n    \"content-type\": \"application/json\"\n  }\n};\n\nconst req = http.request(options, function (res) {\n  const chunks = [];\n\n  res.on(\"data\", function (chunk) {\n    chunks.push(chunk);\n  });\n\n  res.on(\"end\", function () {\n    const body = Buffer.concat(chunks);\n    console.log(body.toString());\n  });\n});\n\nreq.write(JSON.stringify({\n  api_call_unique_identifier: '438574845790657485',\n  client_id: 760131,\n  token: 311012081,\n  user_id: 'string',\n  remarks: 'string',\n  timeStep: 60,\n  cardSecretLength: 8,\n  algorithm: 'HmacSHA512'\n}));\nreq.end();"
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "GenerateTimeBasedSecretModel": {
        "required": [
          "api_call_unique_identifier",
          "client_id",
          "token"
        ],
        "type": "object",
        "properties": {
          "api_call_unique_identifier": {
            "maxLength": 40,
            "minLength": 1,
            "type": "string",
            "description": "Unique number that must be passed at each API request. Identifier to make each API request unique",
            "example": "438574845790657485"
          },
          "client_id": {
            "minimum": 1,
            "type": "integer",
            "description": "Unique identifier for the client which Paymentology will provide at outset",
            "format": "int32",
            "example": 760131
          },
          "token": {
            "minimum": 1,
            "type": "integer",
            "description": "Public token for the card",
            "format": "int64",
            "example": 311012081
          },
          "user_id": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "User Id of the Customer who triggered the API request."
          },
          "remarks": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "description": "Remarks for API request"
          },
          "timeStep": {
            "type": "integer",
            "description": "Default: 60 - Window during which TOTP is valid in seconds",
            "format": "int64",
            "example": 60
          },
          "cardSecretLength": {
            "type": "integer",
            "description": "Default: 8 - Length of card secret 1-8",
            "format": "int32",
            "example": 8
          },
          "algorithm": {
            "type": "string",
            "description": "<p>Default: HmacSHA512 - Hashing algorithm used for TOTP generation :</p>\n<ul>\n<li class=\"docBullet\">HmacSHA1</li>\n<li class=\"docBullet\">HmacSHA256</li>\n<li class=\"docBullet\">HmacSHA512</li>\n</ul>",
            "example": "HmacSHA512"
          }
        },
        "description": "This api is used to get card status"
      },
      "GenerateTimeBasedSecretResponseBody": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "description": "generated TOTP",
            "example": "001#52364128"
          }
        }
      },
      "GenerateTimeBasedSecretResponseModel": {
        "type": "object",
        "properties": {
          "header": {
            "$ref": "#/components/schemas/Header"
          },
          "body": {
            "$ref": "#/components/schemas/GenerateTimeBasedSecretResponseBody"
          }
        }
      },
      "Header": {
        "required": [
          "error_desc",
          "error_id"
        ],
        "type": "object",
        "properties": {
          "error_desc": {
            "type": "string",
            "description": "Error Description",
            "example": "success"
          },
          "error_id": {
            "type": "integer",
            "description": "Error Id",
            "format": "int32",
            "example": 0
          }
        }
      }
    }
  },
  "x-tagGroups": [
    {
      "name": "API",
      "tags": [
        "Overview",
        "Account Structure",
        "Security and Authentication",
        "Required Fields",
        "Error handling/Codes",
        "Curl Request Sample",
        "API 1.0",
        "API 2.0",
        "API 3.0"
      ]
    },
    {
      "name": "API 2.0",
      "tags": [
        "",
        "3DS",
        "Account",
        "Account Groups",
        "Account V2",
        "Apata",
        "Card",
        "Card Groups",
        "Card PaySecure WS",
        "Card PaySecure WS V2",
        "Card PaySecure WS V3",
        "Card V2",
        "Card-v2",
        "Cashback",
        "Chargeback",
        "Chargeback V2",
        "ChargeBack-V2",
        "Credit account status",
        "Credit billing cycle",
        "Credit grace period",
        "Credit interest",
        "Credit limits",
        "Credit test script",
        "Customer",
        "Customer-V2",
        "Decision Engine",
        "Delinquency",
        "EMV",
        "Fees",
        "Group",
        "Health check",
        "Installment",
        "Mada Pay - MadaPay To PTY (Beta)",
        "Mada Pay LCM",
        "MCC",
        "PcjS API Docs V2",
        "Pin-V2",
        "Rules",
        "Rules action",
        "Rules action V2",
        "Rules V2",
        "SCA Contactless Limits",
        "Tokenization customer service",
        "Tokenization Predigitization",
        "Tokenization predigitization lite",
        "Transaction",
        "VCAS",
        "VTS - PTY To Visa",
        "VTS - Visa To PTY",
        "Wallet"
      ]
    },
    {
      "name": "Ledger API",
      "tags": [
        "Ledger API - Cards"
      ]
    },
    {
      "name": "Deprecated",
      "tags": [
        "Rules (Deprecated)"
      ]
    }
  ]
}
```

# Sibling pages

* [Update Card Holder Details](https://developer.paymentology.com/lume/reference/pws_card_holder_edit.md)
* [Update Card Holder Details V2](https://developer.paymentology.com/lume/reference/v2_pws_card_holder_edit.md)
* [Edit Tok Flag](https://developer.paymentology.com/lume/reference/pws_tok_flag_edit.md)
* [Edit Tok Flag V2](https://developer.paymentology.com/lume/reference/v2_pws_tok_flag_edit.md)
* [Get Card Detail](https://developer.paymentology.com/lume/reference/pws_get_card_detail.md)
* [Card History](https://developer.paymentology.com/lume/reference/pws_card_history.md)
* [Card History V2](https://developer.paymentology.com/lume/reference/v2_pws_card_history.md)
* [Get Card Image](https://developer.paymentology.com/lume/reference/pws_get_card_image.md)
* [Card list](https://developer.paymentology.com/lume/reference/pws_card_list.md)
* [Get Card Status](https://developer.paymentology.com/lume/reference/pws_get_card_status.md)
* [Get Pan Number](https://developer.paymentology.com/lume/reference/pws_get_pan_number.md)
* [list Accounts Linked To card](https://developer.paymentology.com/lume/reference/pws_linked_acc_card_list.md)
* [Set Card Status](https://developer.paymentology.com/lume/reference/pws_set_card_status.md)
* [Set Card Status V2](https://developer.paymentology.com/lume/reference/v2_pws_set_card_status.md)
* [Link account card](https://developer.paymentology.com/lume/reference/pws_set_default_ccy.md)
* [Card Conversion](https://developer.paymentology.com/lume/reference/pws_virtual_to_physical.md)
* [Card Conversion V2](https://developer.paymentology.com/lume/reference/v2_pws_virtual_to_physical.md)