# Update a collections payment promise

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Idempotency Supported](/docs/api/idempotency)

Updates an existing collections payment promise. Use this to revise promise details such as `promised_by`, `promised_on`, or `reason`.

## Sample Request

#### Chargebee CLI

```bash
chargebee collections-payment-promise update-collections-payment-promise pp_8aspTSOcUcz72s \
    -d promised_by=agent@chargebee.com \
    -d promised_on=1738598400 \
    -d 'reason=Customer requested one-day extension'
```

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/collections_payment_promises/pp_8aspTSOcUcz72s \
     -u {site_api_key}:\
     -d promised_by="agent@chargebee.com" \
     -d promised_on=1738598400 \
     -d reason="Customer requested one-day extension"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = CollectionsPaymentPromise.UpdateCollectionsPaymentPromise("pp_8aspTSOcUcz72s")
		.PromisedBy("agent@chargebee.com")
		.PromisedOn(1738598400)
		.Reason("Customer requested one-day extension")
		.Request();

CollectionsPaymentPromise collectionsPaymentPromise = result.CollectionsPaymentPromise;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    collectionspaymentpromiseAction "github.com/chargebee/chargebee-go/v3/actions/collectionspaymentpromise"
    "github.com/chargebee/chargebee-go/v3/models/collectionspaymentpromise"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := collectionspaymentpromiseAction.UpdateCollectionsPaymentPromise("pp_8aspTSOcUcz72s", &collectionspaymentpromise.UpdateCollectionsPaymentPromiseRequestParams{
        PromisedBy : "agent@chargebee.com",
        PromisedOn : chargebee.Int64(1738598400),
        Reason : "Customer requested one-day extension",
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        CollectionsPaymentPromise := res.CollectionsPaymentPromise
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.CollectionsPaymentPromiseUpdateCollectionsPaymentPromiseRequest{
    PromisedBy : "agent@chargebee.com",
    PromisedOn : chargebee.Int64(1738598400),
    Reason : "Customer requested one-day extension",
}
  res, err := client.CollectionsPaymentPromise.UpdateCollectionsPaymentPromise("pp_8aspTSOcUcz72s", req)
      if err != nil {
        fmt.Println(err)
    } else {
        CollectionsPaymentPromise := res.CollectionsPaymentPromise
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;
import java.sql.Timestamp;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = CollectionsPaymentPromise.updateCollectionsPaymentPromise("pp_8aspTSOcUcz72s")
            .promisedBy("agent@chargebee.com")
            .promisedOn(new Timestamp(1738598400L * 1000))
            .reason("Customer requested one-day extension")
            .request();

        CollectionsPaymentPromise collectionsPaymentPromise = result.collectionsPaymentPromise();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.collectionsPaymentPromise.CollectionsPaymentPromise;
import com.chargebee.v4.models.collectionsPaymentPromise.params.UpdateCollectionsPaymentPromiseParams;
import com.chargebee.v4.models.collectionsPaymentPromise.responses.UpdateCollectionsPaymentPromiseResponse;
import java.sql.Timestamp;

public class UpdateCollectionsPaymentPromise {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        UpdateCollectionsPaymentPromiseParams params = UpdateCollectionsPaymentPromiseParams.builder()
            .promisedBy("agent@chargebee.com")
            .promisedOn(new Timestamp(1738598400L * 1000))
            .reason("Customer requested one-day extension")
            .build();

        UpdateCollectionsPaymentPromiseResponse response = client
            .collectionsPaymentPromises()
            .updateCollectionsPaymentPromise("pp_8aspTSOcUcz72s", params);

        CollectionsPaymentPromise collectionsPaymentPromise = response.getCollectionsPaymentPromise();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.collectionsPaymentPromise.updateCollectionsPaymentPromise("pp_8aspTSOcUcz72s", {
        promised_by: "agent@chargebee.com",
        promised_on: 1738598400,
        reason: "Customer requested one-day extension"
    });

    console.log(result);
    const collectionsPaymentPromise = result.collections_payment_promise;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->collectionsPaymentPromise()->updateCollectionsPaymentPromise("pp_8aspTSOcUcz72s", [
    "promised_by" => "agent@chargebee.com",
    "promised_on" => 1738598400,
    "reason" => "Customer requested one-day extension"
]);
$collectionsPaymentPromise = $result->collections_payment_promise;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.CollectionsPaymentPromise.update_collections_payment_promise("pp_8aspTSOcUcz72s",
    cb_client.CollectionsPaymentPromise.UpdateCollectionsPaymentPromiseParams(
        promised_by="agent@chargebee.com",
        promised_on=1738598400,
        reason="Customer requested one-day extension"
    )
)
collections_payment_promise = response.collections_payment_promise
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::CollectionsPaymentPromise.update_collections_payment_promise("pp_8aspTSOcUcz72s",{
  :promised_by => "agent@chargebee.com",
  :promised_on => 1738598400,
  :reason => "Customer requested one-day extension"
})

collections_payment_promise = result.collections_payment_promise
```

## Sample Response

```json
{
  "collections_payment_promise": {
    "id": "pp_8aspTSOcUcz72s",
    "customer_id": "__test__8aspTSOcUcz72s",
    "invoice_id": "__demo_inv__4",
    "currency_code": "USD",
    "amount": 1000,
    "promised_by": "agent@chargebee.com",
    "promised_on": 1738598400,
    "reason": "Customer requested one-day extension",
    "status": "active",
    "created_at": 1738508400,
    "updated_at": 1738598450,
    "resource_version": 1738598450000,
    "object": "collections_payment_promise"
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/collections_payment_promises/{collections-payment-promise-id}

## Input Parameters

- `promised_on` (optional, timestamp(UTC) in seconds)
  Updated promised payment date as a UTC timestamp in seconds.

- `reason` (optional, string, max chars=500)
  Optional note describing the reason for this update.

- `promised_by` (optional, string, max chars=254)
  Name or identifier of the user or agent updating this payment promise.

## Returns

- `collections_payment_promise` (Collections payment promise object)
  The updated `collections_payment_promise` resource.
