POST
/
api
/
ext
/
v1
/
collection
/
{collectionId}
/
orders
/
validate-order
Validate an order
curl --request POST \
  --url https://staging-api.covver.io/api/ext/v1/collection/{collectionId}/orders/validate-order \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "companyId": "<string>",
  "orderItems": [
    {
      "variantId": "<string>",
      "quantity": 123
    }
  ],
  "taxNumber": "<string>",
  "customAttributes": [
    {
      "key": "<string>",
      "value": "<string>"
    }
  ],
  "orderNumber": "<string>",
  "address": {
    "address1": "<string>",
    "city": "<string>",
    "countryCode": "<string>",
    "phone": "<string>",
    "province": "<string>",
    "provinceCode": "<string>",
    "customAttributes": [
      {
        "key": "<string>",
        "value": "<string>"
      }
    ],
    "address2": "",
    "zip": "",
    "country": "<string>"
  },
  "shouldValidateProvinceCode": true
}'
{
  "success": true
}
This endpoint validates
  • The province is correct for the provided country
  • The variants can be shipped to the provided country
  • The phone number is valid
  • The zip code is valid
  • The taxNumber field
    • It is supposed to be there for the provided country
    • It is formatted correctly and passes regex validation
This endpoint does not currently check the validity of the address itself. Phone number validation is done with libphonenumber-js. Here is a demo page of the phone validation for further testing.
Partners must pass in the companyId field in the body

Tax number

For Brazil, Mexico, China, Italy, and South Korea you must pass in an additional taxNumber field. For Brazil the tax number field must pass regex validation as follows
new RegExp(`^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$`).test(taxNumber)
For Mexico the pattern is 13 characters (4 letters followed by 6 digits and 3 alphanumeric characters).
new RegExp(`^[A-Za-z]{4}\\d{6}[A-Za-z0-9]{3}$`).test(taxNumber)
For China, Italy, and South Korea there is no validation run on the taxNumber field.

CustomAttributes

Custom attribute field is deprecated. Please use the taxNumber field instead

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

collectionId
string<uuid>
required

Body

application/json

Response

200
application/json

Default Response

The response is of type object.