# 

## Prerequisites

* A valid API key — see [Obtain API credentials](/docs/how-tos/setup/obtain-credentials)
* An existing `payment_token` value


## What you can update

| Field | Card tokens | Bank account tokens |
|  --- | --- | --- |
| `nickname` | Yes | Yes |
| `is_default` | Yes | Yes |
| `card.expiry_month` | Yes | N/A |
| `card.expiry_year` | Yes | N/A |


Immutable fields
You cannot change the card number (PAN), bank account number, or routing number. To change these, [delete the token](/docs/how-tos/tokenization-vaulting/delete-payment-method) and create a new one.

## Step 1: Send the update request

Send `POST /v1/payment_tokens/{token}` with the fields to update.

### Update card expiry and nickname

curl
```shell
curl -X POST \
  https://api.dev.paradisegateway.net/v1/payment_tokens/PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB \
  -H "Content-Type: application/json" \
  -H "APIKEY: YOUR-API-KEY" \
  -d '{
    "nickname": "Updated Business Visa",
    "is_default": true,
    "card": {
      "expiry_month": "06",
      "expiry_year": "2029"
    }
  }'
```

Python
```python
import requests

token = "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB"
resp = requests.post(
    f"https://api.dev.paradisegateway.net/v1/payment_tokens/{token}",
    headers={"Content-Type": "application/json", "APIKEY": "YOUR-API-KEY"},
    json={
        "nickname": "Updated Business Visa",
        "is_default": True,
        "card": {"expiry_month": "06", "expiry_year": "2029"},
    },
)
print(resp.json())
```

JavaScript
```javascript
const token = "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB";
const resp = await fetch(
  `https://api.dev.paradisegateway.net/v1/payment_tokens/${token}`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "APIKEY": "YOUR-API-KEY",
    },
    body: JSON.stringify({
      nickname: "Updated Business Visa",
      is_default: true,
      card: { expiry_month: "06", expiry_year: "2029" },
    }),
  }
);
console.log(await resp.json());
```

C#
```csharp
var token = "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB";
var payload = new
{
    nickname = "Updated Business Visa",
    is_default = true,
    card = new { expiry_month = "06", expiry_year = "2029" }
};
var resp = await client.PostAsJsonAsync(
    $"https://api.dev.paradisegateway.net/v1/payment_tokens/{token}", payload);
Console.WriteLine(await resp.Content.ReadAsStringAsync());
```

Java
```java
String token = "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB";
String body = """
    {
      "nickname": "Updated Business Visa",
      "is_default": true,
      "card": { "expiry_month": "06", "expiry_year": "2029" }
    }
    """;
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create(
        "https://api.dev.paradisegateway.net/v1/payment_tokens/" + token))
    .header("Content-Type", "application/json")
    .header("APIKEY", "YOUR-API-KEY")
    .POST(HttpRequest.BodyPublishers.ofString(body)).build();
HttpResponse<String> resp = client.send(request,
    HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());
```

Go
```go
token := "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB"
payload := strings.NewReader(`{
  "nickname": "Updated Business Visa",
  "is_default": true,
  "card": { "expiry_month": "06", "expiry_year": "2029" }
}`)
req, _ := http.NewRequest("POST",
    "https://api.dev.paradisegateway.net/v1/payment_tokens/"+token, payload)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("APIKEY", "YOUR-API-KEY")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
```

PHP
```php
$token = "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB";
$ch = curl_init("https://api.dev.paradisegateway.net/v1/payment_tokens/$token");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ["Content-Type: application/json", "APIKEY: YOUR-API-KEY"],
    CURLOPT_POSTFIELDS => json_encode([
        "nickname" => "Updated Business Visa",
        "is_default" => true,
        "card" => ["expiry_month" => "06", "expiry_year" => "2029"],
    ]),
]);
echo curl_exec($ch); curl_close($ch);
```

Ruby
```ruby
require "net/http"; require "json"
token = "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB"
uri = URI("https://api.dev.paradisegateway.net/v1/payment_tokens/#{token}")
req = Net::HTTP::Post.new(uri, {
  "Content-Type" => "application/json", "APIKEY" => "YOUR-API-KEY",
})
req.body = {
  nickname: "Updated Business Visa", is_default: true,
  card: { expiry_month: "06", expiry_year: "2029" },
}.to_json
resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts resp.body
```

## Step 2: Verify the response

A `200` response returns the updated token details.

```json
{
  "payment_token": "PAYMENT_TOKEN-01KFDKXMQ637EKEAY410MSQSXB",
  "object": "payment_token",
  "type": "card",
  "status": "active",
  "customer_id": "CUSTOMER-01KFDKXMQ637EKEAY410MSQSXB",
  "is_default": true,
  "nickname": "Updated Business Visa",
  "card": {
    "brand": "visa",
    "last_four": "1111",
    "bin": "411111",
    "funding": "credit"
  },
  "correlation_id": "c3d4e5f6-a7b8-9012-cdef-123456789abc"
}
```

### Updating expiry to reactivate an expired token

If a card token has `status: expired` because the expiry date passed, updating `card.expiry_month` and `card.expiry_year` to a future date moves the token back to `active`.

## Common update scenarios

| Scenario | Fields to update |
|  --- | --- |
| Card renewed with new expiry | `card.expiry_month`, `card.expiry_year` |
| Rename for clarity | `nickname` |
| Set as default for checkout | `is_default: true` |
| Demote from default | `is_default: false` |


## Next steps

* [Delete a stored payment method](/docs/how-tos/tokenization-vaulting/delete-payment-method)
* [About stored payment methods](/docs/concepts/tokenization/stored-payment-methods)