This is the unique product identifier that you had specified in your product catalog upload. We will use this identifier to know which warranty offer to display. Generally this is the product SKU or similar, however the choice of product reference ID is up to a merchant to decide. If you are having trouble finding out what your product referenceId is, please file a support request through the Extend Merchant Portal.
price
number
No
Product price in cents
category
string
No
Product category (recommended for better offer matching)
constcomponent=Extend.buttons.instance('#extend-offer')if(component){// Get user's selectionconstselection=component.getPlanSelection()if(selection){console.log('User selected:',selection.title)console.log('Plan ID:',selection.planId)console.log('Price:',selection.price)// Get offer token for cart/checkoutconsttoken=component.getOfferToken()console.log('Offer token:',token)}// Change active product (for variants)component.setActiveProduct('new-sku-123')// Clean up component when done// component.destroy()}
Extend.setActiveProduct()
If your store has multiple product variants for a single product page (for example, if you have a product that allows a customer to select a color or size option) you’ll need to pass the new product reference id to the SDK when the change occurs. This prevents a customer from accidentally purchasing the wrong warranty for an incorrect product.
Signature
Extend.setActiveProduct(selector,referenceId)
Parameters
Parameter
Type
Required
Description
selector
string | HTMLElement
Yes
CSS selector or DOM element
referenceId
string
Yes
Product SKU/ID to set as active
Example
// Set active product for variant switchingExtend.setActiveProduct('#extend-offer','headphones-black')// Equivalent to using instance methodconstcomponent=Extend.buttons.instance('#extend-offer')if(component){component.setActiveProduct('headphones-black')}
Extend.modal.open()
Display product protection offers in modal overlays.
// Lead token must be obtained from ExtendExtend.aftermarketModal.open({leadToken:'lead_token',onClose:function(plan,product,quantity,token){if(plan&&product){console.log('Post-purchase warranty selected:',plan.title)console.log('Quantity:',quantity)console.log('Token:',token)// Handle warranty purchase}}})
interfacePlanSelection{planId:string// Unique plan identifierprice:number// Warranty price in centsterm:number// Coverage term in monthstitle:string// Display title (e.g., "2 Year Protection")coverageType:'adh'|'base'// Type of coveragetoken?:string// Token for cart/checkoutofferPlanId?:string// Offer-specific plan IDisEmbedded?:boolean// Whether plan is embedded}