Create a new order

Content

Resource URL

https://apps.ticketmatic.com/api/1/{accountname}/orders

Description

Creates a new empty order.

Each order is linked to a sales channel, which needs to be supplied when creating.

Note: This method may return a 429 Rate Limit Exceeded status when there is too much demand.

Example

Request

 1use Ticketmatic\Endpoints\Orders;
 2
 3$result = Orders::create($client, array(
 4    "events" => array(
 5        324,
 6        131,
 7    ),
 8    "products" => array(
 9        574,
10        186,
11    ),
12    "saleschannelid" => 1,
13));

Response

  1object(\Ticketmatic\Model\Order) (33) {
  2  ["orderid"]=>
  3  int(0)
  4  ["amountpaid"]=>
  5  float(15.000000)
  6  ["calculate_ordercosts"]=>
  7  bool(true)
  8  ["code"]=>
  9  string(12) "864056970700"
 10  ["customerid"]=>
 11  int(0)
 12  ["deferredpaymentproperties"]=>
 13  array(4) {
 14    ["bankAccount"]=>
 15    string(16) "BE54719400092697"
 16    ["bankBic"]=>
 17    string(8) "FTSBBE22"
 18    ["bankName"]=>
 19    string(25) "Stichting Mollie Payments"
 20    ["transferReference"]=>
 21    string(20) "+++695/7317/77752+++"
 22  }
 23  ["deliveryaddress"]=>
 24  object(\Ticketmatic\Model\Address) (2) {
 25    ["city"]=>
 26    string(6) "Leuven"
 27    ["street1"]=>
 28    string(11) "Main street"
 29  }
 30  ["deliveryscenarioid"]=>
 31  int(0)
 32  ["deliverystatus"]=>
 33  int(0)
 34  ["expiryhandled"]=>
 35  bool(false)
 36  ["expiryts"]=>
 37  object(\DateTime) (3) {
 38    ["date"]=>
 39    string(26) "2014-09-26 15:24:36.000000"
 40    ["timezone_type"]=>
 41    int(3)
 42    ["timezone"]=>
 43    string(3) "UTC"
 44  }
 45  ["firstname"]=>
 46  string(4) "John"
 47  ["hasopenpaymentrequest"]=>
 48  bool(true)
 49  ["isauthenticatedcustomer"]=>
 50  bool(false)
 51  ["lastname"]=>
 52  string(3) "Doe"
 53  ["lookup"]=>
 54  array(1) {
 55    ["events"]=>
 56      array(0) {
 57      }
 58  }
 59  ["nbroftickets"]=>
 60  int(0)
 61  ["ordercosts"]=>
 62  array(2) {
 63    [0]=>
 64    object(\Ticketmatic\Model\Ordercost) (3) {
 65      ["orderid"]=>
 66      int(0)
 67      ["amount"]=>
 68      float(5.500000)
 69      ["servicechargedefinitionid"]=>
 70      int(0)
 71    }
 72    [1]=>
 73    object(\Ticketmatic\Model\Ordercost) (3) {
 74      ["orderid"]=>
 75      int(0)
 76      ["amount"]=>
 77      float(2.000000)
 78      ["servicechargedefinitionid"]=>
 79      int(0)
 80    }
 81  }
 82  ["payments"]=>
 83  array(1) {
 84    [0]=>
 85    object(\Ticketmatic\Model\Payment) (7) {
 86      ["id"]=>
 87      int(0)
 88      ["orderid"]=>
 89      int(0)
 90      ["amount"]=>
 91      float(50.000000)
 92      ["paidts"]=>
 93      object(\DateTime) (3) {
 94        ["date"]=>
 95        string(26) "2015-04-07 07:00:00.000000"
 96        ["timezone_type"]=>
 97        int(3)
 98        ["timezone"]=>
 99        string(3) "UTC"
100      }
101      ["paymentmethodid"]=>
102      int(0)
103      ["properties"]=>
104      NULL
105      ["refundpaymentid"]=>
106      NULL
107    }
108  }
109  ["paymentscenarioid"]=>
110  int(0)
111  ["paymentstatus"]=>
112  int(0)
113  ["products"]=>
114  array(1) {
115    [0]=>
116    object(\Ticketmatic\Model\OrderProduct) (8) {
117      ["id"]=>
118      int(0)
119      ["orderid"]=>
120      int(0)
121      ["code"]=>
122      string(12) "123412341234"
123      ["contactid"]=>
124      NULL
125      ["price"]=>
126      float(15.000000)
127      ["productid"]=>
128      int(0)
129      ["properties"]=>
130      NULL
131    }
132  }
133  ["promocodes"]=>
134  array(2) {
135    [0]=>
136    string(9) "PROMO2015"
137    [1]=>
138    string(9) "COOLPROMO"
139  }
140  ["queuetokens"]=>
141  array(2) {
142    [0]=>
143    int(0)
144    [1]=>
145    int(0)
146  }
147  ["rappelhandled"]=>
148  bool(false)
149  ["rappelts"]=>
150  object(\DateTime) (3) {
151    ["date"]=>
152    string(26) "2014-09-26 15:24:36.000000"
153    ["timezone_type"]=>
154    int(3)
155    ["timezone"]=>
156    string(3) "UTC"
157  }
158  ["saleschannelid"]=>
159  int(0)
160  ["status"]=>
161  int(0)
162  ["tickets"]=>
163  array(2) {
164    [0]=>
165    object(\Ticketmatic\Model\OrderTicket) (8) {
166      ["id"]=>
167      int(0)
168      ["orderid"]=>
169      int(0)
170      ["price"]=>
171      float(15.000000)
172      ["servicecharge"]=>
173      float(1.000000)
174      ["ticketholderid"]=>
175      NULL
176      ["ticketname"]=>
177      NULL
178      ["tickettypeid"]=>
179      int(0)
180      ["tickettypepriceid"]=>
181      int(0)
182    }
183    [1]=>
184    object(\Ticketmatic\Model\OrderTicket) (8) {
185      ["id"]=>
186      int(0)
187      ["orderid"]=>
188      int(0)
189      ["price"]=>
190      float(15.000000)
191      ["servicecharge"]=>
192      float(1.000000)
193      ["ticketholderid"]=>
194      NULL
195      ["ticketname"]=>
196      NULL
197      ["tickettypeid"]=>
198      int(0)
199      ["tickettypepriceid"]=>
200      int(0)
201    }
202  }
203  ["totalamount"]=>
204  float(25.500000)
205  ["webskinid"]=>
206  int(0)
207  ["createdts"]=>
208  object(\DateTime) (3) {
209    ["date"]=>
210    string(26) "2014-09-26 15:24:36.000000"
211    ["timezone_type"]=>
212    int(3)
213    ["timezone"]=>
214    string(3) "UTC"
215  }
216  ["lastupdatets"]=>
217  object(\DateTime) (3) {
218    ["date"]=>
219    string(26) "2014-09-26 15:24:36.000000"
220    ["timezone_type"]=>
221    int(3)
222    ["timezone"]=>
223    string(3) "UTC"
224  }
225}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/orders"
 4)
 5
 6result, err := orders.Create(client, &ticketmatic.CreateOrder{
 7    Events: []int64{
 8        324,
 9        131,
10    },
11    Products: []int64{
12        574,
13        186,
14    },
15    Saleschannelid: 1,
16})

Response

  1result := &ticketmatic.Order{
  2    Orderid: 1269434,
  3    Amountpaid: 15,
  4    CalculateOrdercosts: true,
  5    Code: "864056970700",
  6    Customerid: 1256,
  7    Deferredpaymentproperties: map[string]interface{}{
  8        "bankAccount": "BE54719400092697",
  9        "bankBic": "FTSBBE22",
 10        "bankName": "Stichting Mollie Payments",
 11        "transferReference": "+++695/7317/77752+++",
 12    },
 13    Deliveryaddress: &ticketmatic.Address{
 14        City: "Leuven",
 15        Street1: "Main street",
 16    },
 17    Deliveryscenarioid: 1,
 18    Deliverystatus: 2602,
 19    Expiryhandled: false,
 20    Expiryts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
 21    Firstname: "John",
 22    Hasopenpaymentrequest: true,
 23    Isauthenticatedcustomer: false,
 24    Lastname: "Doe",
 25    Lookup: map[string]interface{}{
 26        "events": []interface {}{},
 27    },
 28    Nbroftickets: 0,
 29    Ordercosts: []*ticketmatic.Ordercost{
 30        &ticketmatic.Ordercost{
 31            Orderid: 123,
 32            Amount: 5.5,
 33            Servicechargedefinitionid: 12,
 34        },
 35        &ticketmatic.Ordercost{
 36            Orderid: 123,
 37            Amount: 2,
 38            Servicechargedefinitionid: 13,
 39        },
 40    },
 41    Payments: []*ticketmatic.Payment{
 42        &ticketmatic.Payment{
 43            Id: 125,
 44            Orderid: 412,
 45            Amount: 50,
 46            Paidts: ticketmatic.NewTime(ticketmatic.MustParseTime("2015-04-07 07:00:00")),
 47            Paymentmethodid: 2,
 48            Properties: nil,
 49            Refundpaymentid: 0,
 50        },
 51    },
 52    Paymentscenarioid: 1,
 53    Paymentstatus: 0,
 54    Products: []*ticketmatic.OrderProduct{
 55        &ticketmatic.OrderProduct{
 56            Id: 35539,
 57            Orderid: 368,
 58            Code: "123412341234",
 59            Contactid: 0,
 60            Price: 15,
 61            Productid: 234,
 62            Properties: nil,
 63        },
 64    },
 65    Promocodes: []string{
 66        "PROMO2015",
 67        "COOLPROMO",
 68    },
 69    Queuetokens: []int64{
 70        0,
 71        24,
 72    },
 73    Rappelhandled: false,
 74    Rappelts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
 75    Saleschannelid: 1,
 76    Status: 1,
 77    Tickets: []*ticketmatic.OrderTicket{
 78        &ticketmatic.OrderTicket{
 79            Id: 35539,
 80            Orderid: 368,
 81            Price: 15,
 82            Servicecharge: 1,
 83            Ticketholderid: 0,
 84            Ticketname: <nil>,
 85            Tickettypeid: 111,
 86            Tickettypepriceid: 632,
 87        },
 88        &ticketmatic.OrderTicket{
 89            Id: 35540,
 90            Orderid: 368,
 91            Price: 15,
 92            Servicecharge: 1,
 93            Ticketholderid: 0,
 94            Ticketname: <nil>,
 95            Tickettypeid: 111,
 96            Tickettypepriceid: 632,
 97        },
 98    },
 99    Totalamount: 25.5,
100    Webskinid: 1,
101    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
102    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
103}

Request

1POST /api/1/{accountname}/orders HTTP/1.1
2Content-Type: application/json
3
4{
5    "events": [ 324, 131 ],
6    "products": [ 574, 186 ],
7    "saleschannelid": 1
8}

Response

  1HTTP/1.1 200 OK
  2Content-Type: application/json
  3
  4{
  5    "orderid": 1269434,
  6    "amountpaid": 15.000000,
  7    "calculate_ordercosts": true,
  8    "code": "864056970700",
  9    "customerid": 1256,
 10    "deferredpaymentproperties": {
 11        "bankAccount": "BE54719400092697",
 12        "bankBic": "FTSBBE22",
 13        "bankName": "Stichting Mollie Payments",
 14        "transferReference": "+++695/7317/77752+++"
 15    },
 16    "deliveryaddress": {
 17        "city": "Leuven",
 18        "street1": "Main street"
 19    },
 20    "deliveryscenarioid": 1,
 21    "deliverystatus": 2602,
 22    "expiryhandled": false,
 23    "expiryts": "2014-09-26 15:24:36",
 24    "firstname": "John",
 25    "hasopenpaymentrequest": true,
 26    "isauthenticatedcustomer": false,
 27    "lastname": "Doe",
 28    "lookup": {
 29        "events": []
 30    },
 31    "nbroftickets": 0,
 32    "ordercosts": [
 33        {
 34            "orderid": 123,
 35            "amount": 5.500000,
 36            "servicechargedefinitionid": 12
 37        },
 38        {
 39            "orderid": 123,
 40            "amount": 2.000000,
 41            "servicechargedefinitionid": 13
 42        }
 43    ],
 44    "payments": [
 45        {
 46            "id": 125,
 47            "orderid": 412,
 48            "amount": 50.000000,
 49            "paidts": "2015-04-07 07:00:00",
 50            "paymentmethodid": 2,
 51            "properties": null,
 52            "refundpaymentid": null
 53        }
 54    ],
 55    "paymentscenarioid": 1,
 56    "paymentstatus": 0,
 57    "products": [
 58        {
 59            "id": 35539,
 60            "orderid": 368,
 61            "code": "123412341234",
 62            "contactid": null,
 63            "price": 15.000000,
 64            "productid": 234,
 65            "properties": null
 66        }
 67    ],
 68    "promocodes": [
 69        "PROMO2015",
 70        "COOLPROMO"
 71    ],
 72    "queuetokens": [ 0, 24 ],
 73    "rappelhandled": false,
 74    "rappelts": "2014-09-26 15:24:36",
 75    "saleschannelid": 1,
 76    "status": 1,
 77    "tickets": [
 78        {
 79            "id": 35539,
 80            "orderid": 368,
 81            "price": 15.000000,
 82            "servicecharge": 1.000000,
 83            "ticketholderid": null,
 84            "ticketname": null,
 85            "tickettypeid": 111,
 86            "tickettypepriceid": 632
 87        },
 88        {
 89            "id": 35540,
 90            "orderid": 368,
 91            "price": 15.000000,
 92            "servicecharge": 1.000000,
 93            "ticketholderid": null,
 94            "ticketname": null,
 95            "tickettypeid": 111,
 96            "tickettypepriceid": 632
 97        }
 98    ],
 99    "totalamount": 25.500000,
100    "webskinid": 1,
101    "createdts": "2014-09-26 15:24:36",
102    "lastupdatets": "2014-09-26 15:24:36"
103}

Request body fields

FieldDescription
events
int[]

Event IDs that might end up in this order, this is optional.

Example value:[ 324, 131 ]
products
int[]

Product IDs that might end up in this order, this is optional.

Example value:[ 574, 186 ]
saleschannelid
int 
(required)

Sales channel in which this order is created

Example value:1

Type reference: CreateOrder

Result fields

FieldDescription
orderid
int

Order ID

Example value:1269434
amountpaid
decimal

Total amount paid

Example value:15.000000
calculate_ordercosts
bool

Whether or not auto / script order fees should be calculated

Example value:true
code
string

Order code

Used as a unique identifier in web sales.

Example value:"864056970700"
customerid
int

Customer ID

Example value:1256
deferredpaymentproperties
map<string, mixed>

Information on the deferred payment scenario. Structure depends on payment method

Example value:{ "bankAccount": "BE54719400092697", "bankBic": "FTSBBE22", "bankName": "Stichting Mollie Payments", "transferReference": "+++695/7317/77752+++" }
deliveryaddress

Address used when delivering physically

Example value:{ "city": "Leuven", "street1": "Main street" }
deliveryscenarioid
int

Delivery scenario ID

See delivery scenarios for more info.

Example value:1
deliverystatus
int

Delivery status

Possible values:

  • 2601: Not delivered
  • 2602: Delivered
  • 2603: Changed after delivery
Example value:2602
expiryhandled
bool

Whether the expired order has been handled (and optionally expiry mail has been sent)

expiryts
timestamp

When the order will expire

Example value:"2014-09-26 15:24:36"
firstname
string

First name (only with minimal output)

Example value:"John"
hasopenpaymentrequest
bool

Indicates of the order has an open payment request with a PSP.

Example value:true
isauthenticatedcustomer
bool

Has customer authenticated?

lastname
string

Last name (only with minimal output)

Example value:"Doe"
lookup
map<string, mixed>

Related objects

See the lookup fields on the getlist operation for a full description.

Example value:{ "events": [] }
nbroftickets
int

Number of tickets in the order. Read-only

ordercosts

Order fees for the order

Example value:[ { "orderid": 123, "amount": 5.500000, "servicechargedefinitionid": 12 }, { "orderid": 123, "amount": 2.000000, "servicechargedefinitionid": 13 } ]
payments

Payments for the order

Example value:[ { "id": 125, "orderid": 412, "amount": 50.000000, "paidts": "2015-04-07 07:00:00", "paymentmethodid": 2, "properties": null, "refundpaymentid": null } ]
paymentscenarioid
int

Payment scenario ID

See payment scenarios for more info.

Example value:1
paymentstatus
int

Payment status

Possible values:

  • 0: Incomplete
  • 1: Fully paid
  • 2: Overpaid
products

Products in the order

Example value:[ { "id": 35539, "orderid": 368, "code": "123412341234", "contactid": null, "price": 15.000000, "productid": 234, "properties": null } ]
promocodes
string[]

Promocodes active for the Order

Example value:[ "PROMO2015", "COOLPROMO" ]
queuetokens
int[]

Queue tokens for rate limiting

Example value:[ 0, 24 ]
rappelhandled
bool

Whether the overdue order has been handled (and optionally reminder mail has been sent)

rappelts
timestamp

When the reminder mail will be sent

Example value:"2014-09-26 15:24:36"
saleschannelid
int

Sales channel ID

See sales channels for more info.

Example value:1
status
int

Order status

Possible values:

  • 21001: Unconfirmed
  • 21002: Confirmed
  • 21003: Archived
Example value:1
tickets

Tickets in the order

Example value:[ { "id": 35539, "orderid": 368, "price": 15.000000, "servicecharge": 1.000000, "ticketholderid": null, "ticketname": null, "tickettypeid": 111, "tickettypepriceid": 632 }, { "id": 35540, "orderid": 368, "price": 15.000000, "servicecharge": 1.000000, "ticketholderid": null, "ticketname": null, "tickettypeid": 111, "tickettypepriceid": 632 } ]
totalamount
decimal

Total order amount

Includes all costs and fees.

Example value:25.500000
webskinid
int

Reference to the webskin that is used for showing the orderdetail page.

Example value:1
createdts
timestamp

Created timestamp

Example value:"2014-09-26 15:24:36"
lastupdatets
timestamp

Last updated timestamp

Example value:"2014-09-26 15:24:36"

Type reference: Order