--- title: "Optional server configuration" description: "Add optional configuration to your payment server." url: "https://docs.adyen.com/standard/integration/drop-in/optional-server-configuration" source_url: "https://docs.adyen.com/standard/integration/drop-in/optional-server-configuration.md" canonical: "https://docs.adyen.com/standard/integration/drop-in/optional-server-configuration" last_modified: "2026-06-11T16:00:17+02:00" language: "en" --- # Optional server configuration Add optional configuration to your payment server. [View source](/standard/integration/drop-in/optional-server-configuration.md) You can add configuration to your payment server for additional functionality. * [Update the payment amount of the session](#update-the-payment-amount-of-the-session) * [Get the result of the payment session on your payment server](#get-session-result-server) ## Update the payment amount of the session After you create a session, the order amount can change before the shopper submits the payment. For example, the shopper may add or remove items from their cart, or a discount may apply. You can update the session with the new amount so that the shopper pays the correct total. ### Create a session To enable updating the payment amount of a session, you must indicate it when you create the session. 1. When you [create a session](/online-payments/build-your-integration/sessions-flow/#create-payment-session), additionally include: | Parameter | Required | Description | | --------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `payable` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | Indicates if the session is ready for the shopper to submit the payment. Set to **false**: Indicates that the session is not yet ready for the shopper to submit the payment, so the payment amount can be updated. | **Example request to create a session that can be updated** ```bash curl https://checkout-test.adyen.com/v72/sessions \ -X POST \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "value": 1900, "currency": "EUR" }, "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "reference": "Your-payment-reference-123-abc", "deliverAt": "2026-07-30", "countryCode": "NL", "payable": false }' ``` 2. Confirm that the response includes `payable`: **false**. **Example response that indicates that the session can be updated** ```json { "amount": { "value": 1900, "currency": "EUR" }, "countryCode": "NL", "deliverAt": "2026-07-30T02:00:00+02:00", "expiresAt": "2026-03-31T13:57:48+02:00", "id": "QFQTPCQ8HXSKGK82", "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "payable": false, "reference": "Your-payment-reference-123-abc", "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "shopperLocale": "nl-NL", "sessionData": "Ab02b4c.." } ``` ### Update the session amount To update the payment amount, make a PATCH `/sessions/{sessionId}` request, including: | Parameter | Required | Description | | ------------------------------ | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `sessionId` **Path parameter** | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The ID of the session to update. | | `sessionData` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The encoded session data from the original [/sessions](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions) response. | | `amount.value` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The updated amount in [minor units](/development-resources/currency-codes). | | `amount.currency` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The three-character [ISO currency code](/development-resources/currency-codes). | | `payable` | | If you know that the amount in this request is the final amount, set to **true**. This indicates that the session is ready for payment. When you set this to true, you can no longer update the session. If you set to **false**, you must make another request to update the session and set to **true** before the shopper can submit the payment. | **Example request to update the session amount** ```bash curl https://checkout-test.adyen.com/v72/sessions/QFQTPCQ8HXSKGK82 \ -X PATCH \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -d '{ "sessionData": "Ab02b4c...", "amount": { "value": 10000, "currency": "EUR" }, "payable": true }' ``` After you set `payable` to **true**, you cannot update the session again. Only set this when you confirm the final amount, and the session is ready for payment. The response includes the updated session data. **Example response with updated session data** ```json { "sessionData": "Ab02b4c.." } ``` ### Update the amount in Drop-in Update the amount in Drop-in when the payment amount changes (for example, when the shopper adds or removes items from their cart). The amount can be updated multiple times without the need to update the server-side session data every time. The server-side session update is required only before the shopper can submit the payment. ### Show the updated amount to the shopper To show the updated amount in the payment form: From your [instance of `AdyenCheckout`](/online-payments/build-your-integration/sessions-flow/#configure), call the `update` function and pass the new amount. **Example to update the amount in the payment form** ```ts // Create an amount object for the updated amount. const amount = { value: 1000, currency: 'USD' }; // Update the amount in the payment form, specifying not to reinitialize the checkout instance. yourAdyenCheckout.update({ amount }, { shouldReinitializeCheckout: false }); ``` ### Update the server-side session data before payment When you confirm the final amount, you must update the server-side session data with the amount before the shopper submits the payment. 1. Trigger the `beforeSubmit` callback from your instance of `AdyenCheckout` to make a PATCH `/sessions/{sessionId}` request to update the session from your server. 2. The session patching request returns an updated `sessionData` object. Add it to the `actions.resolve` method, to pass it to Drop-in. When you make a request to update the server-side session data, you must store and get the updated amount on your server. Do not get the updated amount from the client. **Example of the beforeSubmit callback to update the session** ```ts const yourAdyenCheckout = await AdyenCheckout({ beforeSubmit: async (data, component, actions) => { try { // Get the latest session data from Drop-in. const { session } = component.core.session; // Make an PATCH /sessions/{sessionId} request to update the session. const updatedSessionData = await patchSession(session); // Add the updated session data to actions.resolve. actions.resolve({ ...data, sessionData: updatedSessionData }); } catch (error) { actions.reject(); } }, // ...Other configuration properties }); ``` ## Get the result of the payment session on your payment server Instead of only getting the payment result in a webhook message, you can also get the result of the payment session on your payment server. 1. Get the `id` from the [`/sessions` response](/standard/integration/drop-in/default#sessions-response). 2. Get `sessionResult` from the `onPaymentCompleted` or `onPaymentFailed` event. 3. Make a **GET** `/sessions/{id}?sessionResult={sessionResult}` request including the `id` and `sessionResult`. For example: **Request for result of payment session** #### curl ```bash curl -X GET https://checkout-test.adyen.com/v70/sessions/CS12345678?sessionResult=SOME_DATA ``` #### Java ```java // Adyen Java API Library v25.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.service.checkout.*; // For the live environment, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Make the API call PaymentsApi service = new PaymentsApi(client); SessionResultResponse response = service.getResultOfPaymentSession("sessionId", "String", null); ``` #### PHP ```php // Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Service\Checkout\PaymentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); $requestOptions['queryParams'] = array('sessionResult' => 'string'); // Make the API call $service = new PaymentsApi($client); $response = $service->getResultOfPaymentSession('sessionId', $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v14.4.0 using Adyen; using Environment = Adyen.Model.Environment; 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); // Make the API call var service = new PaymentsService(client); var response = service.GetResultOfPaymentSession("sessionId", sessionResult: "string"); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.2.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"}); // Make the API call const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.getResultOfPaymentSession("sessionId", "string"); ``` #### Go ```go // Adyen Go API Library v21.0.0 import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "", Environment: common.TestEnv, }) // Send the request service := client.Checkout() req := service.PaymentsApi.GetResultOfPaymentSessionInput("sessionId") req = req.SessionResult("string") res, httpRes, err := service.PaymentsApi.GetResultOfPaymentSession(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v13.6.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. query_parameters = { "sessionResult" : "string" } # Send the request result = adyen.checkout.payments_api.get_result_of_payment_session(sessionId="sessionId", query_parameters=query_parameters) ``` #### Ruby ```rb # Adyen Ruby API Library v9.3.0 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) query_params = { :sessionResult => 'string' } # Make the API call result = adyen.checkout.payments_api.get_result_of_payment_session('sessionId', query_params: query_params) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v16.2.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"}); // Make the API call const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.getResultOfPaymentSession("sessionId", "string"); ``` The response includes the result of the payment session (`status`). For example: **Response with result of the payment session** ```json { "additionalData": { ... }, "id": "CSD9CAC34EBAE225DD", "payments": [{ "amount": { "currency": "EUR", "value": 1000 }, "paymentMethod": { "brand": "visa", "type": "scheme" }, "pspReference": "TG9SNBJJNXRKDM92", "resultCode": "Authorised" }], "reference": "YOUR_PAYMENT_REFERENCE", "status": "completed" } ``` The [additionalData](https://docs.adyen.com/api-explorer/Checkout/latest/get/sessions/\(sessionId\)#responses-200-additionalData) attributes in the response depend on the type of payment made. Possible statuses: | `status` | Description | | ------------------ | -------------------------------------------------------------------------------------------------------------------------------- | | **completed** | The shopper completed the payment. This means that the payment was authorized. | | **paymentPending** | The shopper is in the process of making the payment. This applies to payment methods with an asynchronous flow. | | **canceled** | The shopper canceled the payment. | | **expired** | The session expired (default: 1 hour after session creation). Shoppers can no longer complete the payment with this `sessionId`. | The `status` included in the response doesn't get updated. Do not make the request again to check for payment status updates. Instead, check webhooks or the **Transactions** list in your [Customer Area](https://ca-test.adyen.com/). ## See also * [Drop-in optional configuration](/standard/integration/drop-in/optional-drop-in-configuration) * [Best practices](/standard/integration/drop-in/best-practices)