Create invoice_order
/accounts/invoice_order
Target audience: Developers
Release version: 4.1.6
Create invoice order¶
Introduction¶
This endpoint is used to place an order.
Attention
As for now this endpoint only supports creating orders with the payment method invoice
, autogiro
and free
.
URI¶
Environment | URI |
---|---|
Stage | https://payway-api.stage.adeprimo.se/external/api/v1/accounts/invoice_order |
Production | https://backend.worldoftulo.com/external/api/v1/accounts/invoice_order |
Requirements¶
Identity | Scope |
---|---|
No | /external/accounts/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" |
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. Note that the supplied period id determines the payment method. 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 | Optional | String | The traffic source for the order Size range: ..128 |
merchant_reference | Optional | String | The merchant reference for the order |
invoice_delivery_method | Optional | String | 'mail' or 'email'. Delivery method of the invoice, only applicable when payment method is invoice. Requires support in the subscription system integration |
Curl Example with account_id¶
curl --request POST \
--url https://payway-api.stage.adeprimo.se/external/api/v1/accounts/invoice_order \
--header 'accept: application/json' \
--header 'authorization: Bearer <token-with-identity>' \
--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¶
curl --request POST \
--url https://payway-api.stage.adeprimo.se/external/api/v1/accounts/invoice_order \
--header 'accept: application/json' \
--header 'authorization: Bearer <token-with-identity>' \
--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 |
order_id | order_id of the order |
HTTP 201 Created
{
"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 |