items

Add an order item

Creates an order item on an existing order. Requires basic HTTP-Authentication. The order item is made on the order's business unit.

Request

Parameters

The request is made from the order that the order item is being added to. 

Name

Required

Value

Description

Data type

productid

No (Yes*)

productid=12

Product

ID

subscriptionidNo (Yes*)subscriptionid=695The subscription to extend

ID

eventidNo (Yes*)eventid=3The event being bookedID
internalmessageNointernalmessage=Integernal%20messageInternal message on order itemString
externalmessageNoexternalmessage=External%20messageExternal message on order itemString

* One of the above fields must be specified

 

Please note that different product types require different parameters. 

Items and stock items

Name

Required

Value

Description

Data type

Default

productidYesproductid=12ProductID 

quantity

Yes

quantity=1

Number of ordered units

Integer

 

startdate

No

startdate=2012-02-29

Start date

Date

 

starttime

No

starttime=13:45

Start time

Time

In 30 minutes

resourceidNoresourceid=40The ID of the resource the order item is booked onID 

Example:

POST:APIURL/orders/{orderid}/items.xml
apikey=338934897438
productid=12
quantity=1

Valuecards (discount cards and gift cards)

The value card product has a setting "Refill previously purchased cards". If the user already has a value-card based on the same product it will be refilled, instead of creating a new one.

Name

Required

Value

Description

Data type

Default
unitsYesunits=1Number of unitsInteger 

amount

No

amount=10000

The purchased value card including VAT in cents/ören.

Integer

 
startdateNostartdate=2012-03-20Valuecard is valid from this dateDateCurrent day
enddateNoenddate=2012-03-21Valuecard is valid to this dateDatestartdate + valuecard valid time set in product

Subscriptions

Name

Required

Value

Description

Data type

Default

startdate

No

startdate=2012-02-29

The start date of the subscription (membership)

Date

Calculated start date taking into consideration today's date and any previous subscriptions for the specified user.

useridNouserid=37The user of the subscriptionIDInloggad användare

subscriptionPrice

No

subscriptionPrice=10000

The subscription's price in cents/ören if other than the preset price of the product. This price change is valid for 10 years if it is neither extended for removed.

Integer

 

Example:

POST:APIURL/orders/{orderid}/items.xml
apikey=338934897438
productid=432
startdate=2012-02-29
Calculate the price for the first debit period of a subscription.

The adjusted price for the first debit period of a subscription using setting "Extra month after the 15th". This is the most common price calculation method but please note that there are other methods not documented here. Other type of price calculations can be found here Objektet abonnemang (produkt) (only available in Swedish)

The price calculation formula:
(The subscription's monthly price / number of days in month) * (number of valid days remaining in month)

The above price should be rounded up to the nearest whole currency unit.

If the purchase date is after the 15th a full extra month should be added to the above amount.

Example 1:

A subscription for 100 SEK per month is purchased the 8th of February.
Round((100 / 28) * 21) = 75 kr
28 days in February, between the 8th and the 28th there are 21 valid days the subscription can be used.

Example 2:

A subscription for 300 SEK per month is purchased the 18th of March
Round((300 / 31) * 14) + 300 = 435
31 days in March, between the 18th and the 31st there are 14 valid days the subscription can be used plus the full price of an extra month as the purchase is after the 15th of the month. 

Events

Name

Required

Valid

Description

Data type

Default

eventid

Yes

eventid=38

The specific event being booked

ID

 

typeNotype=ordinaryThe type of booking

Ordinary

ordinary

participantidNoparticipantid=312The ID of the person being booked as a participantIDorderedbyid
participantfirstnameNoparticipantfirstname=JohnThe first name of the participant if they do not exist in the customer databaseString 
participantlastnameNoparticipantlastname=DoeThe last name of the participant if they do not exist in the customer databaseString 

Example:

POST:APIURL/orders/{orderid}/items.xml
apikey=338934897438
eventid=38
participantid=312
participantfirstname=John
participantlastname=Doe

Entry

Name

Required

Value

Description

Data type

Default

quantity

No

quantity=3

Number of entrances for specified product

Integer

1

Service

Name

Required

Value

Description

Date type

startdate

Yes

startdate=2012-03-21

Start date

Date

starttime

Yes

starttime=14:45

Start time

Time

particpantfirstnameNoJohnOpen text field that can be used to specify first name of a participant other than the customer making the booking.String
particpantlastnameNoDoeOpen text field that can be used to specify last name of a participant other than the customer making the booking.String
Resource management when making service bookings

This must be specified when a service is to be booked on a specific resource, for example when booking a massage on a specific masseuse. These parameters require a post prefix of 'resource'+{counter}. They are not required but both must be used if one of them are used.

Name

Required

Value

Description

Data type

requirementid

Yes

resource0.requirementid=23

The resource ID for required resources.

ID

id

Yes

resource0.id=234

The resource that fits the requirements.

ID

Example with a specific resource requirment:

POST:APIURL/orders/{orderid}/items.xml
apikey=338934897438
productid=122
startdate=2012-03-21
starttime=14:45
resource0.requirementid=23
resource0.id=234

Package

This creates an empty package with no price. In order to fill the package with products each item must be individually called with the parameter packageid set to item-id for the created package.

Name

Required

Value

Description

Value

Default

productidYesproductid=12ProductID 

quantity

Yes

quantity=1

Number of ordered units

Integer

 

startdate

No

startdate=2012-02-29

Start date

Date

In 30 minutes

starttime

No

starttime=13:45

Start time

Time

In 30 minutes

Groupactivitybookings

Name

Required

Valid

Description

Data type

Default

activityid

Yes

activityid=38

The specific activity being booked

ID

 

Note: Groupactivitybookings are not allowed on anonymous orders

Example:

POST:APIURL/orders/{orderid}/items.xml
apikey=338934897438
activiytid=38
orderedbyid=312

Adding a release suspension product

A customer can be suspended in BRP when the customer has too many noshows. To release the suspension the customer have to pay for a "Release suspension product". When the "Release suspension product" is payed for the customer is no longer suspended (i.e. the customers noshows are removed). For more information about noshows see NoShow

Which product that should be used for removal of noshows and what the maximum nr of noshows before beeing suspended are configured on a businessunit level (See businessunits)

Example:

  1. GET a customers NoShows
  2. GET maxnrofnoshows and releasesuspensionproduct for the businessunits
  3. If the customers nr of noshows more or equal to maxnrofnoshows the releasesuspensionproduct can be used. If not, BRP will respond with BAD_REQUEST when a releasesuspensionproduct is added. 

    Example:

    POST:APIURL/orders/{orderid}/items.xml
    apikey=338934897438
    productid=12
    quantity=1
  4. Pay for the order via receipts and the noshows are removed. 

Response

For orders se orders

Add an order row without specifying a customer

Create an order row for an existing order. Please note that this requires an API level 3 key. The order is made on the business unit the order belongs to.

Request

Parmaeter

The same as for Add an order row as well as: 

 

Name

Required

Value

Description

Data type

anonymous

Yes

anonymous=true

Allows anonymous orders.

Boolean

otherparticipantNoJohn DoeMay be used when the order row is a service to specify a different participant String

Response

See order

Remove an order item

Remove an order item on an existing order, requires basic HTTP-Authentication. If the order rows contain subscriptions or value cards they are removed as well. For packages you should remove the package item, this will remove all parts of the package. It is not allowed to remove parts of the package.

Request

Example:

DELETE:APIURL/orders/{orderid}/items/{id}.xml?apikey=338934897438

Response

HTTP 204
No contents.

Remove an order item without specifying a customer

Removes an order item for an existing and anonymous order. Requires level three API key.

Request

Parameter

Name

Required

Value

Description

Data type

anonymous

Yes

anonymous=true

Allows the removal of an order item without specifying a specific customer.

Boolean

Response

HTTP 204
No content.

Limitations

We do not take any booking rules into consideration when order rows are removed.