Create a Customer Payment Instrument {#tms-cust-pi-tkn-create-intro}
====================================================================

This section describes how to create a customer payment instrument token.

Endpoint
--------

**Test:** `POST ``https://apitest.cybersource.com``/tms/v2/customers/`*{customerTokenId}*`/payment-instruments `{#tms-cust-pi-tkn-create-intro_restcust-test}  
**Production:** `POST ``https://api.cybersource.com``/tms/v2/customers/`*{customerTokenId}*`/payment-instruments`  
**Production in India:** `POST ``https://api.in.cybersource.com``/tms/v2/customers/`*{customerTokenId}*`/payment-instruments`{#tms-cust-pi-tkn-create-intro_restcust-prod-india}  
**Production in Saudi Arabia:** `POST ``https://api.sa.cybersource.com``/tms/v2/customers/`*{customerTokenId}*`/payment-instruments `{#tms-cust-pi-tkn-create-intro_restcust-prod-ksa}  
**Test in Saudi Arabia:** `POST ``https://apitest.sa.cybersource.com``/tms/v2/customers/`*{customerTokenId}*`/payment-instruments `{#tms-cust-pi-tkn-create-intro_restcust-test-ksa}  
The *`{customerTokenId}`* is the customer token ID returned in the id field when you created the customer token. 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 "").

Required Fields for Creating a Customer Payment Instrument {#tms-cust-pi-tkn-create-reqfields}
==============================================================================================

card.type
:
Required if the instrument identifier ID being linked to is card-based.

Optional Fields for Creating a Customer Payment Instrument {#tms-cust-pi-tkn-create-optfields}
==============================================================================================

bankAccount.type
:

billTo.address1
:

billTo.address2
:

billTo.aminstrativeArea
:

billTo.company
:

billTo.country
:

billTo.email
:

billTo.firstName
:

billTo.lastName
:

billTo.locality
:

billTo.phoneNumber
:

billTo.postalCode
:

buyerInformation.companyTaxID
:

buyerInformation.currency
:

buyerInformation.dateOfBirth
:

buyerInformation.personalIdentification.id
:

buyerInformation.personalIdentification.issuedBy.administrativeArea
:

buyerInformation.personalIdentification.type
:

card.expirationMonth
:

card.expirationYear
:

card.issueNumber
:

card.startMonth
:

card.startYear
:

card.useAs
:

card.tokenizedInformation.requestorID
:

card.tokenizedInformation.transactionType
:

default
:
If you do not include this field, the first payment instrument for a customer becomes the default. A subsequent payment instrument becomes the non-default option.

instrumentIdentifier.id
:

processingInformation.billPaymentProgramEnabled
:

merchantInformation.merchantDescriptor.alternateName
:
{#tms-cust-pi-tkn-create-optfields_dl_bcz_qry_dwb}

Related Information {#tms-cust-pi-tkn-create-optfields_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-create-optfields_ul_kpc_xzz_sxb}

REST Example: Creating a Customer Payment Instrument {#tms-cust-pi-tkn-create-ex-rest}
======================================================================================

Request

```
{
  "card": {
    "expirationMonth": "12",
    "expirationYear": "2031",
    "type": "001"
  },
  "billTo": {
    "firstName": "John",
    "lastName": "Doe",
    "company": "Company Name",
    "address1": "1 Market St",
    "locality": "San Francisco",
    "administrativeArea": "CA",
    "postalCode": "94105",
    "country": "US",
    "email": "test@cybs.com",
    "phoneNumber": "4158880000"
  },
  "instrumentIdentifier": {
    "id": "7010000000016241111"
  }
}         
```

Response to a Successful Request

```
{
  "_links": {
    "self": {
      "href": "/tms/v2/customers/F2F3ADA770102B51E053A2598D0A9078/payment-instruments/F39732BE4BDA9A1EE053AF598E0A4081"
    },
    "customer": {
      "href": "/tms/v2/customers/F2F3ADA770102B51E053A2598D0A9078"
    }
  },
  "id": "F39732BE4BDA9A1EE053AF598E0A4081",
  "default": true,
  "state": "ACTIVE",
  "card": {
    "expirationMonth": "12",
    "expirationYear": "2031",
    "type": "001"
  },
  "billTo": {
    "firstName": "John",
    "lastName": "Doe",
    "company": "Company Name",
    "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": "123456789012345"
            }
          }
        }
      },
      "metadata": {
        "creator": "testrest"
      }
    }
  }
}
}
```

