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

This section describes how to create a customer payment instrument. Customer tokens can contain instrument identifiers, payment instruments, and shipping address tokens.  
For information about managing these token types, see these topics:

* [Manage Customer Tokens](/docs/cybs/en-us/tms/developer/all/rest/tms/tms-cust-tkn/tms-manage-cust-tkn.md "")
* [Manage Instrument Identifier Tokens](/docs/cybs/en-us/tms/developer/all/rest/tms/tms-ii-tkn/tms-manage-ii-tkn.md "")
* [Manage Shipping Address Tokens](/docs/cybs/en-us/tms/developer/all/rest/tms/tms-cust-tkn/tms-ship-tkn/tms-manage-ship-addr-tkn.md "")
  {#tms-tokenize-cust-pi-intro_ul_m4z_cql_fjc}

Endpoint {#tms-tokenize-cust-pi-intro_section_bys_smk_dwb}
----------------------------------------------------------

**Test:** `POST ``https://apitest.cybersource.com``/tms/v2/tokenize`{#tms-tokenize-cust-pi-intro_restcust-test}  
**Production:** `POST ``https://api.cybersource.com``/tms/v2/tokenize`{#tms-tokenize-cust-pi-intro_prod-endpoint}  
**Production in India:** `POST ``https://api.in.cybersource.com``/tms/v2/tokenize`{#tms-tokenize-cust-pi-intro_restcust-prod-india}  
**Production in Saudi Arabia:** `POST ``https://api.sa.cybersource.com``/tms/v2/tokenize`{#tms-tokenize-cust-pi-intro_restcust-prod-ksa}  
**Test in Saudi Arabia:** `POST ``https://apitest.sa.cybersource.com``/tms/v2/tokenize`{#tms-tokenize-cust-pi-intro_restcust-test-ksa}

Required Fields for Creating an Instrument Identifier and Provisioning a Network Token {#tms-tokenize-cust-pi-reqfields}
========================================================================================================================

processingInformation.actionList
:
Set to `TOKEN_CREATE`.

processingInformation.actionTokenTypes.customer
:
Required when you are creating a customer token.

processingInformation.actionTokenTypes.instrumentIdentifier
:
Required when you are creating an instrument identifier token.

processingInformation.actionTokenTypes.paymentInstrument
:
Required when you are creating a payment instrument.

tokenInformation.customer.buyerInformation.email
:

tokenInformation.customer.buyerInformation.merchantCustomerID
:

tokenInformation.customer.clientReferenceInformation.code
:

tokenInformation.customer.merchantDefinedInformation\[\].name
:

tokenInformation.customer.merchantDefinedInformation\[\].value
:

tokenInformation.instrumentIdentifier.card.expirationMonth
:

tokenInformation.instrumentIdentifier.card.expirationYear
:

tokenInformation.instrumentIdentifier.card.number
:

tokenInformation.instrumentIdentifier.type
:

tokenInformation.paymentInstrument.billTo.address1
:

tokenInformation.paymentInstrument.billTo.administrativeArea
:

tokenInformation.paymentInstrument.billTo.company
:

tokenInformation.paymentInstrument.billTo.country
:

tokenInformation.paymentInstrument.billTo.email
:

tokenInformation.paymentInstrument.billTo.firstName
:

tokenInformation.paymentInstrument.billTo.lastName
:

tokenInformation.paymentInstrument.billTo.locality
:

tokenInformation.paymentInstrument.billTo.phoneNumber
:

tokenInformation.paymentInstrument.billTo.postalCode
:

tokenInformation.paymentInstrument.card.expirationMonth
:

tokenInformation.paymentInstrument.card.expirationYear
:

tokenInformation.paymentInstrument.card.type
:

tokenInformation.paymentInstrument.default
:
{#tms-tokenize-cust-pi-reqfields_dl_ur5_4sl_fjc}

Related Information {#tms-tokenize-cust-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-tokenize-cust-pi-reqfields_ul_kpc_xzz_sxb}

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

Request

```
{
  "processingInformation": {
    "actionList": [
      "TOKEN_CREATE"
    ],
    "actionTokenTypes": [
      "customer",
      "paymentInstrument",
      "instrumentIdentifier"
    ]
  },
  "tokenInformation": {
    "customer": {
      "buyerInformation": {
        "merchantCustomerID": "Your customer identifier",
        "email": "test@cybs.com"
      },
      "clientReferenceInformation": {
        "code": "TC50171_3"
      },
      "merchantDefinedInformation": [
        {
          "name": "data1",
          "value": "Your customer data"
        }
      ]
    },
    "paymentInstrument": {
      "default": "true",
      "card": {
        "expirationMonth": "12",
        "expirationYear": "2031",
        "type": "001"
      },
      "billTo": {
        "firstName": "John",
        "lastName": "Doe",
        "company": "Cybersource",
        "address1": "1 Market St",
        "locality": "San Francisco",
        "administrativeArea": "CA",
        "postalCode": "94105",
        "country": "US",
        "email": "test@cybs.com",
        "phoneNumber": "4158880000"
      }
    },
    "instrumentIdentifier": {
      "type": "enrollable card",
      "card": {
        "number": "X622943123116478",
        "expirationMonth": "12",
        "expirationYear": "2026"
      }
    }
  }
}
```

{#tms-tokenize-cust-pi-ex-rest_codeblock_c51_vmt_gwb}  
Response to a Successful Request

```
{
    "paymentInformation": {
        "card": {
            "type": "001"
        }
    },
    "tokenInformation": {
        "instrumentIdentifierNew": false,
        "customer": {
            "id": "4DC6BB4C7353F90CE063AF598E0AEBE8"
        },
        "instrumentIdentifier": {
            "id": "7034450000295211111",
            "state": "ACTIVE"
        },
        "paymentInstrument": {
            "id": "4DC6C33114B31665E063AF598E0A87FF"
        },
        "shippingAddress": {
            "id": "4DC6BF33FF03FB70E063AF598E0A1472"
        }
    }
}
```

{#tms-tokenize-cust-pi-ex-rest_codeblock_kfl_nbl_fjc}
