Create
/me/order
Target audience: Developers
Release version: 4.1.0
Create invoice order¶
Introduction¶
This endpoint is used to place an order as an authenticated user.
Attention
As for now this endpoint only supports creating orders with the payment method invoice
and autogiro
.
URI¶
Environment | URI |
---|---|
Stage | https://payway-api.stage.adeprimo.se/external/api/v1/me/order |
Production | https://backend.worldoftulo.com/external/api/v1/me/order |
Requirements¶
Identity | Scope |
---|---|
Yes | /external/me/order/w |
Parameters¶
Field | Required | Type | Description |
---|---|---|---|
product_code | Required | String | The product code for a package/campaign. |
period_id | Required | String | The unique id of the period that should be used for this order. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
start_date | Optional | DateTime | The start date of the subscription in UTC, will default to DateTime.now |
browser_ip | Required | String | The IP Address used by the end customer to create the order |
language | Required | String | The browser language used by the user customer to create the order |
user_agent | Required | String | The browser user agent used by the user customer to create the order |
receipt_url | Required | String | The receipt url that the user will end up on after creating the order |
address | Optional | Object | Address object, this will be used as a default address when purchasing new packages. |
traffic_source | String | Optional | The traffic source for the order Size range: ..128 |
merchant_reference | String | Optional | The merchant reference for the order |
invoice_delivery_method | String | Optional | 'mail' or 'email'. Delivery method of the invoice, only applicable when payment method is invoice. Requires support in the subscription system integration |
Curl Example¶
curl --request POST \
--url https://payway-api.stage.adeprimo.se/external/api/v1/me/order \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
--header 'content-type: application/json' \
--data '{
"product_code": "adeprimo_digital",
"period_id": "5cb804811d41c82b5c518ea8",
"start_date": "2019-05-01T00:00:00+00:00",
"browser_ip": "127.0.0.1",
"language": "sv-SE",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"receipt_url": "https://domain.tld/receipt/585a4768edce2c5e6f000001"
}'
With address¶
curl --request POST \
--url https://payway-api.stage.adeprimo.se/external/api/v1/me/order \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
--header 'content-type: application/json' \
--data '{
"product_code": "adeprimo_digital",
"period_id": "5cb804811d41c82b5c518ea8",
"start_date": "2019-05-01T00:00:00+00:00",
"browser_ip": "127.0.0.1",
"language": "sv-SE",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"receipt_url": "https://domain.tld/receipt/585a4768edce2c5e6f000001",
"address": {
"first_name": "Erik",
"last_name": "Eriksson",
"street": "Ekvägen",
"street_number": "1",
"staircase": "A",
"floor": "15",
"apartment_number": "1501",
"zip_code": "120 35",
"city": "Tyresö",
"country_code": "SE"
}
}'
Response¶
Field | Description |
---|---|
id | id of the order |
order_id | reference of the order |
HTTP 200 OK
{
"id": "585a4768edce2c5e6f000001",
"order_id": "ADEPRIMO-1234"
}
Errors¶
Example error response¶
HTTP 400 Bad Request
{
"code": "invalid_parameter",
"field": "period_id",
"message": "Parameter must match format (/^[a-f\d]{24}$/)"
}
HTTP 400 Bad Request¶
Name | Type | Description |
---|---|---|
invalid_parameter | Object | Validation error on any of the fields in the posted json |
json_parser_error | Object | The request body could not be parsed as valid json |
invalid_content_type_error | Object | The requests Content-Type header isn't set to application/json |
unknown_parameter | Object | One or more of the fields in the posted json was not recognized |