The Validation API enables you to provide your own validation of a cart and checkout. ## Extension targets The Validation API exposes the following [targets](/docs/apps/build/app-extensions/configure-app-extensions#targets): | Target | Output type | Description | | ------ | ----------- | ----------- | | `purchase.validation.fetch` | [FunctionFetchResult](/docs/api/functions/reference/cart-checkout-validation/graphql/functionfetchresult) | See [Network access for Shopify Function](/docs/apps/build/functions/input-output/network-access) | | `purchase.validation.run` | [FunctionRunResult](#functionrunresult) | Outputs the list of validation errors | ## Input The `RunInput` object is the complete schema that your function can receive as [input](/docs/apps/build/functions/input-output#input). For a list of fields that the Validation API's `Input` object accepts, refer to [Input](/docs/api/functions/reference/cart-checkout-validation/graphql/input). ### Example The following example shows an input query:

The following example shows the resulting input to the query:

## FunctionRunResult The [`FunctionRunResult`](/docs/api/functions/reference/cart-checkout-validation/graphql/functionrunresult) object is the expected [output](/docs/apps/build/functions/input-output#output) for the `purchase.validation.run` target. ### Example The following function result shows errors that block a customer from proceeding through checkout.

### Supported checkout field targets The following checkout UI fields can be targeted with an error message. The `target` property follows the input query's data structure.
List of checkout field targets
Field Target value
cart $.cart
email $.cart.buyerIdentity.email
phone $.cart.buyerIdentity.phone
address1 $.cart.deliveryGroups[0].deliveryAddress.address1
address2 $.cart.deliveryGroups[0].deliveryAddress.address2
city $.cart.deliveryGroups[0].deliveryAddress.city
company $.cart.deliveryGroups[0].deliveryAddress.company
countryCode $.cart.deliveryGroups[0].deliveryAddress.countryCode
firstName $.cart.deliveryGroups[0].deliveryAddress.firstName
lastName $.cart.deliveryGroups[0].deliveryAddress.lastName
phone $.cart.deliveryGroups[0].deliveryAddress.phone
provinceCode $.cart.deliveryGroups[0].deliveryAddress.provinceCode
zip $.cart.deliveryGroups[0].deliveryAddress.zip