/validate_order

/subscription_system/validate_order

Target audience: Developers

Introduction

Validates if a customer is allowed to make a purchase with the external subscription system. Validation can be made with customer number or customer information (E.g. first name, last name, address).

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/subscription_system/validate_order
Production https://backend.worldoftulo.com/external/api/v1/subscription_system/validate_order

Requirements

Identity Scope
No /external/subscription_system/r

Parameters

Field Required Type Description
customer_number No String The customer number to set on the account.
Size range: ..50
Allowed values: "/^[a-zA-Z-_0-9]+$/"
first_name No String The customers first name.
Size range: ..100
last_name No String The customers last name.
Size range: ..100
contact_email No String The customers email.
Size range: ..100
street No String The customers street name.
Size range: ..100
street_number No String The customers street number.
Size range: ..100
staircase No String The customers staircase.
Size range: ..100
apartment_number No String The customers apartment number.
Size range: ..100
zip_code No String The customers zip code.
Size range: ..100
city No String The customers city.
Size range: ..100

Curl Example

1
2
3
4
5
6
7
8
curl --request GET \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/subscription_system/validate_order \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
              "customer_number": "1234567890"
          }'

Response

Field Description
customer_number The customer number.
purchase_allowed If purchase is allowed (true/false).

Example Response

1
2
3
4
5
6
7
8
9
HTTP 200
{
    "item": [
        {
            "customer_number": "1234567890",
            "purchase_allowed": true
        }
    ]
}

Errors

Example error response

1
2
3
4
5
6
HTTP 400 Bad Request
{
    "code": "invalid_parameter",
    "field": "customer_number",
    "message": "Parameter must match format (/^[a-zA-Z\-_0-9]+$/)"
}

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

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side