Sell an item with Supertab Button and Tab.JS
Embed and configure the Supertab Button to sell items anywhere online.
In this 3 minute tutorial, we’ll walk you through selling a PDF for 25¢. To do this, you’ll just need to configure your purchase button in our business portal, and then insert your Add to Tab button on your site. Before you start, make sure you’ve already set up an account (4 min).
Conceptually it’s important to remember how simple this is: a user will make payment through Supertab, and then once payment is confirmed, your site will execute any command you want - in this example, it will reveal a link to view or download a PDF.
First up, let’s configure your button
-
Go to the business portal.
-
Go to the Sites menu item to specify the site that you’ll be deploying your button to.
a. Hit the Add Site button
b. Enter in a Site Name; this will be used in several places so make sure it properly reflects your site or business name
c. Enter in the Site URL, or base level domain name, with http:// or https://. This does not need to be the exact url or page where your code will be hosted.
-
Now go to the Monetization menu item
a. Hit the Single Item toggle
b. Hit the Add Single Item button
c. From the Site dropdown menu make sure the site you created in step 2 is selected
d. Add a description of what you’re selling: let’s call it Pizza Recipe PDF
e. Enter in 0.25 for the price and hit the Save button
f. On Save, Your item will appear in the list view
-
Now go to the Revenue Generator menu item
a. Hit the Purchase Button toggle
b. From the Site dropdown menu make sure the site you created in step 2 is selected
c. From the Offering dropdown menu, select the offering you created in step 3
d. In the Merchant Logo field, paste in the URL of a logo image that will appear in your purchase dialog screen. A logo with dimensions of 125px wide by 75px tall is recommended.
e. From the Code Snippet section, hit the Copy button
Next, let’s add the Button to your site
The Supertab purchase button is ready to be added to your site.
Your code from step 4 will look something like the following:
You just need to make a few modifications to get this up and running:
- Specify the container element where you want your button to appear. In this case let’s call it ‘pdf-download’:
- Within the onPurchaseCompleted callback function, add the following javascript, replacing the PDF path with the path to your PDF. (This code simply displays a link to the PDF when payment is complete): [EXPLAIN THIS more ]
- Your final code should look something like this:
- Now just make sure you have a
<div>
on your page where the Add to Tab button will be called:
Here’s a link to the finished product.