# Get Purchase Template Detail
source: https://developer.mastercard.com/iccp/documentation/05_api_reference/soap_api/configuration-details/getcompanypurchasetemplatedetail/index.md

> Get all details about a specific purchase template. The template details help you decide which template to use to create a purchase request. The details include custom data fields, spending controls and whether the purchase template is enabled to add invoice addenda data.

## Parameters {#parameters}

|    Name    |                                                                                                                               Description                                                                                                                               | Required |  Type   |
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|
| templateId | ID of a template. You can also obtain it through the [getcompanypurchasetemplates](https://developer.mastercard.com/iccp/documentation/05_api_reference/soap_api/configuration-details/getcompanypurchasetemplates/index.md#getcompanypurchasetemplates-response) call. | Yes      | Numeric |

### Sample Request {#sample-request}

```xml
<soapenv:Envelope
	xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:ser="http://mastercard.com/sd/pc/service">
	<soapenv:Header/>
	<soapenv:Body>
		<ser:getCompanyPurchaseTemplateDetailRequest>
			<ser:templateId>21680</ser:templateId>
		</ser:getCompanyPurchaseTemplateDetailRequest>
	</soapenv:Body>
</soapenv:Envelope>
```

## Response {#response}

For each API request, you will receive the following responses.

## template {#template}

Provides basic details about the template request.

|        Name         |                                                                                   Description                                                                                   |     Type     | Required for ICCP | Required for ICMP |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|-------------------|-------------------|
| templateId          | ID of the template.                                                                                                                                                             | Numeric      | Yes               | Yes               |
| templateName        | Name of the template.                                                                                                                                                           | Alphanumeric | Yes               | Yes               |
| templateDescription | Description of the template.                                                                                                                                                    | Alphanumeric | Yes               | Yes               |
| templateType        | Type of the template, which is Purchase Control.                                                                                                                                | Alphanumeric | Yes               | Yes               |
| icmpEnabled         | Identifies that the purchase request is for a mobile virtual card number (mVCN). If True, first name, last name, and phone number are required. If False, supplier is required. | Boolean      | No                | Yes               |

## purchaseTypes {#purchasetypes}

Provides details about the merchant types. There can be multiple purchaseTypes defined in the template.

|      Name      |                              Description                              |     Type     | Required for ICCP | Required for ICMP |
|----------------|-----------------------------------------------------------------------|--------------|-------------------|-------------------|
| Mcc            | Card Acceptor Business Codes used in the template.                    | Alphanumeric | Yes               | Yes               |
| MccDescription | Description of the Card Acceptor Business Codes used in the template. | Alphanumeric | Yes               | Yes               |

## templateRules {#templaterules}

Contains a set of rules defined for the template; defined by templateControls.

|   Name   |                            Description                             |     Type     | Required for ICCP | Required for ICMP |
|----------|--------------------------------------------------------------------|--------------|-------------------|-------------------|
| ruleName | Name of the rule.                                                  | Alphanumeric | No                | No                |
| ruleType | The ruleType must be set to A (Approve) for all purchase requests. | Boolean      | No                | No                |

## templateControls {#templatecontrols}

Describes the controls making up the rules. There can be multiple templateControls in a templateRules node.

|        Name        |                                                                                                                                                                                              Description                                                                                                                                                                                              |     Type     | Required for ICCP | Required for ICMP |
|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|-------------------|-------------------|
| templateControl    | Spending control available in the template to use.                                                                                                                                                                                                                                                                                                                                                    | Unlimited    | Yes               | Yes               |
| controlCode        | 2-character code of the template control name. Decides the type of control to use to create a purchase request. * AR (Amount range control) * CU (Curfew control) * GE (Geography control) * MA (Merchant amount control) * MI (Merchant ID control) * TD (Time of day control) * TL (Transaction limit control) * VA (Validity period control) * VG (Aging velocity control) * VL (Velocity control) | Alphanumeric | Yes               | Yes               |
| controlDescription | Description of the template control.                                                                                                                                                                                                                                                                                                                                                                  | Alphanumeric | Yes               | Yes               |

## templateCustomFieldDetails {#templatecustomfielddetails}

Describes any custom fields in the template in templateCustomFieldAndValues node.

## templateCustomFieldAndValues {#templatecustomfieldandvalues}

Defines a custom field.

|          Name           |                                           Description                                           |     Type     | Required for ICCP | Required for ICMP |
|-------------------------|-------------------------------------------------------------------------------------------------|--------------|-------------------|-------------------|
| customFieldName         | Name of the custom field.                                                                       | Alphanumeric | Yes               | Yes               |
| customFieldValue        | Value of the custom field. Always populates when customFieldName is set to purchaseType.        | Alphanumeric | No                | No                |
| customFieldMaxLength    | Maximum length of the custom field.                                                             | Numeric      | No                | No                |
| customFieldDisplayType  | Display type of the custom field that is either text or list.                                   | Alphanumeric | No                | No                |
| customFieldDataType     | Data type of the custom field.                                                                  | Alphanumeric | Yes               | Yes               |
| customFieldDataRequired | Whether the custom field is required or not.                                                    | Alphanumeric | Yes               | Yes               |
| addendaType description | Returns the value *Global Invoice* if Invoice Addenda Data is enabled on the Purchase Template. | Alphanumeric | No                | No                |

### Sample response {#sample-response}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <ns2:getCompanyPurchaseTemplateDetailResponse2
      xmlns="http://mastercard.com/sd/pc/service"
      xmlns:ns2="http://mastercard.com/sd/pc2/service">
      <ns2:PCTemplateDetails>
        <ns2:template>
          <ns2:templateId>21680</ns2:templateId>
          <ns2:templateName>Sandbox Purchase Template</ns2:templateName>
          <ns2:templateDescription>Used in Sandbox Environment, with Velocity and Validity Period controls, with addenda data allowed</ns2:templateDescription>
          <ns2:templateType>PC</ns2:templateType>
          <ns2:icmpEnabled>False</ns2:icmpEnabled>
        </ns2:template>
        <ns2:purchaseTypes>
          <Mcc>3000</Mcc>
          <MccDescription>UNITED AIRLINES</MccDescription>
        </ns2:purchaseTypes>
        <ns2:purchaseTypes>
          <Mcc>3001</Mcc>
          <MccDescription>AMERICAN AIRLINES</MccDescription>
        </ns2:purchaseTypes>
        <ns2:purchaseTypes>
          <Mcc>3002</Mcc>
          <MccDescription>PAN AM</MccDescription>
        </ns2:purchaseTypes>
        <ns2:purchaseTypes>
          <Mcc>3300</Mcc>
          <MccDescription>AZUL BRAZILIAN AIRLINES - AZUL AIR</MccDescription>
        </ns2:purchaseTypes>
        <ns2:purchaseTypes>
          <Mcc>3301</Mcc>
          <MccDescription>WIZZ AIR</MccDescription>
        </ns2:purchaseTypes>
        <ns2:purchaseTypes>
          <Mcc>4511</Mcc>
          <MccDescription>AIR CARRIERS, AIRLINES-NOT ELSEWHERE CLASSIFIED</MccDescription>
        </ns2:purchaseTypes>
        <ns2:templateRules>
          <ns2:templateControl>
            <ns2:controlCode>VA</ns2:controlCode>
            <ns2:controlDescription>Validity</ns2:controlDescription>
          </ns2:templateControl>
          <ns2:templateControl>
            <ns2:controlCode>VL</ns2:controlCode>
            <ns2:controlDescription>Velocity</ns2:controlDescription>
          </ns2:templateControl>
        </ns2:templateRules>
        <ns2:templateCustomFieldDetails>
          <templateCustomFieldAndValues>
            <customFieldName>Purchase Type</customFieldName>
            <customFieldValue>Airlines</customFieldValue>
            <customFieldMaxLength>69</customFieldMaxLength>
            <customFieldDisplayType>Text</customFieldDisplayType>
            <customFieldDataType>Alphanumeric</customFieldDataType>
            <customFieldDataRequired>Y</customFieldDataRequired>
          </templateCustomFieldAndValues>
          <templateCustomFieldAndValues>
            <customFieldName>Invoice Number</customFieldName>
            <customFieldMaxLength>64</customFieldMaxLength>
            <customFieldDisplayType>Text</customFieldDisplayType>
            <customFieldDataType>Alphanumeric</customFieldDataType>
            <customFieldDataRequired>N</customFieldDataRequired>
          </templateCustomFieldAndValues>
        </ns2:templateCustomFieldDetails>
        <ns2:supportedAddendaTypes>
          <ns2:addendaType description="Global Invoice" code="INVOICE"/>
        </ns2:supportedAddendaTypes>
      </ns2:PCTemplateDetails>
      <ns2:errorMessage
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      </ns2:getCompanyPurchaseTemplateDetailResponse2>
    </soapenv:Body>
  </soapenv:Envelope>
```

