Skip to main content

Cancellation Button

Creating a Session Token

You can create a session token for this web component by using the request template below with the Salable API.

const response = await fetch('https://api.salable.app/sessions', {
method: "POST",
headers: {
"x-api-key": "YOUR_SALABLE_API_TOKEN",
version: "v2",
},
body: JSON.stringify({
scope: 'web-components:cancellation-button',
metadata: {
subscriptionUuid: 'YOUR_SUBSCRIPTION_UUID',
// === OR ===
licenseUuid: 'YOUR_LICENSE_UUID'
}
})
})

const { sessionToken } = await response.json()

See the entire API docs for creating sessions for web components.

Examples

<!doctype html>
<head>
<title>Salable Cancellation Button Web Component Example</title>
<script type="module">
import { defineCustomElements } from 'https://cdn.jsdelivr.net/npm/@salable/web-components@latest/loader/index.es2017.js';
defineCustomElements();
</script>
</head>
<body>
<salable-cancellation-button
session-token="YOUR_SESSION_TOKEN"
uuid="YOUR_SUBSCRIPTION_OR_LICENSE_UUID"
></salable-cancellation-button>
</body>
</html>

Properties

PropertyAttributeDescriptionTypeDefault
sessionToken (required)session-tokenThe generated token for this session from the Salable APIstringundefined
uuid (required)uuidThe uuid of the license or subscription to cancelstringundefined