/invoice_order

/account/invoice_order

Target audience: Developers

1
Release version: 4.1.6

Introduction

This endpoint is used to place an order.

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/account/invoice_order
Production https://backend.worldoftulo.com/external/api/v1/account/invoice_order

Requirements

Identity Scope
No /external/account/w

Parameters

Field Required Type Description
account_id Optional String The id of the account to place the order on.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
email Optional String The email of the account to place the order on.
Size range: ..1024
Allowed values:
"/\A[\w+-.]+@[a-z\d-]+(.[a-z]+)*.[a-z]+\z/i"
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.

Curl Example with account_id

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/account/invoice_order \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
              "account_id": "5c6291d537c2ed78a11518b7",
              "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 and email

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/account/invoice_order \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
              "email": "test@test.com",
              "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
1
2
3
4
HTTP 201 Created
{
    "id": "585a4768edce2c5e6f000001"
}

Errors

Example error response

1
2
3
4
5
6
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