Pre-validate purchase
/me/order/pre_validate_purchase
Target audience: Developers
Release version: 4.3.5
Pre-validate purchase¶
Introduction¶
This endpoint is used to pre-validate a order for an authenticated user. The following criterion will be checked:
- Whether the customer already has the package they are attempting to purchase.
- Whether the customer already has the campaign they are attempting to purchase.
- Whether the customer already has the base package of the campaign they are attempting to purchase.
- Whether campaign purchase rules exist for the campaign they are attempting to purchase.
If you are only interested in validating configured campaign purchase rules rather than the entire list above, we recommend using the Eligible for campaign endpoint instead.
URI¶
Environment | URI |
---|---|
Stage | https://payway-api.stage.adeprimo.se/external/api/v1/me/order/pre_validate_purchase |
Production | https://backend.worldoftulo.com/external/api/v1/me/order/pre_validate_purchase |
Requirements¶
Identity | Scope |
---|---|
Yes | /external/me/order/w |
Parameters¶
Field | Required | Type | Description |
---|---|---|---|
product_code | Required | String | The product code for a package/campaign that should be pre validated. Size range: 1..1024 |
subscription_extension | Optional | Boolean | Decides whether the pre-purchase validation should follow the rules of a normal purchase or a subscription extension purchase. Defaults to false. |
Curl Example¶
curl --request GET \
--url 'https://payway-api.stage.adeprimo.se/external/api/v1/me/order/pre_validate_purchase?product_code=some_product_code' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <insert identity token here>'
Response¶
Field | Description |
---|---|
can_purchase | Boolean stating whether a purchase of the package/campaign would be possible. |
reason | Code describing why can_purchase is true or false. Possible values: campaign_purchase_rules_does_not_permit_purchase campaign_already_purchased package_already_active base_package_already_active purchase_allowed |
{
"item": {
"can_purchase": true,
"reason": "purchase_allowed"
}
}
Errors¶
This API uses the common error conventions of the Payway API