createPurchaseButton accepts the object with following properties:
Element
required
Container element to render purchase button in. Elements are appended to the
container, so original contents are not replaced.
string
required
ID of the purchase button experience created in Business Portal.
object
Key-value pairs of custom information associated with the purchase.
function
Callback function called when user leaves the purchase flow either as a result of successful purchase or cancellation.Returns a promise which resolves with the purchase button summary. See Purchase button summary for more details.
Return value
A promise which resolves with an object with following properties:
function
Destroy Supertab button instance. This removes all nodes related to Supertab
button from DOM.
Both the returned initialState object and the object passed as an argument to the onDone callback contain the following properties:
EntitlementStatus | null
Any prior entitlement of the current user. null if user has no prior entitlement.
Show prior entitlement
AuthStatus
Current authentication status of the user. Possible values: missing, expired, valid.
Purchase | null
Purchase object if launching the flow resulted in a purchase. null otherwise.
Show purchase object
string
ID of the purchase.Example: "purchase.cf637646-71a4-430d-aaea-a66f1a48a83c"
string
ID of the purchased offering.Example: "offering.4df706b5-297a-49c5-a4cd-2a10eca12ff9"
string | null
Date and time of the purchase.Example: "2025-04-30T12:00:00Z"
string | null
Date and time of the purchase completion, i.e. when payment was successful if purchase required payment.Example: "2025-04-30T12:00:00Z"
string
A summary of the purchase, usually including the website name and the type of a given entitlement.Example: "The Leek - 24 Hours Time Pass"
Price
Price object of the purchase.
Show Price object
number
Amount in currency base units.Example: 5000
Currency
PurchaseStatus
Status of the purchase. Possible values: completed, pending, abandoned.
Metadata
Key-value pairs of custom information associated with the purchase.
EntitlementStatus | null
The customer’s access (if any) as a result of this purchase.
Show Entitlement status object
Offering | null
Offering object if user has purchased an offering. null otherwise.
Show offering object
string
ID of the offering.Example: "offering.4df706b5-297a-49c5-a4cd-2a10eca12ff9"
string
Description of the offering.Example: "24 Hours Time Pass to The Leek"
EntitlementDetails
Specifies the nature and duration of purchased entitlement.Where you have chosen to have Supertab manage entitlements for you, customer’s purchasing such an offering will be granted entitlement to the content associated with the offering for the length of time specified.
Show Entitlement details object
string
The duration of the entitlement as {length}{unit}.Examples:
Whether the entitlement is sold on a recurring basis (subscription).
string
The content key being purchased, if you have chosen to have Supertab manage customer entitlement for you.Example: "site.cf637646-71a4-430d-aaea-a66f1a48a83c"
Price
Price object of the offering.
Tab
The users tab
Show Tab object
boolean
Whether the tab is in test mode.
Currency
The currency of the tab.
Price
The total amount of the tab.
Show Total object
number
Amount in currency base units.Example: 50
Currency
Price
The limit of the tab. When reached, the payment will be required.
Show Limit object
number
Amount in currency base units.Example: 50
Currency
Array<Purchase>
Details of all purchases made by the customer through your merchant account. Purchases made with other merchant accounts are shown as a single purchase, which accumulates all totals into one and has a null value instead of a purchase ID.Each purchase in the array has the same structure as the previously described Purchase object.
boolean
If a purchase required payment, this will be true if payment was successful. false otherwise.
Example
Example
const { destroy, initialState } = await supertabClient.createPurchaseButton({ containerElement: document.getElementById("supertab-button-container"), experienceId: "experience.abc", onDone: ({ priorEntitlement, purchase }) => { if (priorEntitlement) { // User has prior entitlement to the content. return; } if (purchase) { if (purchase.status === "completed") { // Purchase was completed successfully. } else { // Purchase was not completed. User may have // canceled the payment dialog if purchase // required payment. } } else { // User has canceled the flow and did not // attempt to purchase the offering. } }
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Supertab docs","colors":{"primary":"#0A0E1A","light":"#F3F3F4","dark":"#0A0E1A"},"logo":{"light":"https://mintcdn.com/supertab/bP-daIW8qZO4pzbo/logo/light.svg?fit=max\u0026auto=format\u0026n=bP-daIW8qZO4pzbo\u0026q=85\u0026s=47631a4a02f7428d1c2479d804aea54d","dark":"https://mintcdn.com/supertab/bP-daIW8qZO4pzbo/logo/dark.svg?fit=max\u0026auto=format\u0026n=bP-daIW8qZO4pzbo\u0026q=85\u0026s=0fae8412d2464504a082bd910292aa43"},"favicon":"https://mintcdn.com/supertab/nIjMo5xiY0_gRI-4/favicon.webp?fit=max\u0026auto=format\u0026n=nIjMo5xiY0_gRI-4\u0026q=85\u0026s=419af455c4dcfc9b93f2893e0ccec259","api":{"playground":{"display":"simple"}},"navbar":{"links":[{"href":"https://support.supertab.co/hc/en-us/requests/new","label":"Support"}],"primary":{"type":"button","label":"Business Portal","href":"https://business.supertab.co"}},"footer":{"socials":{"x":"https://x.com/getsupertab","linkedin":"https://www.linkedin.com/company/supertab"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"supertab","hasAudioNarration":false,"actualSubdomain":"supertab","customDomains":["docs.supertab.co"],"gitSource":{"type":"github","owner":"laterpay","repo":"supertab-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae9227464072a14c6718829:success","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"default","tag":"API Reference","count":27},{"language":"default","tag":"Supertab.js","count":14},{"language":"default","tag":"Customer API","count":12},{"language":"default","tag":"Documentation","count":11},{"language":"default","tag":"Endpoints","count":9},{"language":"default","tag":"Merchant API","count":6},{"language":"default","tag":"Introduction","count":5},{"language":"default","tag":"Supertab Experiences","count":5},{"language":"default","tag":"Reference","count":4},{"language":"default","tag":"Integrate","count":3}]},"assistantConfig":{"deflection":{"enabled":true,"email":"support@supertab.co"}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"supertab-js/reference/purchase-button","slug":"/supertab-js/reference/purchase-button","pageMetadata":{"title":"Supertab.createPurchaseButton","description":"Invoking Purchase Button experience in Supertab.js","href":"/supertab-js/reference/purchase-button"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Invoking Purchase Button experience in Supertab.js\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Expandable,Heading,ParamField,ResponseField}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`createpurchasebutton`,children:_jsx(_components.code,{children:`createPurchaseButton`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`html`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`html`,children:_jsxs(_components.code,{language:`html`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`div`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"supertab-button-container\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`div`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` supertabClient`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Supertab`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`clientId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"test_client.abc\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`destroy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`initialState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` supertabClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createPurchaseButton`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` containerElement:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"supertab-button-container\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` experienceId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"experience.abc\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`parameters`,children:`Parameters`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`createPurchaseButton`}),` accepts the object with following properties:`]}),`\n`,_jsx(ParamField,{path:`containerElement`,type:`Element`,required:true,id:`param-container-element`,children:_jsx(_components.p,{children:`Container element to render purchase button in. Elements are appended to the\ncontainer, so original contents are not replaced.`})}),`\n`,_jsx(ParamField,{path:`experienceId`,type:`string`,required:true,id:`param-experience-id`,children:_jsx(_components.p,{children:`ID of the purchase button experience created in Business Portal.`})}),`\n`,_jsx(ParamField,{path:`purchaseMetadata`,type:`object`,id:`param-purchase-metadata`,children:_jsx(_components.p,{children:`Key-value pairs of custom information associated with the purchase.`})}),`\n`,_jsxs(ParamField,{path:`onDone`,type:`function`,id:`param-on-done`,children:[_jsx(_components.p,{children:`Callback function called when user leaves the purchase flow either as a result of successful purchase or cancellation.`}),_jsxs(_components.p,{children:[`Returns a promise which resolves with the purchase button summary. See `,_jsx(_components.a,{href:`#purchase-button-summary`,children:`Purchase button summary`}),` for more details.`]})]}),`\n`,_jsx(Heading,{level:`3`,id:`return-value`,children:`Return value`}),`\n`,_jsx(_components.p,{children:`A promise which resolves with an object with following properties:`}),`\n`,_jsx(ResponseField,{name:`destroy`,type:`function`,id:`param-destroy`,children:_jsx(_components.p,{children:`Destroy Supertab button instance. This removes all nodes related to Supertab\nbutton from DOM.`})}),`\n`,_jsx(ResponseField,{name:`initialState`,type:`object`,id:`param-initial-state`,children:_jsxs(_components.p,{children:[`Initial state of the purchase button. See `,_jsx(_components.a,{href:`#purchase-button-summary`,children:`Purchase button\nsummary`}),` for more details.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`purchase-button-summary`,children:`Purchase button summary`}),`\n`,_jsxs(_components.p,{children:[`Both the returned `,_jsx(_components.code,{children:`initialState`}),` object and the object passed as an argument to the `,_jsx(_components.code,{children:`onDone`}),` callback contain the following properties:`]}),`\n`,_jsxs(ResponseField,{name:`priorEntitlement`,type:`EntitlementStatus | null`,id:`param-prior-entitlement`,children:[_jsxs(_components.p,{children:[`Any prior entitlement of the current user. `,_jsx(_components.code,{children:`null`}),` if user has no prior entitlement.`]}),_jsx(Expandable,{title:`prior entitlement`})]}),`\n`,_jsx(ResponseField,{name:`authStatus`,type:`AuthStatus`,id:`param-auth-status`,children:_jsxs(_components.p,{children:[`Current authentication status of the user. Possible values: `,_jsx(_components.code,{children:`missing`}),`, `,_jsx(_components.code,{children:`expired`}),`, `,_jsx(_components.code,{children:`valid`}),`.`]})}),`\n`,_jsxs(ResponseField,{name:`purchase`,type:`Purchase | null`,id:`param-purchase`,children:[_jsxs(_components.p,{children:[`Purchase object if launching the flow resulted in a purchase. `,_jsx(_components.code,{children:`null`}),` otherwise.`]}),_jsxs(Expandable,{title:`purchase object`,children:[_jsxs(ResponseField,{name:`id`,type:`string`,id:`param-id`,children:[_jsx(_components.p,{children:`ID of the purchase.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"purchase.cf637646-71a4-430d-aaea-a66f1a48a83c\"`})]})]}),_jsxs(ResponseField,{name:`offeringId`,type:`string`,id:`param-offering-id`,children:[_jsx(_components.p,{children:`ID of the purchased offering.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"offering.4df706b5-297a-49c5-a4cd-2a10eca12ff9\"`})]})]}),_jsxs(ResponseField,{name:`purchasedAt`,type:`string | null`,id:`param-purchased-at`,children:[_jsx(_components.p,{children:`Date and time of the purchase.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"2025-04-30T12:00:00Z\"`})]})]}),_jsxs(ResponseField,{name:`completedAt`,type:`string | null`,id:`param-completed-at`,children:[_jsx(_components.p,{children:`Date and time of the purchase completion, i.e. when payment was successful if purchase required payment.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"2025-04-30T12:00:00Z\"`})]})]}),_jsxs(ResponseField,{name:`description`,type:`string`,id:`param-description`,children:[_jsx(_components.p,{children:`A summary of the purchase, usually including the website name and the type of a given entitlement.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"The Leek - 24 Hours Time Pass\"`})]})]}),_jsxs(ResponseField,{name:`price`,type:`Price`,id:`param-price`,children:[_jsx(_components.p,{children:`Price object of the purchase.`}),_jsxs(Expandable,{title:`Price object`,children:[_jsxs(ResponseField,{name:`amount`,type:`number`,id:`param-amount`,children:[_jsx(_components.p,{children:`Amount in currency base units.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`5000`})]})]}),_jsx(ResponseField,{name:`currency`,type:`Currency`,id:`param-currency`})]})]}),_jsx(ResponseField,{name:`status`,type:`PurchaseStatus`,id:`param-status`,children:_jsxs(_components.p,{children:[`Status of the purchase. Possible values: `,_jsx(_components.code,{children:`completed`}),`, `,_jsx(_components.code,{children:`pending`}),`, `,_jsx(_components.code,{children:`abandoned`}),`.`]})}),_jsx(ResponseField,{name:`metadata`,type:`Metadata`,id:`param-metadata`,children:_jsx(_components.p,{children:`Key-value pairs of custom information associated with the purchase.`})}),_jsxs(ResponseField,{name:`entitlementStatus`,type:`EntitlementStatus | null`,id:`param-entitlement-status`,children:[_jsx(_components.p,{children:`The customer’s access (if any) as a result of this purchase.`}),_jsx(Expandable,{title:`Entitlement status object`})]})]})]}),`\n`,_jsxs(ResponseField,{name:`purchasedOffering`,type:`Offering | null`,id:`param-purchased-offering`,children:[_jsxs(_components.p,{children:[`Offering object if user has purchased an offering. `,_jsx(_components.code,{children:`null`}),` otherwise.`]}),_jsxs(Expandable,{title:`offering object`,children:[_jsxs(ResponseField,{name:`id`,type:`string`,id:`param-id-1`,children:[_jsx(_components.p,{children:`ID of the offering.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"offering.4df706b5-297a-49c5-a4cd-2a10eca12ff9\"`})]})]}),_jsxs(ResponseField,{name:`description`,type:`string`,id:`param-description-1`,children:[_jsx(_components.p,{children:`Description of the offering.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"24 Hours Time Pass to The Leek\"`})]})]}),_jsxs(ResponseField,{name:`entitlementDetails`,type:`EntitlementDetails`,id:`param-entitlement-details`,children:[_jsx(_components.p,{children:`Specifies the nature and duration of purchased entitlement.`}),_jsx(_components.p,{children:`Where you have chosen to have Supertab manage entitlements for you, customer’s purchasing such an offering will be granted entitlement to the content associated with the offering for the length of time specified.`}),_jsxs(Expandable,{title:`Entitlement details object`,children:[_jsxs(ResponseField,{name:`duration`,type:`string`,id:`param-duration`,children:[_jsxs(_components.p,{children:[`The duration of the entitlement as `,_jsx(_components.code,{children:`{length}{unit}`}),`.`]}),_jsx(_components.p,{children:`Examples:`}),_jsx(CodeBlock,{numberOfLines:`17`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`17`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` // 1 year`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"duration\": \"1y\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` // 2 months`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"duration\": \"2M\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` // 3 weeks`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"duration\": \"3w\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` // 4 days`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"duration\": \"4d\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` // 5 hours`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"duration\": \"5h\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` // 6 minutes`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"duration\": \"6m\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` // 7 seconds`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"duration\": \"7s\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]}),_jsx(ResponseField,{name:`isRecurring`,type:`boolean`,id:`param-is-recurring`,children:_jsx(_components.p,{children:`Whether the entitlement is sold on a recurring basis (subscription).`})}),_jsxs(ResponseField,{name:`contentKey`,type:`string`,id:`param-content-key`,children:[_jsx(_components.p,{children:`The content key being purchased, if you have chosen to have Supertab manage customer entitlement for you.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`\"site.cf637646-71a4-430d-aaea-a66f1a48a83c\"`})]})]})]})]}),_jsx(ResponseField,{name:`price`,type:`Price`,id:`param-price-1`,children:_jsx(_components.p,{children:`Price object of the offering.`})})]})]}),`\n`,_jsxs(ResponseField,{name:`tab`,type:`Tab`,id:`param-tab`,children:[_jsx(_components.p,{children:`The users tab`}),_jsxs(Expandable,{title:`Tab object`,children:[_jsx(ResponseField,{name:`testMode`,type:`boolean`,id:`param-test-mode`,children:_jsx(_components.p,{children:`Whether the tab is in test mode.`})}),_jsx(ResponseField,{name:`currency`,type:`Currency`,id:`param-currency-1`,children:_jsx(_components.p,{children:`The currency of the tab.`})}),_jsxs(ResponseField,{name:`total`,type:`Price`,id:`param-total`,children:[_jsx(_components.p,{children:`The total amount of the tab.`}),_jsxs(Expandable,{title:`Total object`,children:[_jsxs(ResponseField,{name:`amount`,type:`number`,id:`param-amount-1`,children:[_jsx(_components.p,{children:`Amount in currency base units.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`50`})]})]}),_jsx(ResponseField,{name:`currency`,type:`Currency`,id:`param-currency-2`})]})]}),_jsxs(ResponseField,{name:`limit`,type:`Price`,id:`param-limit`,children:[_jsx(_components.p,{children:`The limit of the tab. When reached, the payment will be required.`}),_jsxs(Expandable,{title:`Limit object`,children:[_jsxs(ResponseField,{name:`amount`,type:`number`,id:`param-amount-2`,children:[_jsx(_components.p,{children:`Amount in currency base units.`}),_jsxs(_components.p,{children:[`Example: `,_jsx(_components.code,{children:`50`})]})]}),_jsx(ResponseField,{name:`currency`,type:`Currency`,id:`param-currency-3`})]})]}),_jsxs(ResponseField,{name:`purchases`,type:`Array\u003cPurchase>`,id:`param-purchases`,children:[_jsxs(_components.p,{children:[`Details of all purchases made by the customer through your merchant account. Purchases made with other merchant accounts are shown as a single purchase, which accumulates all totals into one and has a `,_jsx(_components.code,{children:`null`}),` value instead of a purchase ID.`]}),_jsxs(_components.p,{children:[`Each purchase in the array has the same structure as the previously described `,_jsx(_components.a,{href:`#param-purchase`,children:`Purchase object`}),`.`]})]})]})]}),`\n`,_jsx(ResponseField,{name:`paymentResult`,type:`boolean`,id:`param-payment-result`,children:_jsxs(_components.p,{children:[`If a purchase required payment, this will be `,_jsx(_components.code,{children:`true`}),` if payment was successful. `,_jsx(_components.code,{children:`false`}),` otherwise.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`example`,children:`Example`}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`22`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`destroy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`initialState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` supertabClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createPurchaseButton`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` containerElement:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"supertab-button-container\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` experienceId:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"experience.abc\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onDone`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ({ `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`priorEntitlement`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`purchase`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`priorEntitlement`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // User has prior entitlement to the content.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`purchase`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`purchase`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"completed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Purchase was completed successfully.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Purchase was not completed. User may have`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // canceled the payment dialog if purchase`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // required payment.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // User has canceled the flow and did not`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // attempt to purchase the offering.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Supertab.createPurchaseButton","description":"Invoking Purchase Button experience in Supertab.js","href":"/supertab-js/reference/purchase-button"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"createPurchaseButton","slug":"createpurchasebutton","depth":2,"children":[{"title":"Parameters","slug":"parameters","depth":3,"children":[]},{"title":"Return value","slug":"return-value","depth":3,"children":[]}]},{"title":"Purchase button summary","slug":"purchase-button-summary","depth":2,"children":[]},{"title":"Example","slug":"example","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"supertab","siteName":"Supertab docs","title":"Supertab.createPurchaseButton - Supertab docs","navMaps":{"firstHrefInVersion":{"v3":{"href":"/supertab-js/reference/purchase-button","matchLevel":0},"2025-04-01":{"href":"/customer-api/overview","matchLevel":4}},"firstHrefInLanguage":{}},"lastModified":"2026-02-04T15:20:47.659Z","originalFileLocation":"supertab-js/reference/purchase-button.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Invoking Purchase Button experience in Supertab.js\">\u003cmeta data-mint-head name=\"application-name\" content=\"Supertab docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Supertab.createPurchaseButton - Supertab docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Invoking Purchase Button experience in Supertab.js\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Supertab docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.supertab.co/supertab-js/reference/purchase-button\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://supertab.mintlify.site/_mintlify/api/og/v2?division=API+Reference\u0026amp;title=Supertab.createPurchaseButton\u0026amp;description=Invoking+Purchase+Button+experience+in+Supertab.js\u0026amp;theme=a787be16a1efd3a0409f7aca\u0026amp;signature=a94509dd7757748c5ec35bf8fff6fb1da01a2998738718504c40781d88166bb8\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Supertab.createPurchaseButton - Supertab docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Invoking Purchase Button experience in Supertab.js\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://supertab.mintlify.site/_mintlify/api/og/v2?division=API+Reference\u0026amp;title=Supertab.createPurchaseButton\u0026amp;description=Invoking+Purchase+Button+experience+in+Supertab.js\u0026amp;theme=a787be16a1efd3a0409f7aca\u0026amp;signature=a94509dd7757748c5ec35bf8fff6fb1da01a2998738718504c40781d88166bb8\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/supertab/24UJgC29HVwRWzPH/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Supertab docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0A0E1A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.supertab.co/supertab-js/reference/purchase-button\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/supertab-js/reference/purchase-button.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.supertab.co/#organization\",\"name\":\"Supertab docs\",\"url\":\"https://docs.supertab.co\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/supertab/bP-daIW8qZO4pzbo/logo/light.svg?fit=max\u0026auto=format\u0026n=bP-daIW8qZO4pzbo\u0026q=85\u0026s=47631a4a02f7428d1c2479d804aea54d\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.supertab.co#website\",\"name\":\"Supertab docs\",\"url\":\"https://docs.supertab.co\",\"publisher\":{\"@id\":\"https://docs.supertab.co/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.supertab.co/supertab-js/reference/purchase-button#webpage\",\"url\":\"https://docs.supertab.co/supertab-js/reference/purchase-button\",\"name\":\"Supertab.createPurchaseButton\",\"description\":\"Invoking Purchase Button experience in Supertab.js\",\"dateModified\":\"2026-02-04T15:20:47.659Z\",\"isPartOf\":{\"@id\":\"https://docs.supertab.co#website\"},\"breadcrumb\":{\"@id\":\"https://docs.supertab.co/supertab-js/reference/purchase-button#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.supertab.co/supertab-js/reference/purchase-button#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Reference\",\"item\":\"https://docs.supertab.co/supertab-js/reference/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Supertab.createPurchaseButton\",\"item\":\"https://docs.supertab.co/supertab-js/reference/purchase-button\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.supertab.co/supertab-js/reference/purchase-button#article\",\"headline\":\"Supertab.createPurchaseButton\",\"name\":\"Supertab.createPurchaseButton\",\"description\":\"Invoking Purchase Button experience in Supertab.js\",\"url\":\"https://docs.supertab.co/supertab-js/reference/purchase-button\",\"mainEntityOfPage\":{\"@id\":\"https://docs.supertab.co/supertab-js/reference/purchase-button#webpage\"},\"dateModified\":\"2026-02-04T15:20:47.659Z\",\"publisher\":{\"@id\":\"https://docs.supertab.co/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.supertab.co#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Supertab docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Supertab docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/supertab-js/reference/purchase-button.md","siteName":"Supertab docs","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/supertab-introduction/overview/about-supertab"}]},{"tab":"Updates","pages":[{"title":"Updates","href":"/updates/product"}]},{"tab":"Supertab.js","versions":[{"version":"v3","groups":[{"group":"Supertab.js","pages":[{"title":"Getting Started","href":"/supertab-js/introduction"},{"title":"Installation","href":"/supertab-js/installation"}]},{"group":"Experiences","pages":[{"title":"Paywall Experiences","href":"/supertab-js/experiences/paywall"}]},{"group":"API Reference","pages":[{"title":"SDK Overview","sidebarTitle":"Overview","href":"/supertab-js/reference/overview"},{"title":"Supertab.createPaygate","tag":"DEPRECATED","href":"/supertab-js/reference/create-paygate"},{"title":"Supertab.createPaywall","description":"API reference for `Supertab.createPaywall`","href":"/supertab-js/reference/create-paywall"},{"title":"Supertab.createPurchaseButton","href":"/supertab-js/reference/purchase-button"},{"title":"Supertab.createPurchase","description":"API reference for `supertabClient.createPurchase`","sidebarTitle":"Supertab.createPurchase","href":"/supertab-js/reference/create-purchase"},{"title":"Supertab.auth","href":"/supertab-js/reference/auth"},{"title":"Supertab.api","href":"/supertab-js/reference/api"},{"title":"Supertab.checkout","href":"/supertab-js/reference/checkout"},{"title":"Errors","href":"/supertab-js/reference/errors"}]}]}]},{"tab":"API Reference","dropdowns":[{"dropdown":"Customer API","icon":"browsers","versions":[{"version":"2025-04-01","groups":[{"group":"Introduction","pages":[{"title":"Customer API","sidebarTitle":"Customer API","icon":"browsers","href":"/customer-api/overview"}]},{"group":"Reference","pages":[{"title":"Authentication","sidebarTitle":"Authentication","icon":"lock","href":"/customer-api/authentication"},{"title":"Versioning","sidebarTitle":"Versioning \u0026 Changes","icon":"calendar-clock","href":"/customer-api/versioning"}]},{"group":"Guides","pages":[{"title":"Making a Purchase","icon":"circle-dollar-to-slot","href":"/customer-api/making-a-purchase"},{"title":"Check for Entitlements, including Prior Entitlements","sidebarTitle":"Check for Entitlements","icon":"check","href":"/customer-api/entitlements"}]},{"group":"Endpoints","pages":[{"title":"Retrieve current customer","openapi":"GET /customers/me","href":"/customer-api/endpoints/retrieve-customer"},{"title":"Retrieve website","openapi":"get /site","href":"/customer-api/endpoints/retrieve-site"},{"openapi":"post /purchases/offerings","title":"Purchase an offering","href":"/customer-api/endpoints/purchase-an-offering"},{"openapi":"get /onetime_offerings/{onetime_offering_id}","title":"Retrieve a one-time offering","href":"/customer-api/endpoints/retrieve-a-one-time-offering"},{"openapi":"post /purchases/onetime_offerings","title":"Purchase a one-time offering","href":"/customer-api/endpoints/purchase-a-one-time-offering"},{"openapi":"get /purchases/{purchase_id}","title":"Retrieve a purchase","href":"/customer-api/endpoints/retrieve-a-purchase"},{"openapi":"get /entitlements/{content_key}","title":"Retrieve entitlement status","href":"/customer-api/endpoints/retrieve-entitlement-status"}]}]}]},{"dropdown":"Merchant API","icon":"server","versions":[{"version":"2025-04-01","groups":[{"group":"Introduction","pages":[{"title":"Merchant API","sidebarTitle":"Merchant API","icon":"server","href":"/merchant-api/overview"}]},{"group":"Reference","pages":[{"title":"Authentication","sidebarTitle":"Authentication","icon":"lock","href":"/merchant-api/authentication"},{"title":"Versioning","sidebarTitle":"Versioning \u0026 Changes","icon":"calendar-clock","href":"/merchant-api/versioning"}]},{"group":"Endpoints","pages":[{"title":"Create New One-Time Offering","openapi":"post /onetime_offerings","href":"/merchant-api/endpoints/create-onetime-offering"},{"title":"Retrieve a One-Time Offering","openapi":"get /onetime_offerings/{onetime_offering_id}","href":"/merchant-api/endpoints/retrieve-onetime-offering"}]},{"group":"Webhooks","pages":[{"title":"Consuming Webhooks","sidebarTitle":"Consuming Webhooks","icon":"globe","href":"/merchant-api/webhooks/consuming-webhooks"}]}]}]}]}]},"basePath":"","title":"Supertab.createPurchaseButton - Supertab docs","deploymentId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","buildId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","dynamics":[],"chunks":[]}