Methods are actions that can be performed against the FastSpring Store Builder Library using JavaScript. These methods typically require two parts:
- The Store Builder Library Script
- The JavaScript Method to be performed
An example will look like this:
<script>
fastspring.builder.add('phot-io-main-app');
</script>
Methods – JavaScript Functions
- fastspring.builder.add(product) – Changes ‘selected’ attribute from false to true – will not change quantity
- fastspring.builder.authenticate(securePayload, secureKey) – Applies known customer information and can hide input fields during checkout
- fastspring.builder.checkout() – Initiates popup checkout
- fastspring.builder.clean() – Should reset the cart after checkout
- fastspring.builder.country(countryCode) – Changes the country – requires two letter country code
- fastspring.builder.language(languageCode) – Changes language – requires language code
- fastspring.builder.payment(“paypal”) – Launches checkout and attempts to send customer directly to PayPal
- fastspring.builder.postalCode() – Takes the customer’s postal code as input, and applies it to the session for the purpose of calculating sales tax (when the order country is United States). This allows you to display sales tax amounts for U.S. orders on your page prior to checkout.
- fastspring.builder.promo(code) – Will apply a promocode to the order
- fastspring.builder.push(object) – Will push a session object to SBL
- fastspring.builder.recognize(securePayload, secureKey) – Applies “tentatively” known (unconfirmed) customer information but won’t hide input fields during checkout process
- fastspring.builder.recognizeRecipients({recipient object}) – Applies “tentatively” known (unconfirmed) gift recipient information to the order but again won’t hide fields
- fastspring.builder.remove(product) – Will remove a product including entire quantity from cart
- fastspring.builder.reset() – Empties the entire cart immediately on calling the function
- fastspring.builder.secure(securePayload, secureKey) – Passes sensitive data over a secure request
- fastspring.builder.tag({‘key1′:’value1’, ‘key2’:’value2’… }) – Allows you to add custom key value pairs to the order
- fastspring.builder.taxId(vatExclusionCode) – Apply someone’s Tax ID to remove VAT from order total
- fastspring.builder.update(product, quantity) – Changes item quanity
- fastspring.builder.viewCart() – Expects no input and launches the cart page of the popup storefront
- Public Methods Callback Function – Allows for chaining JavaScript functions and passing data using callbacks