---
title: Update info post-checkout
url: amazon-pay-checkout/update-info-post-checkout.html
---

Call <a href="../amazon-pay-api-v2/charge-permission.md#update-charge-permission" target="_blank" rel="noopener noreferrer">Update Charge Permission</a> to update external merchant metadata or the `recurringMetadata` if subscription details change post-checkout. You can update `merchantMetadata` child parameters multiple times if the Charge Permission is in a Chargeable or NonChargeable state. You can update `merchantMetadata` child parameters if the Charge Permission is in a Closed state only if `chargePermissionType` is Onetime and if the child parameter value to be updated is either null or an empty string. Note that <a href="../amazon-pay-checkout/buyer-communication.md" target="_blank" rel="noopener noreferrer">buyer communication</a> will not reflect the updated value if the Charge Permission is in a Closed state.

<script>
  function keySpecifics(){
    const keyQuery = "?environmentSpecificKeys=";
    const currentSetting = window.location.search?.split("?environmentSpecificKeys=")[1] ?? 'false';
    const newSetting = currentSetting === 'false' ? 'true' : 'false';
    window.location = window.location.origin + window.location.pathname + keyQuery + newSetting // +  window.location.hash (not included as it feels weird to jump down)
  }
</script>
<div style="display:none" class="environmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId <b>_does not_</b> have an environment prefix (does not begin with 'SANDBOX' or 'LIVE') follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId has an environment prefix (for example: SANDBOX-AFVX7ULWSGBZ5535PCUQOY7B) follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>


#### Request


<div style="display:none" class="environmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:version/chargePermissions/:chargePermissionId" \<br />
-X PATCH<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-d @request_body<br />
</code>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:environment/:version/chargePermissions/:chargePermissionId" \<br />
-X PATCH<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-d @request_body<br />
</code>
</div>

#### Request body

```
{
     "merchantMetadata": {
        "merchantReferenceId": "123-77-876", 
        "merchantStoreName": "AmazonTestStoreFront",
        "noteToBuyer": "merchantNoteForBuyer",
        "customInformation": "This is custom information"  
    },
     "recurringMetadata": {
        "frequency": { 
            "unit": "Month", 
            "value": "1" 
        },
        "amount": { 
            "amount": "14",
            "currencyCode": "USD"
        }
    }
}
```



#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id='cJS9CACSzhf'>
            <td id='s:cJS9CACSzhf;cJS9CAw3M2H' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:cJS9CACSzhf;cJS9CARyEsq' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:cJS9CACSzhf;cJS9CARLcRb' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='cJS9CAq4Dec'>
            <td id='s:cJS9CAq4Dec;cJS9CAw3M2H' style='vertical-align: top;'>chargePermissionId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:cJS9CAq4Dec;cJS9CARyEsq' style='vertical-align: top;'>Path Parameter
                <br /></td>
            <td id='s:cJS9CAq4Dec;cJS9CARLcRb' style='vertical-align: top;'>Charge Permission identifier
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>recurringMetadata<br /><br />Type: <a href="../amazon-pay-api-v2/charge-permission.md#type-recurringmetadata" target="_blank" rel="noopener noreferrer">recurringMetadata</a>
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Metadata about how the recurring Charge Permission will be used. Amazon Pay only uses this information to calculate the Charge Permission expiration date and in buyer communication<br /><br />
            Note that it is still your responsibility to call <a href="../amazon-pay-api-v2/charge.md#create-charge" target="_blank" rel="noopener noreferrer">Create Charge</a> to charge the buyer for each billing cycle
                <br /></td>
        </tr>
        <tr id='cJS9CAmc7KL'>
            <td id='s:cJS9CAmc7KL;cJS9CAw3M2H' style='vertical-align: top;'>merchantMetadata<br><br>Type: <a href="../amazon-pay-api-v2/charge-permission.md#type-merchantmetadata" target="_blank" rel="noopener noreferrer">merchantMetadata</a>
                <br /></td>
            <td id='s:cJS9CAmc7KL;cJS9CARyEsq' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:cJS9CAmc7KL;cJS9CARLcRb' style='vertical-align: top;'>Merchant-provided order details<br><br>See  <a href="../amazon-pay-checkout/update-info-post-checkout.md" target="_blank" rel="noopener noreferrer">update info post-checkout</a> for limits to how many times this value can be modified
                <br /></td>
        </tr>
    </tbody>
</table>

#### Sample Code

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-updateChargePermission-Recurring" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-updateChargePermission-Recurring" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-updateChargePermission-Recurring" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-updateChargePermission-Recurring" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-updateChargePermission-Recurring">   
<div markdown="block">
```
<?php

    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $payload = array(
        'merchantMetadata' => array(
            'merchantReferenceId' => '123-77-876',
            'merchantStoreName' => 'AmazonTestStoreFront',
            'noteToBuyer' => 'merchantNoteForBuyer',
            'customInformation' => 'This is custom information'
        ),
        'recurringMetadata' => array(
            'frequency' => array(
                'unit' => 'Month',
                'value' => '1'
            ),
            'amount' => array(
                'amount' => '30',
                'currencyCode' => 'USD'
            )
        )
    );
    
    $headers = array('x-amz-pay-Idempotency-Key' => uniqid());

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);

        $result = $client->updateChargePermission('S01-5105180-3221187', $payload);
        
        if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'];
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-updateChargePermission-Recurring">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.ChargePermission;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.UnitedStates,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public void UpdateChargePermission()
    {
        // prepare the request
        var chargePermissionId = "S01-5105180-3221187";
        var request = new UpdateCheckoutSessionRequest()
        {
            RecurringMetadata =
            {
                Frequency = { 
                  Unit = FrequencyUnit.Month, 
                  Value = 1 
                },
                Amount = { 
                  Amount = 14, 
                  CurrencyCode = Currency.USD 
                }
            },
            MerchantMetadata = { 
                MerchantReferenceId = "123-77-876", 
                MerchantStoreName = "AmazonTestStoreFront", 
                NoteToBuyer = "merchantNoteForBuyer", 
                CustomInformation = "This is custom information" 
            }
        };

        // send the request
        ChargePermissionResponse result = client.UpdateChargePermission(chargePermissionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // handle the API error (use Status field to get the numeric error code)
        }

        // do something with the result, for instance:
        State chargePermissionState = result.StatusDetails.State;
    }

}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-updateChargePermission-Recurring">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

// for generating an idempotency key
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.NA)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String chargePermissionId = "S01-5105180-3221187";

        JSONObject payload = new JSONObject();
        JSONObject merchantMetadata = new JSONObject();
        merchantMetadata.put("merchantReferenceId", "32-41-323141");
        merchantMetadata.put("merchantStoreName", "AmazonTestStoreName");
        merchantMetadata.put("noteToBuyer", "merchantNoteForBuyer");
        merchantMetadata.put("customInformation", "This is custom information");
        payload.put("merchantMetadata", merchantMetadata);

        JSONObject recurringMetadata = new JSONObject();

        JSONObject frequency = new JSONObject();
        frequency.put("unit","Month");
        frequency.put("value","1");
        recurringMetadata.put("frequency", frequency);

        JSONObject amount = new JSONObject();
        amount.put("amount","14");
        amount.put("currencyCode","USD");
        recurringMetadata.put("amount", amount);

        payload.put("recurringMetadata", recurringMetadata);

        response = webstoreClient.updateChargePermission(chargePermissionId, payload);
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}

```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-updateChargePermission-Recurring">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');
const uuidv4 = require('uuid/v4');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'us',
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
  merchantMetadata: {
      merchantReferenceId: "123-77-876",
      merchantStoreName: "AmazonTestStoreFront",
      noteToBuyer: "merchantNoteForBuyer",
      customInformation: "This is custom information"
  },
  recurringMetadata: {
      frequency: {
          unit: "Month",
          value: "1"
      },
      amount: {
          amount: "14",
          currencyCode: "USD"
      }
  }
}
                        
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.updateChargePermission('S01-5105180-3221187',payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-updateChargePermission-Recurring-NESK" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-updateChargePermission-Recurring-NESK" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-updateChargePermission-Recurring-NESK" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-updateChargePermission-Recurring-NESK" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-updateChargePermission-Recurring-NESK">   
<div markdown="block">
```
<?php

    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'sandbox'       => true,
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $payload = array(
        'merchantMetadata' => array(
            'merchantReferenceId' => '123-77-876',
            'merchantStoreName' => 'AmazonTestStoreFront',
            'noteToBuyer' => 'merchantNoteForBuyer',
            'customInformation' => 'This is custom information'
        ),
        'recurringMetadata' => array(
            'frequency' => array(
                'unit' => 'Month',
                'value' => '1'
            ),
            'amount' => array(
                'amount' => '30',
                'currencyCode' => 'USD'
            )
        )
    );
    
    $headers = array('x-amz-pay-Idempotency-Key' => uniqid());

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);

        $result = $client->updateChargePermission('S01-5105180-3221187', $payload);
        
        if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'];
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-updateChargePermission-Recurring-NESK">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.ChargePermission;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.UnitedStates,
            environment: Environment.Sandbox,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public void UpdateChargePermission()
    {
        // prepare the request
        var chargePermissionId = "S01-5105180-3221187";
        var request = new UpdateCheckoutSessionRequest()
        {
            RecurringMetadata =
            {
                Frequency = { 
                  Unit = FrequencyUnit.Month, 
                  Value = 1 
                },
                Amount = { 
                  Amount = 14, 
                  CurrencyCode = Currency.USD 
                }
            },
            MerchantMetadata = { 
                MerchantReferenceId = "123-77-876", 
                MerchantStoreName = "AmazonTestStoreFront", 
                NoteToBuyer = "merchantNoteForBuyer", 
                CustomInformation = "This is custom information" 
            }
        };

        // send the request
        ChargePermissionResponse result = client.UpdateChargePermission(chargePermissionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // handle the API error (use Status field to get the numeric error code)
        }

        // do something with the result, for instance:
        State chargePermissionState = result.StatusDetails.State;
    }

}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-updateChargePermission-Recurring-NESK">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Environment;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

// for generating an idempotency key
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.NA)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setEnvironment(Environment.SANDBOX)
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String chargePermissionId = "S01-5105180-3221187";

        JSONObject payload = new JSONObject();
        JSONObject merchantMetadata = new JSONObject();
        merchantMetadata.put("merchantReferenceId", "32-41-323141");
        merchantMetadata.put("merchantStoreName", "AmazonTestStoreName");
        merchantMetadata.put("noteToBuyer", "merchantNoteForBuyer");
        merchantMetadata.put("customInformation", "This is custom information");
        payload.put("merchantMetadata", merchantMetadata);

        JSONObject recurringMetadata = new JSONObject();

        JSONObject frequency = new JSONObject();
        frequency.put("unit","Month");
        frequency.put("value","1");
        recurringMetadata.put("frequency", frequency);

        JSONObject amount = new JSONObject();
        amount.put("amount","14");
        amount.put("currencyCode","USD");
        recurringMetadata.put("amount", amount);

        payload.put("recurringMetadata", recurringMetadata);

        response = webstoreClient.updateChargePermission(chargePermissionId, payload);
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}

```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-updateChargePermission-Recurring-NESK">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');
const uuidv4 = require('uuid/v4');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'us',
    sandbox: true,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
  merchantMetadata: {
      merchantReferenceId: "123-77-876",
      merchantStoreName: "AmazonTestStoreFront",
      noteToBuyer: "merchantNoteForBuyer",
      customInformation: "This is custom information"
  },
  recurringMetadata: {
      frequency: {
          unit: "Month",
          value: "1"
      },
      amount: {
          amount: "14",
          currencyCode: "USD"
      }
  }
}
                        
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.updateChargePermission('S01-5105180-3221187',payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>

#### Response

```
{
    "chargePermissionId": "S01-5105180-3221187",
    "chargePermissionReferenceId": null,
    "chargePermissionType": "Recurring",   
    "recurringMetadata": {
        "frequency": {
            "unit": "Month",
            "value": "1" 
        },
        "amount": {
            "amount": "14",
            "currencyCode": "USD"
        }
    },
    "buyer": {
        "buyerId": "buyerId",
        "name": "name-1",
        "email": "name@amazon.com",
        "phoneNumber": "800-000-0000",
        "primeMembershipTypes": null
    },
    "releaseEnvironment": "Live",
    "shippingAddress":{  // Null for PayOnly product type
        "name": "Work",
        "addressLine1": "440 Terry Ave",
        "addressLine2": "",
        "addressLine3": "",
        "city": "Seattle",
        "county": "King",
        "district": "Seattle",
        "stateOrRegion": "WA",
        "postalCode": "98121",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "billingAddress": {  
        "name": "Work",
        "addressLine1": "440 Terry Ave",
        "addressLine2": "",
        "addressLine3": "",
        "city": "Seattle",
        "county": "King",
        "district": "Seattle",
        "stateOrRegion": "WA",
        "postalCode": "98121",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "paymentPreferences": [
    {
        "paymentDescriptor": null
    }],
    "statusDetails": {
        "state": "Chargeable",
        "reasons": null,
        "lastUpdatedTimestamp": "20190714T155300Z"
    },
    "creationTimestamp": "20190714T155300Z",
    "expirationTimestamp": "20190715T155300Z",
    "merchantMetadata": {
        "merchantReferenceId": "123-77-876", 
        "merchantStoreName": "AmazonTestStoreFront",
        "noteToBuyer": "merchantNoteForBuyer",
        "customInformation": "This is custom information"  
    },
    "platformId": "SPId",
    "limits": {
        "amountLimit": {
            "amount": "14.00",
            "currencyCode": "USD"
        },
        "amountBalance": {
            "amount": "14.00",
            "currencyCode": "USD"
        }
    },
    "presentmentCurrency": "USD"
}
```







