SquadUp Embed Integration
Embed URL: https://embed.squadup.com/main-v2.min.js
Inital Set-up
- Must have bootstrap 3 CSS included
- If Bootstrap CSS causes issues, a namespaced version of is available: https://embed.squadup.com/default/css/bootstrap-namespace.min.css
- The HTML element where the embed is going to be rendered must have a class or an id
- Embed config object has must be defined before including embed script
- Include embed script: https://embed.squadup.com/main-v2.min.js
Example integration:
<link rel="stylesheet" href="https://embed.squadup.com/default/css/bootstrap-namespace.min.css">
<div id="squadup-checkout"></div>
<script>
squadup = {
title: 'SquadUP Events',
image: 'https://s3.amazonaws.com/checkout.squadup.com/squadup-logo.png',
root: 'squadup-checkout',
userId: [818],
eventId: 1010
}
</script>
<script src="https://embed.squadup.com/main-v2.min.js"></script>
Config options
- title: name that is displayed in the header
- image: image that is displayed in the header
- root: id or class of the element where the checkout form will be rendered
- onDomReady: (optional) Boolean value to specify whether to launch the embed widget on DOM load or to wait until manually triggered. Default: true.
- userId: array of SquadUP user ids to pull events from
- eventId: (optional) event ID (string or number) of event to load on app start
- locale: (optional) to set the initial locale of the widget. The event specific locale will override this setting.
- shoppingCartEnabled: (optional) Boolean value that enables using the shopping cart, if it has been enabled for the user in the admin panel
- descriptionEnabled: (optional) Boolean value to show the event flyer and description if either are present for the event
- autoScrollElementId: (optional) Element id to automatically scroll to after any embed view change. Must be an id string (without #) Example: ‘squadup-checkout’
- eventsDefaultView: (optional) Default view style for event list view. Possible values: “list” or “calendar”.
- eventsViewToggleEnabled: (optional) Boolean value to hide List/Calendar toggle in event list view. Default: true.
- confirmationUrl: (optional) URL of confirmation page the user will be redirected to after a successful checkout
- collapseTicketDescription: (optional) Boolean value to enable collapsible ticket descriptions
- successCallback: (optional) function to be called after successful transaction. A single object is passed as a parameter to this function. Example object: {“items”:[{“event”:{“id”:2,”name”:”Test Custom Gateway”,”host”:{“first_name”:”Test”,”last_name”:”Host”}},”donation”:0,”tickets”:[{“id”:5,”quantity”:1,”delivery_method”:”eticket”}]}],”total”:12.76}
- stripePublicKey: (optional) Stripe public key when Stripe gateway is used.
- stripeJsVersion: (optional) Version of stripe javascript library Possible values: “v2”, “v3”. Default: v2. Note: v3 will use Stripe Payment Intents.
- braintreeCustomGatewayClientEnabled: (optional) Boolean value to enable Braintree JS Client for Custom Gateways. Default: false.
- cybersourceMerchantId: (optional) CyberSource merchant ID to be used in generating deviceFingerPrintID.
- creditCardFormEnabled: (optional) Boolean value to enable/disable the credit card form. Only applies to default braintree gateway. Default: true
- allowedPaymentMethods: (optional) Array of values to limit allowed payment methods. Possible values (as of May 5, 2017): “master”, “visa”, “amex”, “discover”
- allowedBins: (optional) Array of BINs which are permitted to be used.
- allowedZipCodes: (optional) Array of zip codes that users are permitted to use when purchasing.
- checkoutButtonText: (optional) String value of text for submit button on checkout page
- hideFees: (optional) Boolean value to enable hiding of fees. Default: false.
- boxOffice: (optional, requires boxOfficeToken) Boolean value to denote a box office transactions. Default: false.
- boxOfficeToken: (optional, required for box office) API token for authenticated user with box office permissions.
- acceptCash: (optional, requires boxOffice == true) Boolean value to accept box office cash transactions. Default: false.
- requireCardAddress: (optional) Boolean value to add address fields to credit card form and check AVS rules. Default: false.
- defaultCardCountry: (optional) ISO 3166 Alpha-2 country code string to preselect in card address country select box. Default: “”.
- requireCardPhone: (optional) Boolean value to add phone number field to credit card form. Default: false.
- requireShippingPhone: (optional) Boolean value to add phone number field to shipping form. Default: false.
- showCheckout: (optional) Boolean value to show the checkout view by default after the widget is loaded. Default: false.
- facebookShareEnabled: (optional) Boolean value to enable Facebook share button on confirmation page. It will share the current page url.
- twitterShareEnabled: (optional) Boolean value to enable Twitter share button on confirmation page. It will share the current page url.
- twitterShareText: (optional) String value to change the text that shows in the twitter share dialog. The current page url will be added after this text.
- confirmEmail: (optional) Boolean value to enable email confirmation field.
- confirmationText: (optional) String of HTML to display on the confirmation view when not redirecting to an external confirmation page. Use “[transaction_id]” to add the transaction id to the confirmation text.
- flyerList: (optional) Boolean value to show flyer images in event list view.
- ticketGuardianEnabled: (optional) Boolean value to enable or disable TicketGuardian insurance. Default: true.
- topics: (optional) Array of topics to filter the events in the list/calendar view.
- topicsExclude: (optional) Boolean value to exclude topics specified in “topics” from the events shown in list/calendar view. Default: false.
- categoryIds: (optional) Array of category ids to filter the events in the list/calendar view.
- contactHostEnabled: (optional) Boolean value to enable the Contact Hosts link.
- giftCardLocalStorage: (optional) Boolean value to enable using localStorage to persist and auto apply gift card codes.
- promoCodeSessionStorage: (optional) Boolean value to enable using sessionStorage to persist and auto apply promo codes.
- textTicketEnabled: (optional) Boolean value to enable texting tickets to customers.
- brandingPosition: (optional) Location of the “powered by SquadUP” branding image. Possible values: “top”, “bottom”, or “none”
- reservedSeatingEnabled: (optional) Boolean value to enable reserved seating (requires enabling on SquadUP backend.)
- reservedSeatingMaxQty: (optional) The maximum number of seats an individual is allowed to select in a single order.
- paymentPlansEnabled: (optional) Boolean value to enable payment plans. (requires configuration on SquadUP backend.)
- minimumBundleQty: (optional) Minimum number of unique bundles that must be selected before adding to cart.
- maxTicketPerOrder: (optional) Maximum number of tickets that may be purchased in a single order.
- minUniqueTicketPerOrder: (optional) Minimum number of unique tickets required to submit a single order.
- emptyStateMessage: (optional) Custom message to display when no tickets are on sale.
- donationOptions: (optional) Array of donation options objects. Each option object must have a value key. Ex. [{value: 10}, {value: 20, default: true}, {value: null, other: true}]
- donationLabel: (optional) Label text for donation box.
- donationDescription: (optional) Description text to display below donation buttons.
- limitAddOnQuantity: (optional) Boolean value to enable limiting addon quantity to same quantity as parent price tier. Default: false.
- disabledEventIds: (optional) Array of event ids to be disabled in the event list view.
- customMessages: (optional) Object with key/value pairs of translation messages to override the defaults. Ex. {“eventDetail.addCart”: “Custom Add to Cart Button Message”}
- orderQuestions: (optional, requires shoppingCartEnabled) Array of question objects to display as shopping cart questions.
Example: [{question: “Enter an answer?”, type: “text”, required: false},
{question: “Pick an answer?”, type: “dropdown”, options: [“Option1”, “Option2”, “Option3”], required: false},
{question: “Click some checkboxes?”, type: “checkbox”, options: [“Option1”, “Option2”, “Option3”], required: true}]
Creating/Destroying Embed via DOM Event
The embed may be manually created or destroyed by triggering the following events:
document.dispatchEvent(new CustomEvent('createSquadupEmbed'));
document.dispatchEvent(new CustomEvent('destroySquadupEmbed'));
Note: A polyfill is required for Internet Explorer 9+ support.
(function () {
if ( typeof window.CustomEvent === "function" ) return false;
function CustomEvent ( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
}
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
})();
Listening to DOM events triggered by user actions
Shopping cart updated:
document.addEventListener("shoppingCartUpdated", function (e) {
var shoppingCartData = e.detail;
console.log(shoppingCartData);
}, false);
Shopping cart quantity updated:
document.addEventListener("shoppingCartQuantityUpdated", function (e) {
var shoppingCartQuantity = e.detail;
console.log(shoppingCartQuantity);
}, false);
Order successful:
document.addEventListener("orderSuccessful", function (e) {
var orderData = e.detail;
console.log(orderData);
}, false);
View changed:
document.addEventListener("viewChanged", function (e) {
var currentView = e.detail.currentView;
console.log(currentView);
}, false);
Event loaded:
document.addEventListener("eventLoaded", function (e) {
var event = e.detail.event;
console.log(event);
}, false);