# Update a Card
source: https://developer.mastercard.com/donations/documentation/use-cases/manage-cards/update-a-card/index.md

## Overview {#overview}

The **Update Card** endpoint enables donors to modify only the billing address and card expiry date of the payment cards stored on file.
Note: You can only modify the card billing address and card expiry date. You cannot modify other card details through this endpoint.

To update card details, provide both the unique `donor_id` and the `card_id` as the endpoint path parameters. A successful request returns the `HTTP 200 OK` status and a JSON response body that includes the unique `card_id` and last four digits of card.

## Sequence Diagram {#sequence-diagram}

The following outlines the sequence of events:
Diagram update-card

## Execution Steps {#execution-steps}

1. The donor requests to view existing card details from the partner user interface
2. The partner user interface displays the card details to the donor.
3. The donor provides either the card expiry date, card billing address, or both to update to update.
4. The partner user interface forwards the request to the partner server to process it further.
5. The partner server invokes the `PUT /donors/{donor_id}/cards{card_id}` endpoint and provides the card data in the endpoint request to Mastercard Donate service.
6. The Mastercard Donate service verifies the donor ID.
7. The Mastercard Donate service sends the error message to the partner server if does not find the donor ID.
8. The partner server forwards the error message to the partner user interface.
9. The partner user interface displays the error message to the donor.
10. The Mastercard Donate service verifies the card ID if it finds the donor ID.
11. The Mastercard Donate service checks for the card PAN in the request if it finds the card ID.
12. The Mastercard Donate service sends the error message 'Primary account number cannot be updated' to the partner server if it finds the card PAN in the request.
13. The partner server forwards the error message 'Primary account number  
    cannot be updated' to the partner user interface.
14. The partner user interface displays the error message 'Primary account number  
    cannot be updated' to the donor.
15. The Mastercard Donate service updates and stores the modified card details if it does not find the card PAN in the request.
16. The Mastercard Donate service sends the updated card details to the partner server.
17. The partner server stores the updated card details.
18. The partner server forwards the updated card details to the partner user interface after storing the updated card details.
19. The partner user interface displays the updated card details to the donor.
20. The Mastercard Donate service sends the error message 'No card with card ID found' to the partner server if it does not find the card ID provided in the request.
21. The partner server forwards the error message to the partner user interface.
22. The partner user interface displays the error message to the donor.

## Endpoint {#endpoint}


API Reference: `PUT /donors/{donor_id}/cards/{card_id}`

## Endpoint Parameter {#endpoint-parameter}

For more details on the endpoint parameters, refer to the [Parameters to Update a Card](https://developer.mastercard.com/donations/documentation/parameters/manage-cards-param/update-a-card-param/index.md) section.

## Sample Request and Response {#sample-request-and-response}

For more details on the sample request and response, refer to the [Update a Card](https://developer.mastercard.com/donations/tutorial/donation-api-details/cardsapinew/index.md#put-donors) tutorial.
