# Update
source: https://developer.mastercard.com/iccp/documentation/05_api_reference/soap_api/purchaserequest/updatepurchaserequest/index.md

> Update the details of a purchase request, including the controls on the VCN. Include the unchanged data and controls sent in the initial submitPurchaseRequest call along with the details to update. This call does not generate a new VCN, but will update the controls on the existing VCN if appropriate.

## Request Headers {#request-headers}

|    Key name     |                   Value                    |                                                                                                            Description for ICCP                                                                                                            |
|-----------------|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Idempotency-Key | Any random UUID set in HTTP Request Header | 1. The header key Idempotency-Key is optional. 2. If the header key Idempotency-Key is added then it should be non-null and non-empty. 3. Max length of key is 80 chars. 4. It is recommended that the key is UUID and generated randomly. |

## Parameters {#parameters}

Same as the *submitPurchaseRequest* call [parameters](https://developer.mastercard.com/iccp/documentation/05_api_reference/soap_api/purchaserequest/submitpurchaserequest/index.md#parameters) plus the ID of the purchase request.
Note: `SupplierDetails` is not required for `UpdatePurchaseRequest` API calls for Mastercard® In Control for Mobile Payments (ICMP) enabled purchase requests made through the ICCP API. `SupplierDetails` is still required for ICCP-only purchase requests.

## Clearing Controls {#clearing-controls}

If the Clearing Controls was applied to the virtual card when it was generated and the Clearing Controls functionality was enabled, then the Payment Controls are still applied during the clearing process, even after the purchase request has been updated. If user updates the Payment Control values, then the updated values are applied during the clearing process, regardless of whether the Clearing Controls functionality is enabled or not at the time of update.  

Similarly, if Clearing Controls are not applied to the virtual card when it was generated, then the updated Payment Controls are also applied only during authorization regardless of Clearing Controls functionality is enabled or not at the time of update.

### Sample request without ICMP enabled {#sample-request-without-icmp-enabled}

```xml
<soapenv:Envelope
	xmlns:ser="http://mastercard.com/sd/pc2/service"
	xmlns:ser1="http://mastercard.com/sd/pc/service"
	xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
	<soapenv:Header/>
	<soapenv:Body>
		<ser:updatePurchaseRequestRequest>
			<ser:purchaseRequestId>1454</ser:purchaseRequestId>
			<ser:purchaseRequest>
				<ser:RCNData>
					<ser1:rcnId>2718</ser1:rcnId>
					<ser1:rcnAlias>Arun</ser1:rcnAlias>
				</ser:RCNData>
				<ser:companyId>233191</ser:companyId>
				<ser:description>Test2</ser:description>
				<ser:TemplateDetails2>
					<ser:templateId>1907</ser:templateId>
					<!--1 or more repetitions:-->
					<ser:fullTemplateRuleDetails>
						<ser:ruleName>1</ser:ruleName>
						<ser:ruleType>A</ser:ruleType>
						<!--1 or more repetitions:-->
						<ser:templateControl xsi:type="ser:VelocityControlType2"
							xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
							<ser:maxTrans>10</ser:maxTrans>
							<ser:cumulativeLimit>1000</ser:cumulativeLimit>
							<ser:period>M</ser:period>
						</ser:templateControl>
					</ser:fullTemplateRuleDetails>
					<ser:templateCustomField>
						<!--1 to 30 repetitions:-->
						<ser:templateCustomField>
							<ser1:customFieldName>Purchase Type</ser1:customFieldName>
							<ser1:customFieldValue>Contracted Services</ser1:customFieldValue>
						</ser:templateCustomField>
					</ser:templateCustomField>
				</ser:TemplateDetails2>
				<ser:supplierDetails>
					<ser:supplierId>850</ser:supplierId>                    
						<!--Required if default email not set up for supplier:-->                  
						<ser:supplierEmails>testing@email.com</ser:supplierEmails>
				</ser:supplierDetails>
           <ser:disablecardImage>N</ser:disablecardImage>
			</ser:purchaseRequest>
		</ser:updatePurchaseRequestRequest>
	</soapenv:Body>
</soapenv:Envelope>
```

### Sample request with ICMP enabled {#sample-request-with-icmp-enabled}

```xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ser="http://mastercard.com/sd/pc2/service" xmlns:ser1="http://mastercard.com/sd/pc/service">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:updatePurchaseRequestRequest>
         <ser:purchaseRequestId>90788</ser:purchaseRequestId>
         <ser:purchaseRequest>
            <ser:RCNData>
               <ser1:rcnId>9648</ser1:rcnId>
               <ser1:rcnAlias>AG Card1</ser1:rcnAlias>
            </ser:RCNData>
            <!--Optional:-->
            <ser:dataSourceId>1139</ser:dataSourceId>
            <ser:companyId>237582</ser:companyId>
            <!--Optional:-->
            <ser:validFor>24</ser:validFor>
            <ser:description>Testing.</ser:description>
            <ser:TemplateDetails2>
               <ser:templateId>108291</ser:templateId>
               <!--1 or more repetitions:-->
               <ser:fullTemplateRuleDetails>
                  <ser:ruleName>B</ser:ruleName>
                  <ser:ruleType>A</ser:ruleType>
                  <ser:templateControl xsi:type="ser:VelocityControlType2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                     <ser:maxTrans>500</ser:maxTrans>
                     <ser:cumulativeLimit>998</ser:cumulativeLimit>
                     <!--Optional:-->
                     <ser:period>M</ser:period>
                     <!--Optional:-->
                     <!--Optional:-->
                     <ser:availableBalance>12.65</ser:availableBalance>
                     <ser:currencyType>B</ser:currencyType>
                     <!--Optional:-->
                     <ser:currencyCode>044</ser:currencyCode>
                     <!--Optional:-->
                     <ser:endDate>2023-12-26+01:00</ser:endDate>
                  </ser:templateControl>
                  <!--1 or more repetitions:-->
               </ser:fullTemplateRuleDetails>
               <ser:templateCustomField>
                  <!--1 to 30 repetitions:-->
                  <ser:templateCustomField>
                     <ser1:customFieldName>Purchase Type</ser1:customFieldName>
                     <ser1:customFieldValue>Airlines</ser1:customFieldValue>
                  </ser:templateCustomField>
               </ser:templateCustomField>
            </ser:TemplateDetails2>
            <ser:userDetails>
               <ser:firstName>NewFirstName</ser:firstName>
               <ser:lastName>Testlastname</ser:lastName>
               <ser:email>mockemail@test.com</ser:email>
               <ser:mobileCountryCode>+1</ser:mobileCountryCode>
               <ser:mobileNumber>9809809800</ser:mobileNumber>
               </ser:userDetails>
               <ser:vcnDelivery>EMAIL</ser:vcnDelivery>
         </ser:purchaseRequest>
      </ser:updatePurchaseRequestRequest>
   </soapenv:Body>
</soapenv:Envelope>
```

Note:   

* End user email address can be updated only for ICMP purchase requests in DRAFT status. Email addresses cannot be updated for all other purchase request statuses.
* When updating a purchase request in draft status using API, the ICMP email address format is validated. A valid email address consists of a local part (for example, `username`), an `@` symbol, and a domain part (for example, `example.com`). A valid email would be, for example: `john.doe@example.com`.
* When updating an ICMP Purchase Request, the `userDetails` section must be included. If no changes are intended for the user details, each sub-field within the `userDetails` must exactly match the values provided in the original `SubmitPurchaseRequest`.
* `supplierEmail` information must be provided for ICCP Purchase Requests, if no default email is associated.

## Response {#response}

Same as [submitPurchaseRequestResponse](https://developer.mastercard.com/iccp/documentation/05_api_reference/soap_api/purchaserequest/submitpurchaserequest/index.md#response).

### Sample response without ICMP enabled {#sample-response-without-icmp-enabled}

```xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns2:getPurchaseRequestDetail xmlns="http://mastercard.com/sd/pc/service" xmlns:ns2="http://mastercard.com/sd/pc2/service">
         <ns2:purchaseRequestId>1243255</ns2:purchaseRequestId>
         <ns2:requestStatus>Approved</ns2:requestStatus>
         <ns2:PurchaseRequestTemplateDetails>
            <ns2:templateId>55024</ns2:templateId>
            <ns2:fullTemplateRuleDetails>
               <ns2:ruleName>B</ns2:ruleName>
               <ns2:ruleType>A</ns2:ruleType>
               <ns2:templateControl xsi:type="ns2:VelocityControlType2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns2:maxTrans>4567</ns2:maxTrans>
                  <ns2:cumulativeLimit>567.0</ns2:cumulativeLimit>
                  <ns2:period>D</ns2:period>
                  <ns2:currencyType>B</ns2:currencyType>
               </ns2:templateControl>
            </ns2:fullTemplateRuleDetails>
            <ns2:fullTemplateRuleDetails>
               <ns2:ruleName>B</ns2:ruleName>
               <ns2:ruleType>A</ns2:ruleType>
               <ns2:templateControl xsi:type="ns2:VelocityControlType2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns2:maxTrans>1900</ns2:maxTrans>
                  <ns2:cumulativeLimit>45.0</ns2:cumulativeLimit>
                  <ns2:period>D</ns2:period>
                  <ns2:availableBalance>45.0</ns2:availableBalance>
                  <ns2:currencyType>B</ns2:currencyType>
                  <ns2:endDate>2020-01-16</ns2:endDate>
               </ns2:templateControl>
            </ns2:fullTemplateRuleDetails>
            <ns2:templateCustomField>
               <ns2:templateCustomField>
                  <customFieldName>Purchase Type</customFieldName>
                  <customFieldValue>1</customFieldValue>
               </ns2:templateCustomField>
               <ns2:templateCustomField>
                  <customFieldName>Big5_123</customFieldName>
                  <customFieldValue/>
               </ns2:templateCustomField>
            </ns2:templateCustomField>
         </ns2:PurchaseRequestTemplateDetails>
         <ns2:vcnInformation>
            <ns2:Id>1124960</ns2:Id>
            <ns2:Pan>541275XXXXXX9999</ns2:Pan>
            <ns2:Expiry>2111</ns2:Expiry>
            <ns2:Avv>435</ns2:Avv>
            <ns2:Status>S</ns2:Status>
            <ns2:EVCNIndicator>false</ns2:EVCNIndicator>
         </ns2:vcnInformation>
         <ns2:cardImage>
            Card Image in HTML code
         </ns2:cardImage>
         <ns2:supplierDetails>
            <ns2:supplierId>227613</ns2:supplierId>
            <ns2:notifySupplier>false</ns2:notifySupplier>
         </ns2:supplierDetails>
      </ns2:getPurchaseRequestDetail>
   </soapenv:Body>
</soapenv:Envelope>
```

### Sample response with ICMP enabled {#sample-response-with-icmp-enabled}

```xml
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:getPurchaseRequestDetail xmlns="http://mastercard.com/sd/pc/service" xmlns:ns2="http://mastercard.com/sd/pc2/service">
         <ns2:purchaseRequestId>90370</ns2:purchaseRequestId>
         <ns2:requestStatus>Approved</ns2:requestStatus>
         <ns2:PurchaseRequestTemplateDetails>
            <ns2:templateId>108291</ns2:templateId>
            <ns2:fullTemplateRuleDetails>
               <ns2:ruleName>B</ns2:ruleName>
               <ns2:ruleType>A</ns2:ruleType>
               <ns2:templateControl xsi:type="ns2:VelocityControlType2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns2:maxTrans>5</ns2:maxTrans>
                  <ns2:cumulativeLimit>6345.0</ns2:cumulativeLimit>
                  <ns2:period>D</ns2:period>
                  <ns2:availableBalance>6345.0</ns2:availableBalance>
                  <ns2:currencyType>B</ns2:currencyType>
                  <ns2:endDate>2023-08-16</ns2:endDate>
               </ns2:templateControl>
            </ns2:fullTemplateRuleDetails>
            <ns2:templateCustomField>
               <ns2:templateCustomField>
                  <customFieldName>Purchase Type</customFieldName>
                  <customFieldValue>Airlines</customFieldValue>
               </ns2:templateCustomField>
            </ns2:templateCustomField>
         </ns2:PurchaseRequestTemplateDetails>
         <ns2:vcnInformation>
            <ns2:Id>39306</ns2:Id>
            <ns2:digitizationGuid>1239d9f9-44bd-4076-b5cd-3024a837db9c</ns2:digitizationGuid>
            <ns2:Pan>5522448030968415</ns2:Pan>
            <ns2:Expiry>2508</ns2:Expiry>
            <ns2:Avv>384</ns2:Avv>
            <ns2:Status>S</ns2:Status>
            <ns2:EVCNIndicator>false</ns2:EVCNIndicator>
         </ns2:vcnInformation>
         <ns2:addenda>
            <tripLeg/>
            <railDetail/>
            <travelAgency/>
         </ns2:addenda>
         <ns2:userDetails>
            <ns2:firstName>mockfirstname</ns2:firstName>
            <ns2:lastName>mocklastname</ns2:lastName>
            <ns2:email>mockemail@test.com</ns2:email>
            <ns2:mobileCountryCode>+1</ns2:mobileCountryCode>
            <ns2:mobileNumber>204567890</ns2:mobileNumber>
         </ns2:userDetails>
         <ns2:vcnDelivery>EMAIL</ns2:vcnDelivery>
      </ns2:getPurchaseRequestDetail>
   </S:Body>
</S:Envelope>
```

