Initialise Tyro.js
tyro.init(paySecret)
- Create the 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
paySecret required | string A unique id used to identify the pay request and make authenticated calls from the frontend. The paySecret will expire after 24 hours. |
Implementation
// 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();