Skip to main content

Pricing Table

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:pricing-table',
metadata: {
pricingTableUuid: 'YOUR_PRICING_TABLE_UUID',
// === OR ===
productUuid: 'YOUR_PRODUCT_UUID'
}
})
})

const { sessionToken } = await response.json()

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

Examples

<!doctype html>
<head>
<title>Salable Pricing Table 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-pricing-table
session-token="YOUR_SESSION_TOKEN"
uuid="YOUR_PRICING_TABLE_UUID"
global-success-url="https://example.com/success"
global-cancel-url="https://example.com/cancel"
global-grantee-id="EXAMPLE_GRANTEE_ID"
member="EXAMPLE_MEMBER"
currency="GBP"
></salable-pricing-table>
</body>
</html>

Properties

PropertyAttributeDescriptionTypeDefault
sessionToken (required)session-tokenThe generated token for this session from the Salable APIstringundefined
uuid (required)uuidThe uuid of the pricing table that you want to display.stringundefined
member (required)memberThe ID of the member who will manage the license.stringundefined
globalCancelUrl (required)global-cancel-urlThe URL to send users to if the transaction fails. Must be an absolute URL.stringundefined
globalGranteeId (required)global-grantee-idThe unique identifier for the grantee for all plan checkouts links.stringundefined
globalSuccessUrl (required)global-success-urlThe URL to send users to after a successful purchase. Must be an absolute URL.stringundefined
globalContactUrlglobal-contact-urlThe URL for the "Coming soon" plan cta.stringundefined
perPlanCancelUrlsper-plan-cancel-urlsConfigure cancelUrls per plan, string format {'plan-uuid-one':'https://example.com/cancel-one','plan-uuid-two':'https://example.com/cancel-two'}string \| { [x: string]: string; }undefined
perPlanGranteeIdsper-plan-grantee-idsConfigure granteeIds per plan, string format {'plan-uuid-one': 'granteeIdOne', 'plan-uuid-two': 'granteeIdTwo'}string \| { [x: string]: string; }undefined
perPlanSuccessUrlsper-plan-success-urlsConfigure successUrls per plan, string format {'plan-uuid-one': 'https://example.com/success-one' , 'plan-uuid-two': 'https://example.com/success-two'}string \| { [x: string]: string; }undefined
isCustomPricingTableis-custom-pricing-tableIf you provided the uuid of a custom pricing table set this to truebooleanfalse
customerEmailcustomer-emailPre-fills the customer email in Stripe checkout.stringundefined
customerIdcustomer-idThe ID of an existing customer in your payment integration. This pre-fills the email, card details, and postcode at checkout.stringundefined
currencycurrencyUses the currency short name (e.g., USD). Defaults to the default currency on the Product which the Plan is linked to. Currently only supported on payment integration type 'stripe_existing'.stringundefined
promoCodepromo-codeUsed to pre-fill the promo code in Stripe checkout. Use the promo code ID from Stripe dashboard. Customers cannot edit this field during checkout.stringundefined
allowPromoCodeallow-promo-codeEnables the promo code field in Stripe checkout. Accepts 'true' or 'false'. Cannot be used with promoCode.stringundefined
automaticTaxautomatic-taxAutomatically calculate tax on checkout based on the customer's location and your Stripe settings.stringundefined