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 |
subscriptionid | No (Yes*) | subscriptionid=695 | The subscription to extend | ID |
eventid | No (Yes*) | eventid=3 | The event being booked | ID |
internalmessage | No | internalmessage=Integernal%20message | Internal message on order item | String |
externalmessage | No | externalmessage=External%20message | External message on order item | String |
* 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 |
---|---|---|---|---|---|
productid | Yes | productid=12 | Product | ID | |
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 |
resourceid | No | resourceid=40 | The ID of the resource the order item is booked on | ID |
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 |
---|---|---|---|---|---|
units | Yes | units=1 | Number of units | Integer | |
amount | No | amount=10000 | The purchased value card including VAT in cents/ören. | Integer | |
startdate | No | startdate=2012-03-20 | Valuecard is valid from this date | Date | Current day |
enddate | No | enddate=2012-03-21 | Valuecard is valid to this date | Date | startdate + 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. |
userid | No | userid=37 | The user of the subscription | ID | Inloggad 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 |
|
type | No | type=ordinary | The type of booking | Ordinary | ordinary |
participantid | No | participantid=312 | The ID of the person being booked as a participant | ID | orderedbyid |
participantfirstname | No | participantfirstname=John | The first name of the participant if they do not exist in the customer database | String | |
participantlastname | No | participantlastname=Doe | The last name of the participant if they do not exist in the customer database | String |
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 |
particpantfirstname | No | John | Open text field that can be used to specify first name of a participant other than the customer making the booking. | String |
particpantlastname | No | Doe | Open 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 |
---|---|---|---|---|---|
productid | Yes | productid=12 | Product | ID | |
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:
- GET a customers NoShows
- GET maxnrofnoshows and releasesuspensionproduct for the businessunits
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
- 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 |
otherparticipant | No | John Doe | May 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.