--- title: "Pre-authorization and authorization adjustment" description: "Pre-authorize a payment, adjust the authorized amount, and capture the payment." url: "https://docs.adyen.com/point-of-sale/pre-authorisation" source_url: "https://docs.adyen.com/point-of-sale/pre-authorisation.md" canonical: "https://docs.adyen.com/point-of-sale/pre-authorisation" last_modified: "2024-01-18T06:26:00+01:00" language: "en" --- # Pre-authorization and authorization adjustment Pre-authorize a payment, adjust the authorized amount, and capture the payment. [View source](/point-of-sale/pre-authorisation.md) In a basic payment flow, the payable amount from your payment request is [authorized](/get-started-with-adyen/adyen-glossary/#authorization?target=_blank) and then [captured](/get-started-with-adyen/adyen-glossary/#capture-or-clearing-and-settlement?target=_blank). But sometimes you want to change the amount or extend the length of the authorization. Using the [authorization type](#authorisation-types?target=_blank) **pre-authorization** for your payment request, you can increase or decrease the authorized amount at a later stage, and then capture the payment manually. Changes to a pre-authorized payment are called "authorization adjustments". ## Requirements Before you begin, take into account the following requirements, limitations, and preparations. | Requirement | Description | | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | A [Terminal API integration](/point-of-sale/basic-tapi-integration/) with payment terminals. | | **[API credentials](/development-resources/api-credentials)** | You must have an API credential with an API key and the following [roles, which are assigned by default](/development-resources/api-credentials/roles#roles-for-payments):- Merchant PAL webservice role - Checkout webservice role If you have a Terminal API integration with [cloud-based communications](/point-of-sale/design-your-integration/choose-your-architecture#cloud-communications), you can use the existing API key that you use for Terminal API requests. | | **[Webhooks](/development-resources/webhooks)** | Listen for [Standard webhook messages](/development-resources/webhooks/webhook-types#default-event-codes) with the following `eventCode` values:- **AUTHORISATION\_ADJUSTMENT** - **CAPTURE** - **CAPTURE\_FAILED** | | **Hardware** | Use a payment terminal model that is suitable for unattended use, like the **P400 Plus**, **S1U2**, or **UX300**. | | **Limitations** | Be aware of the following:- [Support for authorization adjustment](/point-of-sale/pre-authorisation/#availability) is limited to specific payment methods and Merchant Category Codes (MCC). It is ultimately up to the issuing bank whether they allow it. - Pre-authorizations and authorizations [eventually expire](/point-of-sale/pre-authorisation/#validity). The length of an authorization's validity depends on the card scheme. - [Smart pre-authorization](#smart-pre-auth) is not available for QR based payment methods, Mail Order/Telephone Order (MOTO) and Manual Key Entry (MKE). | | **Setup steps** | Before you begin:- Contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to configure your payment methods. - [Enable manual capture](/point-of-sale/capturing-payments#enable-manual-capture), either for your account or for individual transactions. | ## How it works The process to adjust an authorized amount is as follows: 1. To indicate that you will probably make changes later, you use the authorization type [pre-authorization](#pre-authorize) in your payment request.\ The payment is pre-authorized for the amount specified in the payment request. 2. When the amount due increases (or decreases), you send a request to [adjust the pre-authorized amount](#adjust-auth).\ Each time that the amount due changes or the validity period of the authorization is about to expire, you send another authorization adjustment request. 3. After your last authorization adjustment, you [manually capture the payment](#capture-authorization). Note the following: * You need to implement logic on your end to decide when to use the pre-authorization flow, and to calculate the amount when you make an authorization adjustment. * You can use pre-authorization with [Dynamic Currency Conversion (DCC)](/point-of-sale/currency-conversion/#dcc-flow). This gives shoppers from abroad a choice to pay in the local currency or their own currency. ### Use cases There are several use cases for adjusting a pre-authorized amount: * Hospitality. For example, in a hotel: 1. Just before the guest checks in, or when the guest checks in using an app or in person, the hotel pre-authorizes payment of the guest's room. At the same time, the hotel [stores the shopper's payment information](/point-of-sale/shopper-recognition) , to be able to apply late charges when necessary. 2. During their stay, the guest incurs expenses at the hotel facilities. The hotel adds these expenses to the pre-authorized amount by adjusting the authorization. 3. When the guest checks out, the hotel captures the final amount, or cancels the payment if the guest prefers to settle their bill with a different payment method. 4. If necessary, the hotel charges the guest after they have left, using the shopper's stored payment details for a new payment. - [Tipping](/point-of-sale/tipping/tipping-on-receipt) in regions and industries where it is customary that the guest adds a tip on the receipt after they have presented their card. - Cross-channel customer journeys. For example: the shopper pre-orders a product in a web shop, and after a long delivery time goes to the store to make the payment and collect the product. ## Authorization type For some card schemes, you can set payment requests to be handled as either a pre-authorization or a final authorization. * **Pre-authorization**: this authorization type verifies that the shopper's account is valid and has sufficient funds to cover a transaction, but does not debit the account. It is intended for use cases as described above, when you do not yet know the amount to be captured. It allows you to increase or decrease the initially authorized amount at a later point in time. * **Final authorization**: the final amount is agreed up front and the transaction will be captured in full. This is the default authorization type, and it doesn't allow you to adjust the authorized amount later. By default, Adyen handles all card payment requests as final authorizations. To set an authorization type, you can either: * Define the default authorization type at the merchant account level for all card transactions. See [Configure your account](#configure-account). * Specify `authorisationType` **PreAuth** or `authorisationType` **FinalAuth** in each payment request. See [Pre-authorize a payment](#pre-authorize). ## Asynchronous or synchronous adjustment There are two ways to implement pre-authorization: * **Asynchronous authorization adjustment**: you refer to a payment using the PSP reference that you received in the response to your pre-authorization request. In each authorization adjustment request, and in the final capture request, you specify this first PSP reference. Asynchronous adjustment is easier to implement, but it is not immediately clear if the adjustment succeeded. You must [set up webhooks](/development-resources/webhooks) to receive updates and to know if the final amount was authorized before you capture the payment. * **Synchronous authorization adjustment**: you pass an `adjustAuthorisationData` blob from one request to the next, to enable us to keep track of the latest amount. You receive the first blob in the response to your pre-authorization request. In your first authorization adjustment request, you specify the blob you received for the pre-authorization, and you receive a new blob in the response. In your next adjustment, you specify the blob that you received in the response for the previous adjustment, and so on. Synchronous adjustment requires more effort to implement, because you need to keep track of the latest blob. The advantage is that you receive the adjustment result synchronously. In this way you immediately know if the final amount was authorized before you capture the payment. If at any point you fail to pass the blob, the flow falls back to asynchronous adjustment, and it is no longer possible to return to synchronous adjustment for that payment. ## Configure your account (Optional) There are various aspects of your account that you may want to configure for pre-authorization and authorization adjustment: * **Synchronous authorization adjustment**: to enable synchronous authorization adjustment, in your [Customer Area](https://ca-test.adyen.com/) go to **In-person payments** > **Developer** > **Additional Data** and select **return adjust authorisation data**. You will then receive the initial `adjustAuthorisationData` blob with your pre-authorization request and subsequently receive the authorization adjustment results synchronously. * **Default authorization type**: if you only do pre-authorization payment requests, you can ask our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to set your default [authorization type](#authorisation-types) to **PreAuth** so that you do not have to specify it in your payment requests. If you want to do both pre-authorization payment requests and regular payment requests, we recommend you specify the authorization type in all payment requests. * **Manual capture**: to capture payments in the authorization adjustment flow, [manual capture must be enabled](/point-of-sale/capturing-payments#enable-manual-capture). You can set this for your account, but then all payments require manual capture. The alternative is to enable manual capture in the individual pre-authorization requests. ## Enable smart pre-authorization (Optional) [Certain card schemes do not support incremental adjustments](#availability). Because this is validated during the authorization adjustment step, you cannot know in advance, at the pre-authorization step, if you should accept the customer's card. The **smart pre-authorization** feature lets your payment terminal check if the card presented by the customer is of a brand that supports authorization adjustment. In addition to checking the card brand, you can optionally let the feature check if the funding source, such as credit or debit, supports authorization adjustment. If the card supports authorization adjustment, the terminal continues with the pre-authorization request. If the card does not support authorization adjustment, the terminal presents the shopper with a list of supported card brands to choose from. They can then use a different card and continue with the payment. | | | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Brand not supported: ![](/images/5/d/4/4/d/5d44d0d059a61263955fb8bedcf915a393a03e0e-screen-ensmart-pre-auth.png "Card brand does not support authorization adjustment") | Funding source not supported: ![](/images/e/e/f/8/2/eef82eea9a5819cb5251c701e8b2719b0943bb91-screen-ensmart-pre-auth-funding-source-compacttouch.png "Funding source does not support authorization adjustment") | To enable smart pre-authorization: 1. Log in to your [Customer Area](https://ca-test.adyen.com/) 2. Go to **In-person payments** > **Terminal settings** > **Payment features**. 3. Under **Smart Pre-auth** > **Filter supported Brands**, select the pencil icon **and then select **Enable**. 4. (Optional) If you want to exclude debit and/or prepaid cards from the smart pre-authorization flow: 1. Under **Filter Funding Sources**, select the pencil icon **. 2. Select **Enable**, and choose the types of cards that you want to exclude. 5. Select **Save**. ## 1. Pre-authorize a payment To start the pre-authorization payment flow, make a Terminal API payment request with an authorization type of **PreAuth**: 1. [Make a payment request](/point-of-sale/basic-tapi-integration/make-a-payment), specifying: * The standard [`SaleToPOIRequest.MessageHeader` ](/point-of-sale/design-your-integration/terminal-api#request-message-header)object, with `MessageClass` set to **Service** and `MessageCategory` set to **Payment**. | Parameter | Required | Description | | ----------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ProtocolVersion` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **3.0** | | `MessageClass` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Service** | | `MessageCategory` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Payment** | | `MessageType` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Request** | | `ServiceID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (`POIID`) being used. | | `SaleID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for the POS system component to send this request from. | | `POIID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*. | - The [PaymentRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/payment) object with: | Parameter | Required | Description | | ------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `SaleData.SaleTransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `TransactionID`: your reference to identify a payment. We recommend using a unique value per payment. - `TimeStamp`: date and time of the request in [UTC format](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_\(UTC\)). | | `SaleData.SaleToAcquirerData` | See [Authorization type](#authorisation-types) | A string with:- **authorisationType=PreAuth**: indicates this is a pre-authorization request. - **manualCapture=true** to [enable manual capture](/point-of-sale/capturing-payments/?tab=individual_payment_2#enable-manual-capture) for this request, if you haven't enabled manual capture for your account. See [Adding data elements to your request](/point-of-sale/add-data#instructions) to learn how to format `SaleToAcquirerData`. | | `PaymentTransaction.AmountsReq` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `Currency`: the transaction [currency](/development-resources/currency-codes). - `RequestedAmount`: the transaction amount. | The following example shows how to initiate pre-authorization for a payment of **EUR 150.00**. **Pre-authorization request** ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"Payment", "MessageType":"Request", "SaleID":"POSSystemID12345", "ServiceID":"0207111104", "POIID":"P400Plus-275688710" }, "PaymentRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"27908", "TimeStamp":"2019-03-07T10:11:04+00:00" }, "SaleToAcquirerData":"authorisationType=PreAuth&manualCapture=true" }, "PaymentTransaction":{ "AmountsReq":{ "Currency":"EUR", "RequestedAmount":150.00 } } } } } ``` The customer presents their card to the payment terminal. The terminal collects the payment details and sends the request for the original amount to the Adyen payments platform for processing. 2. Check the response. If the pre-authorization is successful: * The terminal shows the transaction is approved. * The payment result contains: * `POIData.POITransactionID.TransactionID`: [Transaction identifier](/point-of-sale/design-your-integration/terminal-api#transaction-identifier) for the payment, in the format *tender\_reference.PSP\_reference*. * `PaymentResult`: payment method data including: * `AmountsResp`: the `AuthorizedAmount` and `Currency` of the pre-authorized payment. * `Response.Result`: **Success** * `Response.AdditionalResponse`: additional transaction data. Depending on the format you used in the request, you receive either a string of form-encoded key-value pairs or a Base64 string that you need to decode to get a JSON object. This includes: * `posadditionalamounts.originalAmountValue`: the original amount in [minor units](/development-resources/currency-codes). * `authorisedAmountValue`: the authorized amount in minor units, which at this stage is equal to the original amount. * `pspReference`: the PSP reference of your pre-authorization request. * `adjustAuthorisationData`: a blob with authorization data. You only receive this if the synchronous flow is enabled for your account. The following example shows the response to a EUR 150.00 authorization request. **Pre-authorization response - synchronous flow** ```json { "SaleToPOIResponse": { "PaymentResponse": { "POIData": "POITransactionID": { "TimeStamp": "2019-12-04T13:56:26.000Z", "TransactionID": "8ha5001575467786000.KHQC5N7G84BLNK43" } {...}, "SaleData": {...}, "PaymentReceipt": [...], "PaymentResult": { "AuthenticationMethod": [...], "OnlineFlag": true, "PaymentAcquirerData": {...}, "PaymentInstrumentData": {...}, "AmountsResp": { "AuthorizedAmount": 150.00, "Currency": "EUR" } }, "Response": { "Result": "Success", "AdditionalResponse": "...adjustAuthorisationData=BQABAQA+fbc==..." } }, "MessageHeader": {...} } } ``` 3. Store the `pspReference` and the `adjustAuthorisationData` from the `AdditionalResponse` for later use when adjusting the authorization or capturing the payment. ## 2. Adjust the pre-authorized amount To increase or decrease the pre-authorized amount or to [extend the authorization](#extend-authorization), make an authorization adjustment request. This step involves making a request to the Adyen backend directly. This is not a Terminal API request to the terminal itself or the Cloud endpoint for the terminal. When building or testing the flow, make sure there is at least a 5 second delay between the pre-authorization and the authorization adjustment. ### Tab: Asynchronous authorization adjustment 1. Make a POST [/payments/{paymentPspReference}/amountUpdates](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates) request, including the following: Path parameters: | Parameter | Required | Description | | --------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | | `paymentPspReference` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The PSP reference from the pre-authorization response. | Body parameters: | Parameter | Required | Description | | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [merchantAccount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates#request-merchantAccount) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The name of your merchant account that is used to process the payment. | | [amount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates#request-amount) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The `currency` and `value` of the new amount **in minor units**. This is the sum of the pre-authorized amount and the additional amount. If this is not the first authorization adjustment, it is the sum of the pre-authorized amount plus all additional amounts. | | [industryUsage](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates#request-industryUsage) | | Use the **delayedCharge** value for pre-authorizations. | | [reference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates#request-reference) | | Your reference to this payment modification, for use in your reconciliation process. | The following example shows how to add a charge of EUR 64.15 to a pre-authorized amount of EUR 150.00. **Asynchronous authorization adjustment request** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/amountUpdates \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "currency":"EUR", "value":21415 }, "industryUsage": "delayedCharge", "reference": "YOUR_UNIQUE_REFERENCE" }' ``` #### Java ```java // Adyen Java API Library v26.3.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the live environment, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("EUR") .value(21415L); PaymentAmountUpdateRequest paymentAmountUpdateRequest = new PaymentAmountUpdateRequest() .industryUsage(PaymentAmountUpdateRequest.IndustryUsageEnum.DELAYEDCHARGE) .reference("YOUR_UNIQUE_REFERENCE") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT"); // Send the request ModificationsApi service = new ModificationsApi(client); PaymentAmountUpdateResponse response = service.updateAuthorisedAmount("paymentPspReference", paymentAmountUpdateRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php // Adyen PHP API Library v18.2.1 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\LineItem; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\PaymentAmountUpdateRequest; use Adyen\Service\Checkout\ModificationsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(21415); $paymentAmountUpdateRequest = new PaymentAmountUpdateRequest(); $paymentAmountUpdateRequest ->setIndustryUsage("delayedCharge") ->setReference("YOUR_UNIQUE_REFERENCE") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new ModificationsApi($client); $response = $service->updateAuthorisedAmount('paymentPspReference', $paymentAmountUpdateRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v17.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the live environment, additionally include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "EUR", Value = 21415 }; PaymentAmountUpdateRequest paymentAmountUpdateRequest = new PaymentAmountUpdateRequest { IndustryUsage = PaymentAmountUpdateRequest.IndustryUsageEnum.DelayedCharge, Reference = "YOUR_UNIQUE_REFERENCE", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT" }; // Send the request var service = new ModificationsService(client); var response = service.UpdateAuthorisedAmount("paymentPspReference", paymentAmountUpdateRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v17.3.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const paymentAmountUpdateRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", amount: { currency: "EUR", value: 21415 }, industryUsage: "delayedCharge", reference: "YOUR_UNIQUE_REFERENCE" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.updateAuthorisedAmount("paymentPspReference", paymentAmountUpdateRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v10.4.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/checkout" ) // For the live environment, additionally include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "EUR", Value: 21415, } paymentAmountUpdateRequest := checkout.PaymentAmountUpdateRequest{ IndustryUsage: common.PtrString("delayedCharge"), Reference: common.PtrString("YOUR_UNIQUE_REFERENCE"), Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", } // Send the request service := client.Checkout() req := service.ModificationsApi.UpdateAuthorisedAmountInput("paymentPspReference").IdempotencyKey("UUID").PaymentAmountUpdateRequest(paymentAmountUpdateRequest) res, httpRes, err := service.ModificationsApi.UpdateAuthorisedAmount(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.5.1 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "currency": "EUR", "value": 21415 }, "industryUsage": "delayedCharge", "reference": "YOUR_UNIQUE_REFERENCE" } # Send the request result = adyen.checkout.modifications_api.update_authorised_amount(request=json_request, paymentPspReference="paymentPspReference", idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.5.1 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :amount => { :currency => 'EUR', :value => 21415 }, :industryUsage => 'delayedCharge', :reference => 'YOUR_UNIQUE_REFERENCE' } # Send the request result = adyen.checkout.modifications_api.update_authorised_amount(request_body, 'paymentPspReference', headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v17.3.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "EUR", value: 21415 }; const paymentAmountUpdateRequest: Types.checkout.PaymentAmountUpdateRequest = { lineItems: [lineItem1, lineItem2], industryUsage: Types.checkout.PaymentAmountUpdateRequest.IndustryUsageEnum.DelayedCharge, reference: "YOUR_UNIQUE_REFERENCE", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.updateAuthorisedAmount("paymentPspReference", paymentAmountUpdateRequest, { idempotencyKey: "UUID" }); ``` 2. In the [/amountUpdates](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates) response, note the following parameters: * `pspReference`: the PSP reference for this [/amountUpdates](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates) request.\ This is different from the PSP reference of the pre-authorization request. * `status`: **received** **Asynchronous authorization adjustment response** ```json { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "paymentPspReference": "KHQC5N7G84BLNK43", "pspReference": "NC6HT9CRT65ZGN82", "reference": "YOUR_UNIQUE_REFERENCE", "status": "received", "amount": { "currency": "EUR", "value": 21415 } } ``` 3. Wait for a webhook message with the `eventCode` [AUTHORISATION\_ADJUSTMENT](https://docs.adyen.com/api-explorer/Webhooks/latest/post/AUTHORISATION_ADJUSTMENT). This informs you whether the new amount has been authorized. ### Tab: Synchronous authorization adjustment []() 1. If this is the first adjustment after the pre-authorization: * If you received the `AdditionalResponse` in the initial Terminal API payment response as key-value pairs separated by ampersands (**&**), URL-decode the value of the `adjustAuthorisationData` key. To find a tool or instructions for URL-decoding, search the internet for *\ decode x-www-form-urlencoded*. * If you received the `AdditionalResponse` in the initial Terminal API payment response as a Base64-encoded string, Base64-decode the string and copy the value of the `adjustAuthorisationData` field. For adjustments after the first adjustment, skip the above step. 2. Make a POST [/payments/{paymentPspReference}/amountUpdates](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates) request, including the following: Path parameters: | Parameter | Required | Description | | --------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | | `paymentPspReference` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The PSP reference from the pre-authorization response. | Body parameters: | Parameter | Required | Description | | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [merchantAccount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates#request-merchantAccount) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The name of your merchant account that is used to process the payment. | | [amount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates#request-amount) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The `currency` and `value` of the new amount **in minor units**. This is the sum of the pre-authorized amount and the additional amount. If this is not the first authorization adjustment, it is the sum of the pre-authorized amount plus all additional amounts. | | `adjustAuthorisationData` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The previous `adjustAuthorisationData` blob. For the first adjustment, this is the blob you received in the response to the pre-authorization request. For the second adjustment, it is the blob you received in the response to the first adjustment, and so on. Always use the latest blob. | | [reference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates#request-reference) | | Your reference to this payment modification, for use in your reconciliation process. | The following example shows how to add a charge of EUR 64.15 to a pre-authorized amount of EUR 150.00. #### curl ```bash curl -X POST https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/amountUpdates \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "currency":"EUR", "value":21415 }, "reference": "YOUR_UNIQUE_REFERENCE", "adjustAuthorisationData": "BQABAQA+fbc==..." }' ``` #### Java ```java // Adyen Java API Library v32.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.payment.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) // Send the request paymentApi service = new paymentApi(client); ModificationResult response = service.adjustAuthorisation(adjustAuthorisationRequest, null); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) // Send the request $service = new ModificationsApi($client); $response = $service->adjustAuthorisation($adjustAuthorisationRequest); ``` #### C\# ```cs // Adyen .net API Library v26.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Payment; using Adyen.Service; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) // Send the request var service = new PaymentService(client); var response = service.AdjustAuthorisation(adjustAuthorisationRequest); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v22.1.0 // Require the parts of the module you want to use const { Client, PaymentAPI } = require('@adyen/api-library'); const client = new Client({ apiKey: "ADYEN_API_KEY", environment: "TEST" }); // Create the request object(s) const adjustAuthorisationRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", originalReference: "KHQC5N7G84BLNK43", modificationAmount: { currency: "EUR", value: 21415 }, reference: "YOUR_MODIFICATION_REFERENCE", additionalData: { adjustAuthorisationData: "BQABAQA+fbc==..." } } // Send the request const paymentAPI = new PaymentAPI(client); const response = paymentAPI.adjustAuthorisation(adjustAuthorisationRequest); ``` #### Go ```go // Adyen Go API Library v16.1.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/payments" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) // Send the request service := client.Payments() req := service.ModificationsApi.AdjustAuthorisationInput().AdjustAuthorisationRequest(adjustAuthorisationRequest) res, httpRes, err := service.ModificationsApi.AdjustAuthorisation(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v13.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "originalReference": "KHQC5N7G84BLNK43", "modificationAmount": { "currency": "EUR", "value": 21415 }, "reference": "YOUR_MODIFICATION_REFERENCE", "additionalData": { "adjustAuthorisationData": "BQABAQA+fbc==..." } } # Send the request result = adyen.payment.modifications_api.adjust_authorisation(request=json_request) ``` #### Ruby ```rb # Adyen Ruby API Library v10.1.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :originalReference => 'KHQC5N7G84BLNK43', :modificationAmount => { :currency => 'EUR', :value => 21415 }, :reference => 'YOUR_MODIFICATION_REFERENCE', :additionalData => { :adjustAuthorisationData => 'BQABAQA+fbc==...' } } # Send the request result = adyen.payment.modifications_api.adjust_authorisation(request_body) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v22.1.0 // Require the parts of the module you want to use import { Client, PaymentAPI, Types } from "@adyen/api-library"; const client = new Client({ apiKey: "ADYEN_API_KEY", environment: "TEST" }); // Create the request object(s) // Send the request const paymentAPI = new PaymentAPI(client); const response = paymentAPI.adjustAuthorisation(adjustAuthorisationRequest); ``` 3. In the [/amountUpdates](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates) response, note the following parameters: * `adjustAuthorisationData`: The new blob for the new authorized amount. Store this for subsequent adjustments. * `paymentPspReference`: The PSP reference of the original pre-authorization. * `pspReference`: The PSP reference for this [/amountUpdates](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates) request.\ This is different from the PSP reference of the pre-authorization request. * `status`: **Authorised**\ This indicates the new amount is authorized. **Synchronous authorization adjustment response** ```json { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "paymentPspReference": "KHQC5N7G84BLNK43", "pspReference": "NC6HT9CRT65ZGN82", "reference": "YOUR_UNIQUE_REFERENCE", "status": "Authorised", "adjustAuthorisationData": "BQABAQArqht7L...", "amount": { "currency": "EUR", "value": 21415 } } ``` 4. Store the `adjustAuthorisationData` blob you received in the [/amountUpdates](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/amountUpdates) response. You will need this if you adjust the authorization again. ### Extending the authorization Authorizations [expire](#validity) after a while. To extend the authorization period, follow the same instructions as for [adjusting the pre-authorized amount](#adjust-auth), but use the same amount as the current balance on the authorization: * If you haven't adjusted the authorization yet, use the amount from the original pre-authorization request. * If you did adjust the authorization, use the amount from the last adjustment. When using the asynchronous adjustment flow, check the amount in the AUTHORISATION\_ADJUSTMENT webhook. ## 3. Capture the payment After you make your last authorization adjustment, you must manually capture the payment to transfer the reserved funds to your account. Always double-check that you have completed all authorization adjustments for the payment before you capture it. Captures are done asynchronously, so it may seem that the payment hasn't been completely captured yet and that it is still possible to adjust the authorization. 1. Decide whether you are ready to capture the payment: * If there are additional charges to make, first [adjust the authorization](#adjust-auth). * If the customer wants to settle the bill using a different payment method than the one used for the pre-authorization, do not capture the payment. Instead, [cancel](/point-of-sale/capturing-payments#cancel-authorisation) the pre-authorization by sending a POST [/payments/{paymentPspReference}/cancels](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/cancels) request, where `{paymentPspReference}` is the PSP reference from the pre-authorization response. 2. When you are ready to capture the payment, make a POST [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request, where `{paymentPspReference}` is the PSP reference from the pre-authorization response. Specify: | Parameter | Required | Description | | ----------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `amount` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The `currency` of the final amount and its `value` in [minor units](/development-resources/currency-codes). This is the sum of the original, pre-authorized amount and all later adjustments. | | `merchantAccount` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The name of your merchant account that is used to process the payment. | | `reference` | | Your reference to this payment modification, for use in your reconciliation process. | **Capture request** ```bash curl https://checkout-test.adyen.com/v72/payments/KHQC5N7G84BLNK43/captures \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "amount":{ "currency":"EUR", "value":21415 }, "reference":"YOUR_UNIQUE_REFERENCE" }' ``` 3. In the [/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) response, note the following parameters: * `pspReference`: The PSP reference associated with this [/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request.\ This is different from the PSP reference associated with the pre-authorization request. * `status`: **received** * `reference`: Your reference to this payment modification, for use in your reconciliation process. **Capture response** ```json { "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "paymentPspReference": "KHQC5N7G84BLNK43", "pspReference": "QJ7GWQ756L2GWR86", "reference": "YOUR_UNIQUE_REFERENCE", "status": "received", "amount": { "currency": "EUR", "value": 21415 } } ``` 4. Wait for a webhook message with the `eventCode` [CAPTURE](https://docs.adyen.com/api-explorer/Webhooks/latest/post/CAPTURE). This informs you whether the final amount has been captured. If the capture fails, the webhook contains `success`: **false**. Review the `reason` you received in the webhook, fix the issue, and submit the `/captures` request again. If you need to charge the customer for an additional amount after they have left, and you [stored the customer's payment details](/point-of-sale/recurring-payments) with your pre-authorisation request, you can apply these late charges in a recurring payment request using the token. ## Testing Our test environment supports testing the whole authorization adjustment flow. For the pre-authorization request you can use our [POS test cards](/point-of-sale/testing-pos-payments/#testing-card-payments). When building or testing the flow, make sure there is at least a 5 second delay between the pre-authorization and the authorization adjustment. ## Availability Authorization adjustment is available for the following payment methods: | Payment method | Availability | | | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | Card | Card schemes set specific rules around which businesses can adjust authorizations. Your eligibility is determined by your [Merchant Category Code (MCC)](/get-started-with-adyen/adyen-glossary/#merchant-category-code). For a business type, each card scheme uses a different MCC. See which [schemes support which MCC codes](#mcc-authorization-adjustment). | | | Apple Pay | Available if the card associated with the Apple Pay wallet is from a card scheme for which authorization adjustment is available. | | | Google Pay | Available if the card associated with the Google Pay wallet is from a card scheme for which authorization adjustment is available. | | ### Merchant Category Code (MCC) and authorization adjustment To view your MCCs for each payment method: 1. Log in to your [live Customer Area](https://ca-live.adyen.com/). 2. Switch to your merchant account. 3. Select **Settings** > **Payment methods**. 4. Find the line for the specific payment method. The **MCC** column shows your MCC for that payment method. The following table shows, for each card scheme, which MCC codes authorization adjustment is available for: | Card scheme | Merchant Category Codes (MCC) for which authorization adjustment is available | | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | American Express | All MCCs except 5542 | | Discover | 3351-3441, 3501-3999, 4111, 4112, 4121, 4131, 4411, 4457, 5499, 5812, 5813, 7011, 7033, 7996, 7394, 7512, 7513, 7519, 7999 | | Mastercard | All MCCs except 5542 | | Mexico Domestic (Network MX) | Card present: 4722, 5541, 5542, 5812, 5813, 8062, multiple MCCs for car rental, entertainment, and hotels Card not present: 4011, 4112, 4121, 4131, 4816, 5300, 5310, 5311, 5331, 5411, 5422, 5814, all air transportation | | Visa | All MCCs except 5542 Authorization adjustment does not work for V Pay cards. | | China UnionPay | 7011, 7512, 4411, 3xxx | ## Expiration of pre-authorizations You can only adjust a pre-authorization that has not expired yet. There are two authorization validity periods to take into account: * For the global card schemes, Adyen expires (pre-)authorization requests automatically after 28 days from the day the payment is authorized. Contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) if you want to change this default setting, and configure custom authorization validity periods for specific merchant accounts and card schemes. The maximum allowable partial captures against a single pre-authorization is determined by the issuer. * Card schemes have their own rules on authorization validity, and can expire a pre-authorization before or after the scheme's official authorization validity period. Using [manual capture](/online-payments/capture#manual-capture) it is possible to capture remaining balance on a payment after an authorization has already expired on the card scheme's side, but this practice increases the risk of: * A [failed capture](/online-payments/capture#failed-capture). * Increased interchange fees. * Card scheme transaction fees. * A cardholder-initiated [chargeback](/risk-management/understanding-disputes/dispute-reason-codes) for 'No Authorization' or 'Late Presentment' reasons. The following tables include information on authorization validity periods for major card schemes **that allow authorization adjustment**. ### American Express | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | ------ | ------------ | ----------- | ------------------------------------------ | --- | ------ | | Amex | All | All | All | All | 7 days | ### Cartes Bancaires | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | --------------- | ------------ | ----------- | ------------------------------------------ | --- | ------- | | Carte Bancaires | All | All | All | All | 12 days | ### China UnionPay * 30 Days from the initial authorisation. * Authorisation adjustment does not extend the authorisation validity period. ### Diners | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | ------ | ------------ | ----------- | ------------------------------------------ | ------------------------- | ------- | | Diners | All | MOTO | All | All | 7 days | | Diners | Debit | All | All | All | 7 days | | Diners | Credit | All | All | All | 30 days | | Diners | All | All | All | Car Rental, Hotel/Lodging | 30 days | ### Discover | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | -------- | ------------ | ----------- | ------------------------------------------ | ------------------------- | ------- | | Discover | All | All | All | All | 10 days | | Discover | All | All | All | Car Rental, Hotel/Lodging | 30 days | ### JCB | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | ------ | ------------ | ----------- | ------------------------------------------ | -------------------- | ------------------- | | JCB | All | All | All | All | 1 year | | JCB | All | All | Pre-auth | Hotel and Car rental | Time of stay/rental | ### Mastercard | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | ---------- | ------------ | ----------- | ------------------------------------------ | --- | ------- | | Mastercard | All | All | Final auth | All | 7 days | | Mastercard | All | All | Pre-auth | All | 30 days | Capturing Mastercard payments can be successful even when the authorization has expired after seven or 30 days. For domestic transactions in the US and Canada, there is a late capture fee. ### Mexico Domestic | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | ---------- | ------------ | ----------- | ------------------------------------------ | --- | -------- | | Network MX | Debit | All | Final auth | All | 7 days | | Network MX | Credit | All | Final auth | All | 30 days | | Network MX | Debit | All | Pre-auth | All | 30 days | | Network MX | Credit | All | Pre-auth | All | 120 days | ### Visa | Scheme | Debit/credit | Environment | [Authorization type](#authorisation-types) | MCC | Days | | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | ---------------------------------------- | ------- | | Visa electron | All | All | All | All | 5 days | | Visa | All | POS | All | All | 5 days | | Visa | All | Merchant initiated transactions (MIT) *Applies to:* * ContAuth + Subscription / UnscheduledCardOnFile | All | All | 5 days | | Visa | All | [CNP](https://docs.adyen.com/get-started-with-adyen/adyen-glossary/#card-not-present-cnp) Cardholder-initiated transactions (CIT) *Applies to:* * Ecommerce / ContAuth + CardOnFile* Ecommerce + Subscription / UnscheduledCardOnFile | All | All | 10 days | | Visa | All | [CNP](https://docs.adyen.com/get-started-with-adyen/adyen-glossary/#card-not-present-cnp) Cardholder-initiated transactions (CIT) *Applies to:* * Ecommerce / ContAuth + CardOnFile* Ecommerce + Subscription / UnscheduledCardOnFile | Extended-Auth[ 1](#exauth) | All | 30 days | | Visa | All | All | Pre-Auth | Cruise, Lodging, Vehicle Rental | 30 days | | Visa | All | All | Pre-Auth | 7999, 4457, 7296, 7841, 7394, 7519, 7033 | 10 days | | Visa | All | All | Pre-Auth | 5542 | 2 hours | Capturing Visa payments after the authorization validity period may result in [capture failures](https://docs.adyen.com/online-payments/capture/failure-reasons/#capture-cant-be-recaptured) and processing integrity fees. Capturing Visa cardholder-initiated card-not-present transactions (CIT CnP) after the 10-day validity period may also incur an additional Extended Authorisation scheme fee, depending on regional requirements. []()1 Visa's "Extended-Auth" feature is currently available only in pilot. If you would like to pilot this feature and provide feedback, reach out to your Adyen point of contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other). ## See also * [Manual capture](/point-of-sale/capturing-payments#manual-capture) * [Shopper recognition](/point-of-sale/shopper-recognition) * [Webhooks](/development-resources/webhooks)