Skip to main content

Modifying a token

If you need to update details on an existing customer token you can use the modify endpoint. This allows you to change the buyer's email address or mobile phone number associated with the token.

Modifying a customer token​

PUT /purchase/customer-tokens/916f7730-8d24-4dd9-9778-92b75b747382 HTTP/1.1
Host: api.uat.walleydev.com // (Different hostname in production)
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
Content-Type: application/json

{
"email": "updated@example.com",
"mobilePhone": "+46701234567"
}

Request Properties​

Request headers

HeaderRequiredExplanation
AuthorizationYesInstructions on how to generate the authorization header value can be found here.
Walley-Idempotency-KeyNoInstructions on how to use idempotency can be found here.

Request body

PropertyTypeRequiredExplanation
emailstringNoThe new email address for the token's buyer. Must be a valid email address format (see validation rules below).
mobilePhonestringNoThe new mobile phone number for the token's buyer. Must be in international format (see validation rules below).
note

All request body properties are optional. Include only the fields you wish to update.

There is no requirement that the provided values differ from the current ones β€” the request will be accepted regardless.

Email validation rules​

When provided (non-null), the email address must pass the following validation:

RuleDetailInvalid example
Max lengthCannot exceed 320 characters totalβ€”
Non-emptyCannot be null, empty, or only whitespaceβ€”
Single @Must contain exactly one @ separating the local and domain partsuser@@example.com
No leading dot in local partLocal part cannot start with a dot.user@example.com
No trailing dot in local partLocal part cannot end with a dot (immediately before @)user.@example.com
No consecutive dots in local partLocal part cannot contain consecutive dotsuser..name@example.com
No leading/trailing hyphen in domainDomain labels cannot start or end with a hyphenuser@-example.com, user@example-.com
Domain must contain a dotDomain part must have at least one dotuser@example
TLD min lengthTop-level domain must be at least 2 charactersuser@example.c

Full regular expression used for validation:

^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]|(?:(?<=.)\.(?![\\.@])))+@(?:(?!-)[a-z\d-\u00DF-\u00F6\u00F8-\u1FFF\u2700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(?<!-)\.)+(?:[a-z\u00DF-\u00F6\u00F8-\u1FFF\u2700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|(?:xn--[a-z\d-]+))(?<!-)$

Phone number validation rules​

When provided (non-null), the mobile phone number must pass the following validation. Spaces are stripped before validation.

RuleDetailInvalid example
Non-emptyCannot be empty or only whitespaceβ€”
International formatMust start with +046701234567
No leading zero after +First digit after + cannot be 0+0123456789
Minimum 7 digitsMust contain at least 7 digits (excluding + and spaces)+123456
Maximum 19 digitsCannot exceed 19 digits (excluding + and spaces)β€”
Allowed charactersOnly +, digits (0–9), and spaces are allowed β€” no hyphens, parentheses, or other characters+46-70-123 4567, +46(0)701234567

Full regular expression used for validation:

^(\+[1-9])(\d[ ]*){6,18}$

Important error responses​

Error codeCause
400Invalid email address or mobile phone number format
401Incorrect, missing or expired bearer token
403The customer token has been cancelled
404The customer token was not found for the authenticated bearer token
422Cannot modify buyer information: the token has no buyer