# Initialise Tyro.js

# tyro.init(paySecret)

* [Create a Pay Request](/app/apis/pay/0.9#operations/create-pay-request) from your server and return the paySecret.
* Use the `paySecret` to initialise Tyro.js.
* The `paySecret` is used to identify the Pay Request and make authenticated calls from your frontend. It has an expiration time of 24 hours. It’s recommended to avoid logging or storing the pay secret for security reasons.


## Method Parameters


```json
{
  "type": "object",
  "properties": {
    "paySecret": {
      "type": "string",
      "description": "A unique id used to identify the pay request and make authenticated calls from the frontend. The paySecret will expire after 24 hours."
    }
  },
  "required": [
    "paySecret"
  ]
}
```

## Implementation


```javascript
// Javascript example

async function init() {
  const response = await fetch("/create-order", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ items }),
  });
  const { paySecret } = await response.json();
  await tyro.init(paySecret);
  ...
}

init();
```