Widget

Booking widget embedding utility

For integrating the booking process into a partner platform, a widget is available. Widgets are referenced by Widget-Hash.

You need to embed the Widget /assets/js/widgetapi.js into your hostpage and use the NextEventWidgetAPI to interact with the widget.

Embed Widget

<?php
use NextEvent\PHPSDK\Client;

$appUrl = 'https://myapp.nextevent.com';
$credentials = [...];
$widgetHash = 's67fa757df4a76s5';

$client = new Client($appUrl, $credentials, $widgetHash);

// get Widget
$widget = $client->getWidget();

// embed Widget
echo $widget->generateEmbedCode($event_id);

NextEventWidgetAPI

The NextEventWidgetAPI is a JavaSrcipt script, which you can use to register Message Handlers. Therefore the script has to be included into the hostpage.

Use NextEventWidgetAPI for retrieving the order_id and send it to your server. Use NextEventWidgetAPI to show your own payment step on current_step message

<script src="/assets/js/widgetapi.js"></script>

When the script is included the NextEventWidgetAPI is available by window .NextEventWidgetAPI

function custom_handler(data) {
// do something with the data
}

// handler can be added
window.NextEventWidgetAPI.addMessageHandler('current_step', custom_handler);
// and removed
window.NextEventWidgetAPI.removeMessageHandler('current_step', custom_handler);

Widget Messages

current_step

This message is send on changing routes. step current step a path

example data:

{
step: '/event/42'
}

{
step: '/payment'
}

{
step: '/checkout'
}

basket_update

This message is send when the basket is updated order_id id from current basket

example data:

{
order_id: 5005
}
package

NextEvent\PHPSDK\Util

Methods

Compose HTML to be embedded in the host website

generateEmbedCode(array|string $params = array()) : string

For a list of supported widget parameters, see the SDK documentation.

see https://developer.nextevent.com/#embed-the-booking-widget

Arguments

$params

array|string

Hash array with widget parameters or string with ID of the event to book tickets for

Response

string