Dokumentation til Safetickets API

Using the Safeticket Public API / XML feed

The Safeticket API provides a way to automatically get details about events, maintained by the customer in our database. Before you can use the public API it must first be activated by Safeticket.

Methods

There are basically two ways to fetch updated information about events.

  • Periodically fetch everything with the “all” method.
  • Periodically fetch the list of events with the “list” method and use the “modified” timestamps to determine the events that need updating. Then fetch each of these events using the “event” method.

All calls are done via https to the domain belonging to the given customer. If the domain is example.com and we e.g. want to call the “all” method, the URL to call will be “https://example.com/api/all”.

All

URL: https://example.com/api/all

This call returns details for all events:

<?xml version="1.0" encoding="UTF-8"?>
<events>
  <event id="152">
    <modified>2010-10-25T08:33:13+0200</modified>
    <title>Test 42</title>
    <venueid>123</venueid>
    <venue>Some venue</venue>
    <city>Aarhus</city>
    <category>Concerts</category>
    <date>2010-11-10</date>
    <time>19:00:00</time>
    <insale>true</insale>
    <soldout>false</soldout>
    <infourl>https://example.com/events/152-Test_42/</infourl>
    <buyurl>https://example.com/events/152-Test_42/ticket</buyurl>
    <teaser>Test</teaser>
    <description>Test</description>
    <photosmall>
      https://example.com/filestore/17b1ab0f6f6cd80bbdaf6decd13
    </photosmall>
    <photolarge>
      https://example.com/filestore/85e7c8701663a96e119a34518d4
    </photolarge>
    <ticketselection>count</ticketselection>
    <tickets>
      <ticket id="86">
	<name>Gnyf</name>
	<section>Section</section>
	<seatmap></seatmap>
	<type>Standing</type>
	<price>10.00</price>
        <ticketfee>6.25</ticketfee>
        <shippingfee>30.00</shippingfee>
	<currency>DKK</currency>
        <vat>25%</vat>
      </ticket>
      <ticket id="87"> 
        <name>Plop</name>
        <section>Section</section> 
        <seatmap></seatmap> 
        <type>Standing</type> 
        <price>5.00</price> 
        <ticketfee>6.25</ticketfee> 
        <shippingfee>30.00</shippingfee> 
        <currency>DKK</currency> 
        <vat>25%</vat> 
      </ticket>
    </tickets>
    <customfields>
    </customfields>
  </event>
...
</events>

List

URL: https://example.com/api/list

This call returns the list of all events along with the time of last modification:

<?xml version="1.0" encoding="UTF-8"?>
<events>
  <event id="152">
    <modified>2010-10-25T08:33:13+0200</modified>
    <detailsurl>https://example.com/api/events/152</detailsurl>
  </event>
  <event id="12">
    <modified>2010-10-25T08:33:13+0200</modified>
    <detailsurl>https://example.com/api/events/12</detailsurl>
  </event>
...
</events>

Event

URL: https://example.com/api/events/<ID>

This call returns the details for one specific event:

<?xml version="1.0" encoding="UTF-8"?>
<event id="152">
  <modified>2010-10-25T08:33:13+0200</modified>
  <title>Test 42</title>
  <venue>Some venue</venue>
  <city>Aarhus</city>
  <category>Concerts</category>
  <date>2010-11-10</date>
  <time>19:00:00</time>
  <insale>true</insale>
  <soldout>false</soldout>
  <infourl>https://example.com/events/152-Test_42/</infourl>
  <buyurl>https://example.com/events/152-Test_42/ticket</buyurl>
  <teaser>Test</teaser>
  <description>Test</description>
  <photosmall>
    https://example.com/filestore/17b1ab0f6f6cd80bbdaf6decd13
  </photosmall>
  <photolarge>
    https://example.com/filestore/85e7c8701663a96e119a34518d4
  </photolarge>
  <ticketselection>count</ticketselection>
  <tickets>
    <ticket id="86">
      <name>Gnyf</name>
      <section>Section</section>
      <seatmap></seatmap>
      <type>Standing</type>
      <price>10.00</price>
      <ticketfee>6.25</ticketfee>
      <shippingfee>30.00</shippingfee>
      <currency>DKK</currency>
      <vat>25%</vat>
    </ticket>
    <ticket id="87">
      <name>Plop</name>
      <section>Section</section>
      <seatmap></seatmap>
      <type>Standing</type>
      <price>5.00</price>
      <ticketfee>6.25</ticketfee>
      <shippingfee>30.00</shippingfee>
      <currency>DKK</currency>
      <vat>25%</vat>
    </ticket>
  </tickets>
  <customfields>
    <customfield>
      <name>CUSTOM_ef_92</name>
      <description>Flaf</description>
      <emptyok>false</emptyok>
      <perticket>false</perticket>
      <tickets>all</tickets>
    </customfield>
    <customfield>
      <name>CUSTOM_ef_93</name>
      <description>Gnyf</description>
      <emptyok>true</emptyok>
      <perticket>true</perticket>
      <tickets>86,87</tickets>
    </customfield>
  </customfields>
</event>

Notes

The intended use of this facility is to allow updating a local database that can be used when presenting the information.

Requesting the XML files or images from our servers on every page view is strongly discouraged.

If you have problems or questions, please contact us at api@safeticket.dk.
We charge an hourly fee of DKK 995,00+VAT for support regarding the API.

Using the Safeticket Private API

Before you can use the private API it must first be activated by Safeticket after which you have to create one or more API users.

After logging in choose Opsætning in the menu and click API brugere. Now click Opret API bruger.

Brugernavn is important as that is what is used when accessing the API for identifying the user. Pay attention to the permissions as well and make sure to adjust them appropriately.

When you are done and have created the user open the user for editing and note the field Hemmelighed.

The username and secret make up your credentiels for private API access.

API methods are invoked by a HTTP POST request having the needed parameters encoded as regular POST fields. All values are to be sent UTF-8 encoded.

Authentication is based on a hash of the parameters sent to a given API method concatenated together with the secret. It is important to calculate the hash using all the parameters separated by the correct delimiter.

Here is an example of the hash calculation for a call to the “/api/stats” method.

The parameters that are sent are the following:

version1
userwebshop
cash
t12011-10-01
t22011-11-01
sha79a7f895e442b5c0e17323a4a3eab17a88c457c299342ea25381939f7a0d5a06

In order to calculate the hash we first need to build the string that will be fed to the hash function.
To build this string we concatenate all the parameters as well as the secret and separate them with “:”.
In pseudocode: concatenate(version, “:”, user, “:”, cash, “:”, t1, “:”, t2, “:”, secret)

The string in this example then looks like this: “1:webshop:0:2011-10-01:2011-11-01:7ba7fbff4ef6933974c8c82b9419b6706338be8ab40d556980cbdfac5d868d20”

We then calculate the SHA-256 hash of the string:
sha256(“1:webshop:0:2011-10-01:2011-11-01:7ba7fbff4ef6933974c8c82b9419b6706338be8ab40d556980cbdfac5d868d20”)

The result is the string “79a7f895e442b5c0e17323a4a3eab17a88c457c299342ea25381939f7a0d5a06” which is sent as the “sha” parameter.

When the request has been successfully handled you will get an XML document as response.

If you have problems or questions, please contact us at api@safeticket.dk.
We charge an hourly fee of DKK 995,00+VAT for support regarding the API.

Retrieving ticketsale statistics via the Safeticket private API

All events

URL: https://example.com/api/stats

The parameters to send are the following:

versionAPI version. Always 1.
userThe name of the API user you have created.
cash“0” or “1”. Controls whether cash payments are included in the result.
t1Date specifying the beginning of the period that you wish to retrieve statistics for on the format “YYYY-MM-DD”.
t2Date specifying the end of the period that you wish to retrieve statistics for on the format “YYYY-MM-DD”.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, cash, “:”, t1, “:”, t2, “:”, secret))

This call returns statistics for all events:

<?xml version="1.0" encoding="UTF-8"?>
<events t1="2011-10-01" t2="2011-11-01">
  <event id="241">
    <refunded>
    </refunded>
    <ticketfees>
      <fee>
	<amount>6.25</amount>
	<currency>DKK</currency>
	<count>1</count>
      </fee>
      <fee>
	<amount>-6.25</amount>
	<currency>DKK</currency>
	<count>1</count>
      </fee>
    </ticketfees>
    <shipping>
      <count>0</count>
      <fee>0.00</fee>
    </shipping>
    <tickets>
      <ticket id="166">
	<name>Elevbillet</name>
	<prices>
	  <price>
	    <amount>100.00</amount>
	    <currency>DKK</currency>
	    <count>1</count>
	  </price>
	</prices>
      </ticket>
    </tickets>
  </event>
  <event id="26">
    <refunded>
    </refunded>
    <ticketfees>
      <fee>
	<amount>6.25</amount>
	<currency>DKK</currency>
	<count>3</count>
      </fee>
      <fee>
	<amount>-6.25</amount>
	<currency>DKK</currency>
	<count>3</count>
      </fee>
    </ticketfees>
    <shipping>
      <count>0</count>
      <fee>0.00</fee>
    </shipping>
    <tickets>
      <ticket id="26">
	<name>Elevbillet</name>
	<prices>
	  <price>
	    <amount>100.00</amount>
	    <currency>DKK</currency>
	    <count>2</count>
	  </price>
	</prices>
      </ticket>
      <ticket id="31">
	<name>Ølbillet</name>
	<prices>
	  <price>
	    <amount>1.00</amount>
	    <currency>DKK</currency>
	    <count>1</count>
	  </price>
	</prices>
      </ticket>
    </tickets>
  </event>
</events>

Single event

URL: https://example.com/api/stats/<ID>

The parameters to send are the following:

version
API version. Always “1”.
userThe name of the API user you have created.
eventThe event ID for which you wish to retrieve statistics.
cash“0” or “1”. Controls whether cash payments are included in the result.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, event, “:”, cash, “:”, secret))

This call returns statistics for a single event:

<?xml version="1.0" encoding="UTF-8"?>
<event id="26">
  <refunded>
    <ticket id="26">
      <name>Elevbillet</name>
      <prices>
        <price>
          <amount>1000.00</amount>
          <currency>DKK</currency>
          <count>65</count>
        </price>
        <price>
          <amount>100.00</amount>
          <currency>DKK</currency>
          <count>65</count>
        </price>
      </prices>
    </ticket>
    <ticket id="31">
      <name>Ølbillet</name>
      <prices>
        <price>
          <amount>1.00</amount>
          <currency>DKK</currency>
          <count>24</count>
        </price>
      </prices>
    </ticket>
  </refunded>
  <ticketfees>
    <fee>
      <amount>6.25</amount>
      <currency>DKK</currency>
      <count>97</count>
    </fee>
    <fee>
      <amount>10.00</amount>
      <currency>DKK</currency>
      <count>57</count>
    </fee>
    <fee>
      <amount>-6.25</amount>
      <currency>DKK</currency>
      <count>261</count>
    </fee>
  </ticketfees>
  <shipping>
    <count>0</count>
    <fee>0.00</fee>
  </shipping>
  <tickets>
    <ticket id="26">
      <name>Elevbillet</name>
      <prices>
        <price>
          <amount>1000.00</amount>
          <currency>DKK</currency>
          <count>65</count>
        </price>
        <price>
          <amount>100.00</amount>
          <currency>DKK</currency>
          <count>65</count>
        </price>
      </prices>
    </ticket>
    <ticket id="31">
      <name>Ølbillet</name>
      <prices>
        <price>
          <amount>1.00</amount>
          <currency>DKK</currency>
          <count>24</count>
        </price>
      </prices>
    </ticket>
  </tickets>
</event>

If you have problems or questions, please contact us at api@safeticket.dk.
We charge an hourly fee of DKK 995,00+VAT for support regarding the API.

Retrieving order details via the Safeticket Private API

Single order

URL: https://example.com/api/order

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
orderidThe order ID for which you wish to get details.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, orderid, “:”, secret))

The call returns details for the order:

<?xml version="1.0" encoding="UTF-8"?>
<orders>
  <order>
    <event>364</event>
    <orderid>9977</orderid>
    <time>2012-10-23 14:51:00</time>
    <paymentsequencenumber>23791</paymentsequencenumber>
    <mailshipping>false</mailshipping>
    <name>Arne Olsen</name>
    <address>Testvej 89</address>
    <address2></address2>
    <zip>8000</zip>
    <city>Aarhus C</city>
    <telephone>12345678</telephone>
    <email>arne@safeticket.dk</email>
    <country>Denmark</country>
    <newsletter>false</newsletter>
    <shippingfee>0.00</shippingfee>
    <cardfee>1.58</cardfee>
    <total>125.33</total>
    <vatamount>24.75</vatamount>
    <status>paid</status>
    <vouchercode>
      <code>secretcode</code>
      <count>5</count>
    </vouchercode>
    <customfields>
      <customfield>
        <name>CUSTOM_class</name>
        <value>3.b</value>
      </customfield>
    </customfields>
    <tickets>
      <ticket>
        <ticketnumber>QMJ3TBUSFN</ticketnumber>
        <ticketid>340</ticketid>
        <price>35.00</price>
        <ticketfee>6.25</ticketfee>
        <arrived>false</arrived>
        <customfields>
          <customfield>
            <name>CUSTOM_name</name>
            <value>Arne Olsen</value>
          </customfield>
        </customfields>
        <seat>
          <row>7</row>
          <seat>1</seat>
        </seat>
      </ticket>
      <ticket>
        <ticketnumber>0OVNS83WLH</ticketnumber>
        <ticketid>340</ticketid>
        <price>35.00</price>
        <ticketfee>6.25</ticketfee>
        <arrived>false</arrived>
        <customfields>
          <customfield>
            <name>CUSTOM_name</name>
            <value>Ole Olsen</value>
          </customfield>
        </customfields>
        <seat>
          <row>7</row>
          <seat>3</seat>
        </seat>
      </ticket>
    </tickets>
  </order>
</orders>

Orders placed during a given period

URL: https://example.com/api/orders

The parameters to send are the following:

version
API version. Always “1”.
userThe name of the API user you have created.
eventsThe events for which you wish to get order details. Comma separated list of event IDs or ‘all’.
sequence_number(Empty string)
t1Date specifying the beginning of the period that you wish to get order details for on the format “YYYY-MM-DD”.
t2Date specifying the end of the period that you wish to get order details for on the format “YYYY-MM-DD”.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, events, “:”, sequence_number, “:”, t1, “:”, t2, “:”, secret))

This call returns order details in the same format as the call above that returns details for a single order. The only difference is that there may be more (or none) <order> elements in the response.

Orders placed since the last query

URL: https://example.com/api/orders

versionAPI version. Always “1”.
userThe name of the API user you have created.
eventsThe events for which you wish to get order details. Comma separated list of event IDs or ‘all’.
sequence_numberThe payment sequence number associated with the last order already retrieved.
t1(Empty string)
t2(Empty string)
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, events, “:”, sequence_number, “:”, t1, “:”, t2, “:”, secret))

This call provides a way to periodically poll for new orders.

When an order has been completed it is assigned a payment sequence number. If the order is later refunded it is assigned a new payment sequence number. Payment sequence numbers are assigned as monotonically increasing integers.

The client must keep track of the highest payment sequence number received so far. By sending this number along with the call, only new orders and newly refunded orders will be returned. To get this going initially, you will need to fetch details for a single known order and use the payment sequence number from that order.

This call returns order details in the same format as the call above.

If you have problems or questions, please contact us at api@safeticket.dk.
We charge an hourly fee of DKK 995,00+VAT for support regarding the API.

Issuing tickets via the Safeticket private API

Issuing tickets via the API is a five step process (for simple orders):
• Get reservation token
• Get event details
• Reserve tickets
• Place order
• Confirm payment

It is possible to issue tickets for more than one event at a time by using the basket functionality. Using the same token, you can do the following sequence of actions for multiple events subsequently:
• Get available tickets
• Get event details
• Reserve tickets

At any time you can use the basket call to get the current contents of the basket as well as the expiration time. The expiration counter starts when tickets are first added to the basket and allows for 10 minutes to complete the order. After that the basket is emptied and its tickets are released.

If you have added tickets to the basket with associated seatmaps, you need to open the seat selection url in your browser view before making the call to place order. You can do this in your main window or an iframe. The seat selection page will let the ticket buyer select seats for all relevant tickets in the basket.

When the basket contains the desired tickets, you can call place order and confirm payment like in the simple case.

Get event list

URL: https://example.com/api/ticket/eventlist

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, secret))

This call returns the list of events currently in sale. It contains information that is not available in the public API:

<?xml version="1.0" encoding="UTF-8"?>
<events>
  <event id="180">
    <eventcode>082a4f6e91e60e5bb7be7a86182322fc4ab10e2c8ec8aa77180ba13bae547a6e05050c591daec9d60518c8e8a30612fa</eventcode>
    <closed>false</closed>
    <eventlist>eventtime1day</eventlist>
    <salestart>2019-04-01T00:00:00+0200</salestart>
    <saleend>2019-04-18T12:00:00+0200</saleend>
    <shorturl>madonna</shorturl>
    <specialfields>
      <specialfield>
        <name>Arrangementstype</name>
        <value>Koncert</value>
      </specialfield>
    </specialfields>
  </event>
  <event id="156">
    <eventcode>ce95e9b2d2452707b04ea81ffd66b46ddf3809353219afb39d561342094af692eafac2373ce3ce3a087b5b318993d793</eventcode>
    <closed>true</closed>
    <eventlist>eventtime1day</eventlist>
    <salestart>2019-01-28T00:00:00+0100</salestart>
    <saleend>2019-06-16T17:00:00+0200</saleend>
    <shorturl></shorturl>
    <specialfields>
      <specialfield>
        <name>Arrangementstype</name>
        <value>Rejse</value>
      </specialfield>
    </specialfields>
  </event>
</events>

Get reservation token

URL: https://example.com/api/ticket/gettoken

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
eventThe event ID for which you wish to issue tickets.
aggressive_timeout“0” or “1”. Controls whether to enable agressive timeout.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, event, “:”, aggressive_timeout, “:”, secret))

This call returns an rtoken value as well as the availability status of all the tickets for the event:

<?xml version="1.0" encoding="UTF-8"?>
<gettoken>
  <rtoken id="02246c57555d59c3d8062690c051b8b1" />
  <ticket id="10" available="true" total="1000" remaining="954" />
  <ticket id="91" available="true" total="1000" remaining="769" />
  <ticket id="12" available="true" total="1000" remaining="1000" />
  <ticket id="126" available="true" total="1000" remaining="823" />
  <ticket id="112" available="false" total="1000" remaining="0" />
  <ticket id="8" available="true" total="1000" remaining="271" />
</gettoken>

Get available tickets

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
eventThe event ID for which you wish to issue tickets.
rtokenThe rtoken value returned from the call to /api/gettoken.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, event, “:”, rtoken, “:”, secret))

This call returns the availability status of all the tickets for the event:

<?xml version="1.0" encoding="UTF-8"?>
<available>
  <ticket id="10" available="true" total="1000" remaining="954" />
  <ticket id="91" available="true" total="1000" remaining="769" />
  <ticket id="12" available="true" total="1000" remaining="1000" />
  <ticket id="126" available="true" total="1000" remaining="823" />
  <ticket id="112" available="false" total="1000" remaining="0" />
  <ticket id="8" available="true" total="1000" remaining="271" />
</available>

Get event details

The parameters to send are the following:

versionAPI version. Always “2”.
userThe name of the API user you have created.
eventThe event ID for which you wish to issue tickets.
rtokenThe rtoken value returned from the call to /api/gettoken.
vouchercodeAn optional voucher code. To place an order without using a voucher code, set this value to “”.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, event, “:”, rtoken, “:”, vouchercode, “:”, secret))

This call returns details for the event:

<?xml version="1.0" encoding="UTF-8"?>
<event id="152">
  <modified>2010-10-25T08:33:13+0200</modified>
  <title>Test 42</title>
  <venue>Some venue</venue>
  <city>Aarhus</city>
  <category>Concerts</category>
  <date>2010-11-10</date>
  <time>19:00:00</time>
  <eventtimeoverride>10. november 2010 kl. 19 - 24</eventtimeoverride>
  <insale>true</insale>
  <maxtickets>10</maxtickets>
  <fewtickets>false</fewtickets>
  <soldout>false</soldout>
  <infourl>https://example.com/events/152-Test_42/</infourl>
  <buyurl>https://example.com/events/152-Test_42/ticket</buyurl>
  <teaser>Test</teaser>
  <description>Test</description>
  <remarks>Husk at møde op til tiden.</remarks>
  <photosmall>
    https://example.com/filestore/17b1ab0f6f6cd80bbdaf6decd13
  </photosmall>
  <photolarge>
    https://example.com/filestore/85e7c8701663a96e119a34518d4
  </photolarge>
  <extraphoto>
    https://example.com/filestore/280c9d69d9d964edf872fe666a5
  </extraphoto>
  <ticketselection>count</ticketselection>
  <tags></tags>
  <customboxes>
    <custombox>
      <title>Prisen inkluderer</title>
      <content>Mad og flyrejse</content>
    </custombox>
  </customboxes>
  <tickets>
    <ticket id="86">
      <name>Gnyf</name>
      <section>Section</section>
      <seatmap></seatmap>
      <type>Standing</type>
      <mintickets>0</mintickets>
      <maxtickets>10</maxtickets>
      <buyamountincrement>1</buyamountincrement>
      <eventtimeoverride>10. november 2010 kl. 19 - 24</eventtimeoverride>
      <price>10.00</price>
      <ticketfee>6.25</ticketfee>
      <shippingfee>30.00</shippingfee>
      <currency>DKK</currency>
      <vat>25%</vat>
    </ticket>
    <ticket id="87">
      <name>Plop</name>
      <section>Section</section>
      <seatmap></seatmap>
      <type>Standing</type>
      <mintickets>0</mintickets>
      <maxtickets>10</maxtickets>
      <buyamountincrement>1</buyamountincrement> 
      <eventtimeoverride></eventtimeoverride>
      <price>5.00</price>
      <ticketfee>6.25</ticketfee>
      <shippingfee>30.00</shippingfee>
      <currency>DKK</currency>
      <vat>25%</vat>
    </ticket>
  </tickets>
  <customfields>
    <customfield>
      <name>CUSTOM_ef_92</name>
      <description>Flaf</description>
      <emptyok>false</emptyok>
      <perticket>false</perticket>
      <tickets>all</tickets>
    </customfield>
    <customfield>
      <name>CUSTOM_ef_93</name>
      <description>Gnyf</description>
      <emptyok>true</emptyok>
      <perticket>true</perticket>
      <tickets>86,87</tickets>
    </customfield>
  </customfields>
</event>

If you have made a request using a voucher code and the code is either invalid or depleted, there will be no tickets listed.

Reserve tickets

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
eventThe event ID for which you wish to issue tickets.
rtokenThe rtoken value returned from the call to /api/gettoken.
ticketsComma separated list of ticket IDs and counts. E.g. “8,2,10,4”.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, event, “:”, rtoken, “:”, tickets, “:”, secret))

This call returns the tickets actually reserved as a result of the call:

<?xml version="1.0" encoding="UTF-8"?>
<reserve>
  <ticket id="112" count="0" />
  <ticket id="8" count="2" />
  <ticket id="10" count="4" />
  <ticket id="91" count="0" />
  <ticket id="12" count="0" />
  <ticket id="126" count="0" />
</reserve>

Basket

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
rtokenThe rtoken value returned from the call to /api/gettoken.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, rtoken, “:”, secret))

This call returns the current basket:

<?xml version="1.0" encoding="UTF-8"?>
<basket expiration="594">
  <event id="65" name="Skolefest" currency="DKK">
  <ticket id="614" count="2" name="Elev" price="10000" ticketfee="0" />
  <ticket id="615" count="3" name="Gæst" price="20000" ticketfee="625" />
</basket>

Empty basket

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
rtokenThe rtoken value returned from the call to /api/gettoken.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, rtoken, “:”, secret))

This call empties the current basket and returns an empty element:

<?xml version="1.0" encoding="UTF-8"?>
<emptybasket>
</emptybasket>

Place order

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
rtokenThe rtoken value returned from the call to /api/gettoken.
totalTotal price in øre.
nameOrder name
addressOrder address
address2Order address2
zipOrder zip
cityOrder city
telephoneOrder telephone
emailOrder email
countryOrder country
cardtypeAlways “”.
newsletter“0” or “1”. Indicates whether the buyer of the tickets accepts receiving a newsletter.
shippingmail“0” or “1”. Indicates whether the buyer of the tickets has chosen to get the tickets mailed.
CUSTOM_field1The first custom field for the event.
CUSTOM_field2The second custom field for the event.
CUSTOM_ …
T0_CUSTOM_field3The first custom field for the first ticket.
T0_CUSTOM_field4The second custom field for the first ticket.
T1_CUSTOM_field3The first custom field for the second ticket.
T1_CUSTOM_field4The second custom field for the second ticket.
T2_CUSTOM_ …
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, rtoken, “:”, total, “:”, name, “:”, address, “:”, address2, “:”, zip, “:”, city, “:”, telephone, “:”, email, “:”, country, “:”, cardtype, “:”, newsletter, “:”, shippingmail, “:”, CUSTOM_field1, “:”, CUSTOM_field2, “:”, CUSTOM_ … , “:”, secret))

This call places the order and returns the status and the order number:

<?xml version="1.0" encoding="UTF-8"?>
<placeorder>
<status>OK</status>
<order>7290</order>
</placeorder>

Confirm payment

The parameters to send are the following:

versionAPI version. Always “1”.
userThe name of the API user you have created.
rtokenThe rtoken value returned from the call to /api/gettoken.
orderidThe order number from the call to /api/placeorder.
transactionTransaction number from the payment. Optional.
cardnumberMasked card number from the payment. Optional.
sendmail“0” or “1”. Controls whether Safeticket should send an order confirmation mail.
shaThe SHA-256 hash.

Pseudocode for calculating the hash:
sha256(concatenate(version, “:”, user, “:”, rtoken, “:”, orderid, “:”, transaction, “:”, cardnumber, “:”, sendmail, “:”, secret))

This call marks the order as paid and returns the link to the ticket PDF:

<?xml version="1.0" encoding="UTF-8"?>
<confirmpayment>
  <status>OK</status>
  <ticketpdf>
    https://example.com/pdf?id=7290&mailid=55350cdb4155c2c4d7292c87048adbe6d7044bbb206516a479d8022c77031034b73e7b8d386c9e9a0aa411bdc66ff4f2
  </ticketpdf>
</confirmpayment>

Seatmap selection

The parameters to send are the following:

rtokenThe rtoken value returned from the call to /api/gettoken.
continue_urlThe URL to redirect to when seatmap selection is complete.
back_urlThe URL to redirect to if the user aborts seatmap selection.

This call opens the seatmap selection interface and should be initiated from the user browser.

The user will be prompted to select seats for every ticket type added to the basket that has associated seatmaps.

When seat selection is complete, the user will be redirected to the continue URL.

If the user aborts seat selection, he/she will be redirected to the back URL.

If you have problems or questions, please contact us at api@safeticket.dk.
We charge an hourly fee of DKK 995,00+VAT for support regarding the API.