Order validation
/order_validation
Validate order¶
Target audience: Developers
Release version: 4.4.0
Introduction¶
This endpoint returns a true/false value whether the user can purchase a package, and if not, a reason and code explaining why.
URI¶
| Environment | URI |
|---|---|
| Stage | https://payway-api.stage.adeprimo.se/external/api/v2/order_validation |
| Production | https://backend.worldoftulo.com/external/api/v2/order_validation |
Requirements¶
| Identity | Scope |
|---|---|
| No | /external/order_validation/r |
Parameters¶
| Name | Required | Description |
|---|---|---|
| product_code | Yes | The code of the package that the user should be checked against |
| account_id | No* | The id of the account that should be checked |
| date_of_birth | No* | The date of birth of the user (DateTime format) |
| ssn | No* | The social security number of the user |
Validation Parameter Requirement
Exactly one of account_id, date_of_birth, or ssn must be provided. You cannot omit all three, nor can you provide more than one.
Curl Examples¶
Check eligibility using account_id¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v2/order_validation?account_id=abc123&product_code=adeprimo_test_package \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Check eligibility using date_of_birth¶
curl --request GET \
--url 'https://payway-api.stage.adeprimo.se/external/api/v2/order_validation?date_of_birth=1990-01-15T00:00:00Z&product_code=adeprimo_test_package' \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Check eligibility using ssn¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v2/order_validation?ssn=199001151234&product_code=adeprimo_test_package \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Response¶
Example response if user can purchase package¶
HTTP 200
{
"item": {
"purchase_allowed": true,
"reason": null,
"message": null,
"fallback_package_code": null
}
}
Example response if user cannot purchase package¶
HTTP 200
{
"item": {
"purchase_allowed": false,
"reason": "too_young",
"message": "User is too young to purchase this package",
"fallback_package_code": null
}
}
Errors¶
This API uses the common error conventions of the Payway API