createPurchaseButton
Parameters
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.
object
Initial state of the purchase button. See Purchase button
summary for more details.
Purchase button summary
Both the returnedinitialState 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.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.Offering | null
Offering object if user has purchased an offering.
null otherwise.Tab
The users tab
boolean
If a purchase required payment, this will be
true if payment was successful. false otherwise.Example
Example