Change a Customer's Default Payment Instrument {#tms-cust-pi-tkn-change-default-pi-intro}
=========================================================================================

This section describes how to change a customer's default payment instrument.

Endpoint
--------

**Test:** `PATCH ``https://apitest.cybersource.com``/tms/v2/customers/`*{customerTokenId}* `/payment-instruments/`*{paymentInstrumentTokenId}*{#tms-cust-pi-tkn-change-default-pi-intro_restcust-test}  
**Production:** `PATCH ``https://api.cybersource.com``/tms/v2/customers/`*{customerTokenId}* `/payment-instruments/`*{paymentInstrumentTokenId}*  
**Production in India:** `PATCH ``https://api.in.cybersource.com``/tms/v2/customers/`*{customerTokenId}* `/payment-instruments/`*{paymentInstrumentTokenId}*{#tms-cust-pi-tkn-change-default-pi-intro_restcust-prod-india}  
**Production in Saudi Arabia:** `PATCH ``https://api.sa.cybersource.com``/tms/v2/customers/`*{customerTokenId}* `/payment-instruments/`*{paymentInstrumentTokenId}*{#tms-cust-pi-tkn-change-default-pi-intro_restcust-prod-ksa}  
**Test in Saudi Arabia:** `PATCH ``https://apitest.sa.cybersource.com``/tms/v2/customers/`*{customerTokenId}* `/payment-instruments/`*{paymentInstrumentTokenId}*{#tms-cust-pi-tkn-change-default-pi-intro_restcust-test-ksa}  
The *`{customerTokenId}`* is the customer token ID returned in the id field when you created the customer token. The *`{paymentInstrumentTokenId}`* is the payment instrument token ID you want to retrieve. For more information, see [Create a Customer](/docs/cybs/en-us/tms/developer/all/rest/tms/tms-cust-tkn/tms-manage-cust-tkn/tms-cust-tkn-create-intro.md "") and [Create a Customer Payment Instrument](/docs/cybs/en-us/tms/developer/all/rest/tms/tms-cust-tkn/tms-cust-pi-tkn/tms-manage-cust-pi-tkn/tms-cust-pi-tkn-create-intro.md "").

Required Fields for Changing a Customer's Default Payment Instrument {#tms-cust-pi-tkn-change-default-pi-reqfields}
===================================================================================================================

default
:
Set value to `true`.
{#tms-cust-pi-tkn-change-default-pi-reqfields_dl_bcz_qry_dwb}

Related Information {#tms-cust-pi-tkn-change-default-pi-reqfields_section_jpc_xzz_sxb}
--------------------------------------------------------------------------------------

* [API Field Reference for the REST API](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/rest/api-fields/api-fields-about-guide.md "")
  {#tms-cust-pi-tkn-change-default-pi-reqfields_ul_kpc_xzz_sxb}

REST Example: Changing a Customer's Default Payment Instrument {#tms-cust-pi-tkn-change-default-pi-ex-rest}
===========================================================================================================

Request

```
{
    "default": true
}
```

{#tms-cust-pi-tkn-change-default-pi-ex-rest_codeblock_v4l_mlt_lwb}  
Response to a Successful Request

```
{
    "_links": {
        "self": {
            "href": "/tms/v2/customers/F4D5E715F75E9910E053A2598D0A7278/payment-instruments/F4D5E715F7BD9910E053A2598D0A7278"
        },
        "customer": {
            "href": "/tms/v2/customers/F4D5E715F75E9910E053A2598D0A7278"
        }
    },
    "id": "F4D5E715F7BD9910E053A2598D0A7278",
    "default": true,
    "state": "ACTIVE",
    "card": {
        "expirationMonth": "12",
        "expirationYear": "2031",
        "type": "001"
    },
    "billTo": {
        "firstName": "John",
        "lastName": "Doe",
        "company": "Visa",
        "address1": "1 Market St",
        "locality": "san francisco",
        "administrativeArea": "CA",
        "postalCode": "94105",
        "country": "US",
        "email": "test@cybs.com",
        "phoneNumber": "4158880000"
    },
    "instrumentIdentifier": {
        "id": "7010000000016241111"
    },
    "metadata": {
        "creator": "testrest"
    },
    "_embedded": {
        "instrumentIdentifier": {
            "_links": {
                "self": {
                    "href": "/tms/v1/instrumentidentifiers/7010000000016241111"
                },
                "paymentInstruments": {
                    "href": "/tms/v1/instrumentidentifiers/7010000000016241111/paymentinstruments"
                }
            },
            "id": "7010000000016241111",
            "object": "instrumentIdentifier",
            "state": "ACTIVE",
            "card": {
                "number": "411111XXXXXX1111"
            },
            "processingInformation": {
                "authorizationOptions": {
                    "initiator": {
                        "merchantInitiatedTransaction": {
                            "previousTransactionId": "123456789619999"
                        }
                    }
                }
            },
            "metadata": {
                "creator": "testrest"
            }
        }
    }
}
```

{#tms-cust-pi-tkn-change-default-pi-ex-rest_codeblock_x4l_mlt_lwb}
