Regex

You can define a regular expression that the text must match. If you set a regex validation for a custom field, the customer will be required to enter a text that matches the regex pattern.

Available for:

  • text field

Learn more about regex at MDN Web Docs.

Examples

  • Numbers only: ^[0-9]+$
  • Letters only: ^[a-zA-Z]+$
  • Numbers and letters only: ^[a-zA-Z0-9]+$
  • Email: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
  • Phone number: ^\+?[0-9]+$
  • Date: ^\d{4}-\d{2}-\d{2}$
  • Nickname (10 characters): ^[a-zA-Z0-9]{1,10}$

Validation URL

You can set a URL that will be used to validate the text entered by the customer. When the customer enters the text, Fungies will send a POST request to the validation URL with the object containing the value provided by the customer.

The validation URL should return 200 status code if the value is valid. Any other status code will be treated as an error.

Validation URL secret

Additionally, you can set a secret key that will be used to sign the validation request.

Fungies generates signatures using a hash-based message authentication code HMAC with SHA-256. Signature is included in the request as a x-fngs-signature header and is prefixed by sha256_.

x-fngs-signature: sha256_6808ed5be1262b60818359fa586145810d0793e8a677f1326520d3844e21b640

In order to verify follow the same instructions as for the webhook endpoint.

Example validation request body

{
  "customFieldKey": "valueProvidedByCustomer"
}