# How to Update a Payment Method

On this page, you will find a walk-through guide on updating a payment method and the necessary information to accomplish this task.

## Prerequisites

Before making any call to the LINKs API, you first need a merchant account. Contact our team at Discover@LinksMerchantServices.com to get started.

## Updating a Payment Method

To update a payment method in LINKs, you need to call the [Update a Payment Method endpoint](/api/payment-method/post-api-paymentmethod-update). The following are the parameters needed to update the payment method:

<table>
  <thead>
    <tr>
      <th><strong>Field</strong></th>
      <th><strong>Description</strong></th>
      <th><strong>Required</strong></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>merchantIdentifier</code></td>
      <td>The unique identifier of the merchant account.</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td><code>paymentMethodIdentifier</code></td>
      <td>The unique identifier of the payment method to update.</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td><code>card</code></td>
      <td>Details about the credit card used for the payment method.</td>
      <td>Yes (if updating card details)</td>
    </tr>
    <tr>
      <td><code>billingInformation</code></td>
      <td>Billing address and contact details associated with the payment method.</td>
      <td>No</td>
    </tr>
  </tbody>
</table>

Within the `card` object, the following fields can be updated:

<table>
  <thead>
    <tr>
      <th><strong>Field</strong></th>
      <th><strong>Description</strong></th>
      <th><strong>Required</strong></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>cardNumber</code></td>
      <td>The new credit card number.</td>
      <td>No</td>
    </tr>
    <tr>
      <td><code>expiryMonth</code></td>
      <td>The new expiry month of the credit card (1-12).</td>
      <td>No</td>
    </tr>
    <tr>
      <td><code>expiryYear</code></td>
      <td>The new expiry year of the credit card (e.g., 2026).</td>
      <td>No</td>
    </tr>
    <tr>
      <td><code>cardHolderName</code></td>
      <td>The new name of the cardholder as it appears on the credit card.</td>
      <td>No</td>
    </tr>
    <tr>
      <td><code>cvv</code></td>
      <td>The new card verification value (CVV) for the credit card.</td>
      <td>No</td>
    </tr>
    <tr>
      <td><code>creditCardBrand</code></td>
      <td>
        The brand of the credit card, such as Visa or MasterCard.<br/>
        Accepted values: <code>MasterCard</code>, <code>Visa</code>, <code>Amex</code>, <code>Discover</code>, <code>JCB</code>.
      </td>
      <td>No</td>
    </tr>
  </tbody>
</table>

You can use the code snippet below to make the endpoint call with the required parameters:

```sh
curl --request POST \
--url https://testapi.linksmerchantservices.com/api/paymentmethod/update \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <your_base64_encoded_credentials>' \
--data '{
  "merchantIdentifier": "<your_merchant_id>",
  "paymentMethodIdentifier": "<payment_method_id>",
  "card": {
    "expiryMonth": 1,
    "expiryYear": 2026
  },
  "billingInformation": {
    "city": "New City",
    "zipCode": "54321"
  }
}'
```

<Callout type="info" title="Authentication">
  Depending on the request, LINKs API offers two forms of authentication:
  `Basic` and `client token`. Refer to the [Authentication](/authentication)
  guide to learn more about it.
</Callout>

In this example, we're updating the expiry date of the credit card and changing the billing city and zip code. This will result in a JSON response exemplified below:

```json
{
  "result": {
    "resultType": "Success",
    "merchantMessage": "Payment method updated successfully.",
    "logIdentifier": "uvw12345",
    "logAsError": false
  },
  "merchantIdentifier": "<your_merchant_id>",
  "paymentMethodIdentifier": "<payment_method_id>",
  "card": {
    "cardNumber": "************1111",
    "expiryMonth": 1,
    "expiryYear": 2026,
    "cardHolderName": "John Doe",
    "creditCardBrand": "Visa"
  },
  "billingInformation": {
    "firstLine": "123 Main St",
    "secondLine": "Apt 4B",
    "city": "New City",
    "region": "Anystate",
    "zipCode": "54321",
    "countryAlpha3Code": "USA"
  }
}
```