# Update a payment intent

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


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

Updating properties on a PaymentIntent object. All the subsequent 3DS transaction attempts will have the updated values.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/payment_intents/__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil \
     -u {site_api_key}:\
     -d amount=4000 \
     -d currency_code="USD"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = PaymentIntent.Update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil")
		.Amount(4000)
		.CurrencyCode("USD")
		.Request();

PaymentIntent paymentIntent = result.PaymentIntent;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    paymentintentAction "github.com/chargebee/chargebee-go/v3/actions/paymentintent"
    "github.com/chargebee/chargebee-go/v3/models/paymentintent"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := paymentintentAction.Update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil", &paymentintent.UpdateRequestParams{
        Amount : chargebee.Int64(4000),
        CurrencyCode : "USD",
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        PaymentIntent := res.PaymentIntent
    }
}
```

#### 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.PaymentIntentUpdateRequest{
    Amount : chargebee.Int64(4000),
    CurrencyCode : "USD",
}
  res, err := client.PaymentIntent.Update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil", req)
      if err != nil {
        fmt.Println(err)
    } else {
        PaymentIntent := res.PaymentIntent
    }
}
```

#### Java

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

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = PaymentIntent.update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil")
            .amount(4000L)
            .currencyCode("USD")
            .request();

        PaymentIntent paymentIntent = result.paymentIntent();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.paymentIntent.PaymentIntent;
import com.chargebee.v4.models.paymentIntent.params.PaymentIntentUpdateParams;
import com.chargebee.v4.models.paymentIntent.responses.PaymentIntentUpdateResponse;

public class PaymentIntentUpdate {

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

        PaymentIntentUpdateParams params = PaymentIntentUpdateParams.builder()
            .amount(4000L)
            .currencyCode("USD")
            .build();

        PaymentIntentUpdateResponse response = client
            .paymentIntents()
            .update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil", params);

        PaymentIntent paymentIntent = response.getPaymentIntent();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.paymentIntent.update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil", {
        amount: 4000,
        currency_code: "USD"
    });

    console.log(result);
    const paymentIntent = result.payment_intent;
} 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->paymentIntent()->update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil", [
    "amount" => 4000,
    "currency_code" => "USD"
]);
$paymentIntent = $result->payment_intent;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.PaymentIntent.update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil",
    cb_client.PaymentIntent.UpdateParams(
        amount=4000,
        currency_code="USD"
    )
)
payment_intent = response.payment_intent
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::PaymentIntent.update("__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil",{
  :amount => 4000,
  :currency_code => "USD"
})

payment_intent = result.payment_intent
```

## Sample Response

```json
{
  "payment_intent": {
    "amount": 4000,
    "created_at": 1517501515,
    "currency_code": "USD",
    "expires_at": 1517503315,
    "gateway": "chargebee",
    "gateway_account_id": "gw___test__KyVnGlSBWTQeudG",
    "id": "__test__KyVnHhSBWTR3ZCw__test__6AP6PXGBruIztRxpb4L0Si0Rihcur2fil",
    "modified_at": 1517501515,
    "object": "payment_intent",
    "payment_method_type": "card",
    "status": "inited"
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/payment_intents/{payment-intent-id}

## Input Parameters

- `amount` (optional, in cents, min=0)
  Amount(in cents) to be authorized for 3DS flow.

- `currency_code` (optional, string, max chars=3)
  The currency code (ISO 4217 format) of the amount used in transaction.

- `gateway_account_id` (optional, string, max chars=50)
  The gateway account used for performing the 3DS flow.

- `payment_method_type` (optional, enumerated string, default=card)
  The payment method of this intent.
  Possible enum values:
    - `card`
      card
    - `ideal`
      ideal
    - `sofort`
      sofort
    - `bancontact`
      bancontact
    - `google_pay`
      google\_pay
    - `dotpay`
      dotpay
    - `giropay`
      giropay
    - `apple_pay`
      apple\_pay
    - `upi`
      upi
    - `netbanking_emandates`
      netbanking\_emandates
    - `paypal_express_checkout`
      paypal\_express\_checkout
    - `direct_debit`
      direct\_debit
    - `boleto`
      boleto
    - `venmo`
      Venmo
    - `amazon_payments`
      Amazon Payments
    - `pay_to`
      PayTo
    - `faster_payments`
      Faster Payments
    - `sepa_instant_transfer`
      Sepa Instant Transfer
    - `klarna_pay_now`
      Klarna Pay Now
    - `online_banking_poland`
      Online Banking Poland
    - `payconiq_by_bancontact`
      Payments made via Payconiq by Bancontact.
    - `electronic_payment_standard`
      Electronic Payment Standard
    - `kbc_payment_button`
      KBC Payment Button
    - `pay_by_bank`
      Pay By Bank
    - `trustly`
      Trustly
    - `stablecoin`
      Payments made via Stablecoin.
    - `kakao_pay`
      Payments made via Kakao Pay.
    - `naver_pay`
      Payments made via Naver Pay.
    - `revolut_pay`
      Payments made via Revolut Pay.
    - `cash_app_pay`
      Payments made via Cash App Pay.
    - `wechat_pay`
      Payments made via WeChat Pay.
    - `alipay`
      Payments made via Alipay.
    - `twint`
      Payments made via Twint
    - `go_pay`
      Payments made via GoPay
    - `grab_pay`
      Payments made via GrabPay
    - `pay_co`
      Payments made via PayCo
    - `after_pay`
      Payments made via Afterpay
    - `swish`
      Payments made via Swish
    - `payme`
      Payments made via PayMe
    - `pix`
      Pix
    - `klarna`
      Payments made via Klarna.
    - `alipay_hk`
      Payments made via Alipay HK.
    - `paypay`
      PayPay
    - `gcash`
      Payments made via GCash.
    - `south_korean_cards`
      Payments made via South Korean Cards
    - `paynow`
    - `bizum`
    - `promptpay`
    - `dana`
      Payments made via Dana.
    - `touch_n_go`
      Payments made via Touch 'n Go.
    - `tamara`
      Payments made via Tamara.
    - `qpay`
      Payments made via Qpay.
    - `ovo`
    - `momo`
    - `mercado_pago`
    - `nequi`
    - `nupay`
    - `picpay`
    - `thai_qr`
    - `blik`
    - `fpx`
    - `wero`
    - `p24`
    - `affirm_pay`
    - `rakuten_pay`

- `success_url` (optional, string, max chars=250)
  The URL the customer will be directed to once 3DS verification is successful. Applicable only when `payment_method_type` is `ideal` , `sofort` , `dotpay` or `giropay` .

- `failure_url` (optional, string, max chars=250)
  The URL the customer will be directed to when 3DS verification fails. Applicable only when `payment_method_type` is `ideal` , `sofort` , `dotpay` or `giropay` .

- `payment_method_options` (optional, jsonobject)
  Payment method-specific options for this PaymentIntent. Only `card` is supported; keys for other payment method types are ignored.
  
  -   `card`: Options for card payments.
      -   `three_d_secure`: Options for 3DS authentication.
          -   `challenge_preference`: The preferred 3DS flow. Applicable only when `payment_method_type` is `card` and 3DS is enabled for the gateway account. Supported for Stripe, Adyen, and BlueSnap; ignored for other gateways. The gateway or card issuer can override the preference.
              -   `no_preference`: Chargebee, the gateway, and the issuer decide the 3DS flow.
              -   `no_challenge`: Requests a frictionless flow without a challenge.
              -   `challenge`: Requests a challenge flow.
  
  If not specified, the existing preference is retained. To clear it, pass `payment_method_options` with no `challenge_preference`.

## Returns

- `payment_intent` (Payment intent object)
  Resource object representing payment\_intent
