SieCommerce Checkout Widget (JavaScript Library)
This JS library will add the checkout widget to your checkout page.
Methods
1 - Initialize
window.sieCommerce.checkout({...})
This is the method to initialize the widget
2 - Reload
window.sieCommerce.reload();
If you have made any changes to the basket (for example adding a delivery charge), you can force the widget to refresh.
Initialisation
1 - Load the JS widget on your page, by adding the following:
<script src="https://siecommerce.sfs.siemens.com/static/widget/widget-bundle.js"></script>
2 - Initialize the widget by adding the following (after the JS above has been added):
<script id="sfs-teaser-script">
window.onload = function () {
window.sieCommerce.checkout({
targetDiv: '',
token: token,
merchantUrls: {
successUrl: location.href + '?success',
failureUrl: location.href + '?failure',
cancelUrl: location.href + '?cancel',
errorUrl: location.href + '?error',
},
options: {
logoUrl: 'string',
}
})
)};
</script>
-
targetDiv: A string representing the ID of the HTML
<div>element where you would like the widget to appear. You can specify your own ID, or if left blank, the widget will look for the ID_sfs_checkout<div id="_sfs_checkout"></div> -
token: A string representing the widget token generated using the API
- merchantUrls: An object representing URLs you can specify for where the customer is redirected
to:
- successUrl: successful (accepted) credit decision
- failureUrl: unsuccessful (declined) credit decision
- cancelUrl: customer cancels the transaction
- errorUrl: processing error
- options: object representing additional options:
- logoUrl: string representing a URL for a logo that you can add to the widget to match your branding