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β
- Request
- Response
- Error
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"
}
HttpStatusCode: 200 OK
/*
Example error. More errors available below.
*/
HttpStatusCode: 404 Not Found
{
"id": "fe8a21bb-6cb5-4d7d-b7f6-c0c335fc4593",
"error": {
"code": 404,
"message": "The resource requested was not found.",
"errors": []
}
}
Request Propertiesβ
Request headers
| Header | Required | Explanation |
|---|---|---|
| Authorization | Yes | Instructions on how to generate the authorization header value can be found here. |
| Walley-Idempotency-Key | No | Instructions on how to use idempotency can be found here. |
Request body
| Property | Type | Required | Explanation |
|---|---|---|---|
| string | No | The new email address for the token's buyer. Must be a valid email address format (see validation rules below). | |
| mobilePhone | string | No | The 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:
| Rule | Detail | Invalid example |
|---|---|---|
| Max length | Cannot exceed 320 characters total | β |
| Non-empty | Cannot be null, empty, or only whitespace | β |
| Single @ | Must contain exactly one @ separating the local and domain parts | user@@example.com |
| No leading dot in local part | Local part cannot start with a dot | .user@example.com |
| No trailing dot in local part | Local part cannot end with a dot (immediately before @) | user.@example.com |
| No consecutive dots in local part | Local part cannot contain consecutive dots | user..name@example.com |
| No leading/trailing hyphen in domain | Domain labels cannot start or end with a hyphen | user@-example.com, user@example-.com |
| Domain must contain a dot | Domain part must have at least one dot | user@example |
| TLD min length | Top-level domain must be at least 2 characters | user@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.
| Rule | Detail | Invalid example |
|---|---|---|
| Non-empty | Cannot be empty or only whitespace | β |
| International format | Must start with + | 046701234567 |
| No leading zero after + | First digit after + cannot be 0 | +0123456789 |
| Minimum 7 digits | Must contain at least 7 digits (excluding + and spaces) | +123456 |
| Maximum 19 digits | Cannot exceed 19 digits (excluding + and spaces) | β |
| Allowed characters | Only +, 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 code | Cause |
|---|---|
| 400 | Invalid email address or mobile phone number format |
| 401 | Incorrect, missing or expired bearer token |
| 403 | The customer token has been cancelled |
| 404 | The customer token was not found for the authenticated bearer token |
| 422 | Cannot modify buyer information: the token has no buyer |