***

title: Update saved payment details
icon: hexagon
published: true
---------------------

For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.payroc.com/full-stack-guides/take-payments/llms.txt. For full documentation content, see https://docs.payroc.com/full-stack-guides/take-payments/llms-full.txt.

Integrate with our API to update a customer’s saved payment details. Our API has two endpoints to update payment details represented by a secure token:

* [Update saved payment details](/guides/take-payments/update-saved-payment-details#update-saved-payment-details)  – Use our Update Secure Token endpoint if you are sending the raw payment details, for example, if you are updating a card’s expiry date or a billing address.
* [Update saved payment details with a single-use token](/guides/take-payments/update-saved-payment-details#update-saved-payment-details-with-a-single-use-token)  – Use our Update Account Details endpoint if you have a single-use token that represents updated payment details, for example, if you have a single-use token from Hosted Fields.

<Note>
  **Note:** To update saved payment details, you need the ID of the secure token that represents the payment details. If you don’t know the ID, go to List Secure Tokens.
</Note>

## Before you begin

### Bearer tokens

Use our Identity Service to generate a Bearer token to include in the header of your requests. To generate your Bearer token, complete the following steps:

1. Include your API key in the x-api-key parameter in the header of a POST request.
2. Send your request to [https://identity.payroc.com/authorize](https://identity.payroc.com/authorize).

<Note>
  **Note:** You need to generate a new Bearer token before the previous Bearer token expires.
</Note>

#### Example request

```bash
curl --location --request POST  'https://identity.payroc.com/authorize' --header 'x-api-key: <api key>'
```

#### Example response

If your request is successful, we return a response that contains your Bearer token, information about its scope, and when it expires.

```json
{
  "access_token": "eyJhbGc....adQssw5c",
  "expires_in": 3600,
  "scope": "service_a service_b",
  "token_type": "Bearer"
}
```

### Headers

To create the header of each POST request, you must include the following parameters:

* **Content-Type:** Include application/json as the value for this parameter.
* **Authorization:** Include your Bearer token in this parameter.
* **Idempotency-Key:** Include a UUID v4 to make the request idempotent.

```bash
curl
-H "Content-Type: application/json"
-H "Authorization: <Bearer token>"
-H "Idempotency-Key: <UUID v4>"
```

### Errors

If your request is unsuccessful, we return an error. For more information about errors, see [Errors](/api/errors).

## Update saved payment details

Use the Update Secure Token method if you have the raw information that a customer wants to update. You can update the following payment details:

* Sensitive payment details, including:
  * **Card** - Cardholder name and expiry date
  * **ACH** - Accountholder name and account type
  * **PAD** - Accountholder name and institution number
* MIT agreement
* Customer’s contact details
* Customer’s address details

## Integration steps

* Update a secure token

## Update a secure token

To update the payment details represented by a secure token, send a PATCH request to our Update Secure Token endpoint.

| Endpoint   | Prefix     | URL                                                                                                                                                                                                                    |
| :--------- | :--------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Test       | `api.uat.` | [https://api.uat.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}](https://api.uat.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}) |
| Production | `api.`     | [https://api.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}](https://api.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId})         |

<Note>
  **Note:** The request format follows the RFC 6902 standard.
</Note>

### Request parameters

To create the body of your request, use the following parameters:

<EndpointSchemaSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" selector="request.body" />

### Example request

<EndpointRequestSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" />

### Response fields

If your request is successful, we update the secure token and return the details represented by the secure token.

<EndpointSchemaSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" selector="response.body" />

### Example response

<EndpointResponseSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" example="secureToken" />

## Update saved payment details with a single-use token

If you use our Hosted Fields solution, our gateway creates a single-use token to represent the customer’s updates to their card, ACH, or PAD details. Send the single-use token to our gateway so that we can update the details represented by the secure token.

You can also send a secondary request to our gateway to update other details that the single-use token doesn’t change:

* MIT agreement
* Customer’s contact details
* Customer’s address details

## Integration steps

**Step 1.** Update saved payment details with a single-use token\
**Step 2.** (Optional) Update a secure token

## Step 1. Update saved payment details with a single-use token

To update saved payment details with a single-use token, send a POST request to our Update Account Details endpoint.

| Endpoint   | Prefix     | URL                                                                                                                                                                                                                                                  |
| :--------- | :--------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Test       | `api.uat.` | [https://api.uat.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}/update-account](https://api.uat.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}/update-account) |
| Production | `api.`     | [https://api.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}/update-account](https://api.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}/update-account)         |

### Request parameters

To create the body of your request, use the following parameters:

<EndpointSchemaSnippet endpoint="POST /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}/update-account" selector="request.body" />

### Example request

<EndpointRequestSnippet endpoint="POST /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}/update-account" />

### Response fields

If your request is successful, we update the secure token and return the details represented by the secure token.

<EndpointSchemaSnippet endpoint="POST /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}/update-account" selector="response.body" />

### Example response

<EndpointResponseSnippet endpoint="POST /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}/update-account" example="accountUpdateResponse" />

## Step 2. (Optional) Update a secure token

To update the payment details represented by a secure token, send a PATCH request to our Update Secure Token endpoint.

| Endpoint   | Prefix     | URL                                                                                                                                                                                                                    |
| :--------- | :--------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Test       | `api.uat.` | [https://api.uat.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}](https://api.uat.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}) |
| Production | `api.`     | [https://api.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId}](https://api.payroc.com/v1/processing-terminals/\{processingTerminalId}/secure-tokens/\{secureTokenId})         |

<Note>
  **Note:** The request format follows the RFC 6902 standard.
</Note>

### Request parameters

To create the body of your request, use the following parameters:

<EndpointSchemaSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" selector="request.body" />

### Example request

<EndpointRequestSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" />

### Response fields

If your request is successful, we update the secure token and return the details represented by the secure token.

<EndpointSchemaSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" selector="response.body" />

### Example response

<EndpointResponseSnippet endpoint="PATCH /processing-terminals/{processingTerminalId}/secure-tokens/{secureTokenId}" example="secureToken" />