# Replace a Card source: https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/card-lifecycle-management/replace-card/index.md ## Test case -- Success -- Replace a Card with a Virtual Card {#test-case--success--replace-a-card-with-a-virtual-card} This test case describes replacing an existing card with a virtual card. For this test case, use the following information in the request: | Field | Available value | |---------------|-----------------| | `reissueType` | REPLACE_D | **Sample request** `POST /cards/70001/plastics` ```JSON { "newCardContractNumber": "5355550352135312", "newCardExpiryDate": "3004", "newCbsNumber": "CBS15863242747061", "reissueType": "REPLACE_D" } ``` **Sample response** `201` `Location: /cards/70001` ```JSON { "newCardContractId": 70026131, "newCardContractNumber": "535555______5312", "newCardExpiryDate": "3004", "newSequenceNumber": "2", "plasticId": 2188792 } ``` ## Test case -- Success -- Replace a Card with a Virtual Card that inherits the PIN from the old Card {#test-case--success--replace-a-card-with-a-virtual-card-that-inherits-the-pin-from-the-old-card} This test case describes replacing an existing card with a physical card. For this test case, use the following information in the request: | Field | Available value | |---------------|------------------------------| | `reissueType` | REPLACE_WITH_PIN_INHERITANCE | **Sample request** `POST /cards/70001/plastics` ```JSON { "newCardExpiryDate": "3004", "newCbsNumber": "CBS15863242747061", "reissueType": "REPLACE_WITH_PIN_INHERITANCE" } ``` **Sample response** `201` `Location: /cards/70001` ```JSON { "newCardContractId": 70026131, "newCardContractNumber": "535555______5312", "newCardExpiryDate": "3004", "newSequenceNumber": "2", "plasticId": 2188792 } ``` ## Test case -- Success -- Replace a Card with a Physical Card {#test-case--success--replace-a-card-with-a-physical-card} This test case describes replacing an existing card with a physical card. For this test case, use the following information in the request: | Field | Available value | |---------------|-----------------| | `reissueType` | REPLACE | **Sample request** `POST /cards/70001/plastics` ```JSON { "newCardContractNumber": "5355550352135312", "newCardExpiryDate": "3004", "newCbsNumber": "CBS15863242747061", "reissueType": "REPLACE" } ``` **Sample response** `201` `Location: /cards/70001` ```JSON { "newCardContractId": 70026131, "newCardContractNumber": "535555______5312", "newCardExpiryDate": "3004", "newSequenceNumber": "2", "plasticId": 2188792 } ``` ## Test case -- Fail -- Reissue type not supported {#test-case--fail--reissue-type-not-supported} This test case describes an attempt to replace a card while the provided `reissueType` value is not configured in the CMS for a specified card contract. For this test case, use the following information in the request: | Path parameter | Available value | |--------------------|-----------------| | `card_contract_id` | 30003 | | Field | Available value | |---------------|------------------------------| | `reissueType` | REPLACE | | | REPLACE_D | | | REPLACE_WITH_PIN_INHERITANCE | **Sample request** `POST /cards/30003/plastics` ```JSON { "newCardContractNumber": "5355550352135312", "newCardExpiryDate": "3004", "newCbsNumber": "CBS15863242747061", "reissueType": "REPLACE" } ``` **Sample response** `400` ```JSON { "Errors": { "Error": [ { "Source": "MASTERCARD PROCESSING", "ReasonCode": "REISSUE_TYPE_NOT_SUPPORTED", "Description": "Reissue type REPLACE is not supported for card contract with id 30003.", "Recoverable": false } ] } } ``` ## Test case -- Fail -- Wrong Card status {#test-case--fail--wrong-card-status} This test case describes an attempt to replace a card contract that is still active. For this test case, use the following information in the request: | Path parameter | Available value | |------------------|-----------------| | card_contract_id | 30002 | | Field | Available value | |-------------|-----------------| | reissueType | REPLACE | | | REPLACE_D | **Sample request** `POST /cards/30002/plastics` ```JSON { "newCardExpiryDate": "3004", "newCbsNumber": "CBS15863242747061", "reissueType": "REPLACE_D" } ``` **Sample response** `400` ```JSON { "Errors": { "Error": [ { "Source": "MASTERCARD PROCESSING", "ReasonCode": "CARD_CONTRACT_STATUS_IS_WRONG", "Description": "Card contract with id 30002 in wrong status to reissue.", "Recoverable": false } ] } } ```