{"title":"Optional server configuration","category":"default","creationDate":1781186417,"content":"<p>You can add configuration to your payment server for additional functionality.<\/p>\n<ul>\n<li><a href=\"#update-the-payment-amount-of-the-session\">Update the payment amount of the session<\/a><\/li>\n<li><a href=\"#get-session-result-server\">Get the result of the payment session on your payment server<\/a><\/li>\n<\/ul>\n<h2 id=\"update-the-payment-amount-of-the-session\">Update the payment amount of the session<\/h2>\n<p>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.<\/p>\n<h3>Create a session<\/h3>\n<p>To enable updating the payment amount of a session, you must indicate it when you create the session.<\/p>\n<ol>\n<li>\n<p>When you <a href=\"\/online-payments\/build-your-integration\/sessions-flow\/#create-payment-session\">create a session<\/a>, additionally include:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Parameter<\/th>\n<th style=\"text-align: left;\">Required<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>payable<\/code><\/td>\n<td style=\"text-align: left;\"><span class=\"hint--bottom\" data-hint=\"Required\" markdown=\"1\"><img style=\"width: 25px;\" alt=\"Required\" src=\"\/user\/pages\/reuse\/image-library\/01.icons\/required\/required.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/span><\/td>\n<td style=\"text-align: left;\">Indicates if the session is ready for the shopper to submit the payment. <br> Set to <strong>false<\/strong>: Indicates that the session is not yet ready for the shopper to submit the payment, so the payment amount can be updated.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Example request to create a session that can be updated'\" :id=\"'create-session'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v72\\\/sessions \\\\\\n-X POST \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n  \\&quot;merchantAccount\\&quot;: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;value\\&quot;: 1900,\\n    \\&quot;currency\\&quot;: \\&quot;EUR\\&quot;\\n  },\\n  \\&quot;returnUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  \\&quot;reference\\&quot;: \\&quot;Your-payment-reference-123-abc\\&quot;,\\n  \\&quot;deliverAt\\&quot;: \\&quot;2026-07-30\\&quot;,\\n  \\&quot;countryCode\\&quot;: \\&quot;NL\\&quot;,\\n  \\&quot;payable\\&quot;: false\\n}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Confirm that the response includes <code>payable<\/code>: <strong>false<\/strong>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Example response that indicates that the session can be updated'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"amount\\\": {\\n        \\\"value\\\": 1900,\\n        \\\"currency\\\": \\\"EUR\\\"\\n    },\\n    \\\"countryCode\\\": \\\"NL\\\",\\n    \\\"deliverAt\\\": \\\"2026-07-30T02:00:00+02:00\\\",\\n    \\\"expiresAt\\\": \\\"2026-03-31T13:57:48+02:00\\\",\\n    \\\"id\\\": \\\"QFQTPCQ8HXSKGK82\\\",\\n    \\\"merchantAccount\\\": \\\"ADYEN_MERCHANT_ACCOUNT\\\",\\n    \\\"payable\\\": false,\\n    \\\"reference\\\": \\\"Your-payment-reference-123-abc\\\",\\n    \\\"returnUrl\\\": \\\"https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\\",\\n    \\\"shopperLocale\\\": \\\"nl-NL\\\",\\n    \\\"sessionData\\\": \\\"Ab02b4c..\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h3>Update the session amount<\/h3>\n<p>To update the payment amount, make a PATCH <code>\/sessions\/{sessionId}<\/code> request, including:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>sessionId<\/code> <br> <strong>Path parameter<\/strong><\/td>\n<td style=\"text-align: center;\"><span class=\"hint--bottom\" data-hint=\"Required\" markdown=\"1\"><img style=\"width: 25px;\" alt=\"Required\" src=\"\/user\/pages\/reuse\/image-library\/01.icons\/required\/required.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/span><\/td>\n<td style=\"text-align: left;\">The ID of the session to update.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>sessionData<\/code><\/td>\n<td style=\"text-align: center;\"><span class=\"hint--bottom\" data-hint=\"Required\" markdown=\"1\"><img style=\"width: 25px;\" alt=\"Required\" src=\"\/user\/pages\/reuse\/image-library\/01.icons\/required\/required.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/span><\/td>\n<td style=\"text-align: left;\">The encoded session data from the original  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/sessions\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/sessions<\/a> response.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>amount.value<\/code><\/td>\n<td style=\"text-align: center;\"><span class=\"hint--bottom\" data-hint=\"Required\" markdown=\"1\"><img style=\"width: 25px;\" alt=\"Required\" src=\"\/user\/pages\/reuse\/image-library\/01.icons\/required\/required.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/span><\/td>\n<td style=\"text-align: left;\">The updated amount in <a href=\"\/development-resources\/currency-codes\">minor units<\/a>.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>amount.currency<\/code><\/td>\n<td style=\"text-align: center;\"><span class=\"hint--bottom\" data-hint=\"Required\" markdown=\"1\"><img style=\"width: 25px;\" alt=\"Required\" src=\"\/user\/pages\/reuse\/image-library\/01.icons\/required\/required.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/span><\/td>\n<td style=\"text-align: left;\">The three-character <a href=\"\/development-resources\/currency-codes\">ISO currency code<\/a>.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>payable<\/code><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: left;\">If you know that the amount in this request is the final amount, set to <strong>true<\/strong>. This indicates that the session is ready for payment. When you set this to true, you can no longer update the session. <br> If you set to <strong>false<\/strong>, you must make another request to update the session and set to <strong>true<\/strong> before the shopper can submit the payment.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Example request to update the session amount'\" :id=\"'update-session'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v72\\\/sessions\\\/QFQTPCQ8HXSKGK82 \\\\\\n-X PATCH \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n  \\&quot;sessionData\\&quot;: \\&quot;Ab02b4c...\\&quot;,\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;value\\&quot;: 10000,\\n    \\&quot;currency\\&quot;: \\&quot;EUR\\&quot;\\n  },\\n  \\&quot;payable\\&quot;: true\\n}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<div class=\"notices yellow\">\n<p>After you set <code>payable<\/code> to <strong>true<\/strong>, you cannot update the session again. Only set this when you confirm the final amount, and the session is ready for payment.<\/p>\n<\/div>\n<p>The response includes the updated session data.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Example response with updated session data'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"sessionData\\\": \\\"Ab02b4c..\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h3>Update the amount in Drop-in<\/h3>\n<p>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.<\/p>\n<h3>Show the updated amount to the shopper<\/h3>\n<p>To show the updated amount in the payment form:<\/p>\n<p>From your <a href=\"\/online-payments\/build-your-integration\/sessions-flow\/#configure\">instance of <code>AdyenCheckout<\/code><\/a>, call the <code>update<\/code> function and pass the new amount.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Example to update the amount in the payment form'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;\\\/\\\/ Create an amount object for the updated amount.\\nconst amount = { value: 1000, currency: 'USD' };\\n\\\/\\\/ Update the amount in the payment form, specifying not to reinitialize the checkout instance.\\nyourAdyenCheckout.update({ amount }, { shouldReinitializeCheckout: false });&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h3>Update the server-side session data before payment<\/h3>\n<p>When you confirm the final amount, you must update the server-side session data with the amount before the shopper submits the payment.<\/p>\n<ol>\n<li>Trigger the <code>beforeSubmit<\/code> callback from your instance of <code>AdyenCheckout<\/code> to make a PATCH <code>\/sessions\/{sessionId}<\/code> request to update the session from your server.<\/li>\n<li>\n<p>The session patching request returns an updated <code>sessionData<\/code> object. Add it to the <code>actions.resolve<\/code> method, to pass it to Drop-in.<\/p>\n<div class=\"notices yellow\">\n<p>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.<\/p>\n<\/div>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Example of the beforeSubmit callback to update the session'\" :id=\"''\" :code-data='[{\"language\":\"ts\",\"tabTitle\":\"\",\"content\":\"const yourAdyenCheckout = await AdyenCheckout({ \\n  beforeSubmit: async (data, component, actions) =&gt; {\\n    try {\\n      \\\/\\\/ Get the latest session data from Drop-in.\\n      const { session } = component.core.session;\\n      \\\/\\\/ Make an PATCH \\\/sessions\\\/{sessionId} request to update the session.\\n      const updatedSessionData = await patchSession(session);\\n      \\\/\\\/ Add the updated session data to actions.resolve.\\n      actions.resolve({ ...data, sessionData: updatedSessionData });\\n    } catch (error) {\\n      actions.reject();\\n    }\\n  },\\n  \\\/\\\/ ...Other configuration properties\\n});\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"get-session-result-server\">Get the result of the payment session on your payment server<\/h2>\n<p>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. <\/p>\n<ol>\n<li>Get the <code>id<\/code> from the <a href=\"\/standard\/integration\/drop-in\/default#sessions-response\"><code>\/sessions<\/code> response<\/a>.<\/li>\n<li>Get <code>sessionResult<\/code> from the <code>onPaymentCompleted<\/code> or <code>onPaymentFailed<\/code> event.<\/li>\n<li>\n<p>Make a <strong>GET<\/strong> <code>\/sessions\/{id}?sessionResult={sessionResult}<\/code> request including the <code>id<\/code> and <code>sessionResult<\/code>. For example:<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Request for result of payment session'\" :id=\"'request-for-result-of-payment-session-7620001016'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl -X GET https:\\\/\\\/checkout-test.adyen.com\\\/v70\\\/sessions\\\/CS12345678?sessionResult=SOME_DATA&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v25.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.service.checkout.*;\\n\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nClient client = new Client(\\&quot;ADYEN_API_KEY\\&quot;, Environment.TEST);\\n\\\/\\\/ Make the API call\\nPaymentsApi service = new PaymentsApi(client);\\nSessionResultResponse response = service.getResultOfPaymentSession(\\&quot;sessionId\\&quot;, \\&quot;String\\&quot;, null);&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen PHP API Library v17.4.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Service\\\\Checkout\\\\PaymentsApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_API_KEY\\&quot;);\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n$requestOptions['queryParams'] = array('sessionResult' =&gt; 'string');\\n\\n\\\/\\\/ Make the API call\\n$service = new PaymentsApi($client);\\n$response = $service-&gt;getResultOfPaymentSession('sessionId', $requestOptions);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v14.4.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Service.Checkout;\\n\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Make the API call\\nvar service = new PaymentsService(client);\\nvar response = service.GetResultOfPaymentSession(\\&quot;sessionId\\&quot;, sessionResult: \\&quot;string\\&quot;);&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nconst { Client, CheckoutAPI } = require('@adyen\\\/api-library');\\n\\\/\\\/ Initialize the client object\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Make the API call\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.getResultOfPaymentSession(\\&quot;sessionId\\&quot;, \\&quot;string\\&quot;);&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v21.0.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v21\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v21\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v21\\\/src\\\/checkout\\&quot;\\n)\\n\\\/\\\/ For the LIVE environment, also include your liveEndpointUrlPrefix.\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Send the request\\nservice := client.Checkout()\\nreq := service.PaymentsApi.GetResultOfPaymentSessionInput(\\&quot;sessionId\\&quot;)\\nreq = req.SessionResult(\\&quot;string\\&quot;)\\nres, httpRes, err := service.PaymentsApi.GetResultOfPaymentSession(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v13.6.0\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;\\&quot;\\n# For the LIVE environment, also include your liveEndpointUrlPrefix.\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\nquery_parameters = {\\n  \\&quot;sessionResult\\&quot; : \\&quot;string\\&quot;\\n}\\n\\n# Send the request\\nresult = adyen.checkout.payments_api.get_result_of_payment_session(sessionId=\\&quot;sessionId\\&quot;, query_parameters=query_parameters)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v9.3.0\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_API_KEY'\\n# For the live environment, additionally include your liveEndpointUrlPrefix.\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nquery_params = {\\n  :sessionResult =&gt; 'string'\\n}\\n\\n# Make the API call\\nresult = adyen.checkout.payments_api.get_result_of_payment_session('sessionId', query_params: query_params)&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nimport { Client, CheckoutAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\\/\\\/ Initialize the client object\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Make the API call\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.getResultOfPaymentSession(\\&quot;sessionId\\&quot;, \\&quot;string\\&quot;);&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response includes the result of the payment session (<code>status<\/code>). For example:<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response with result of the payment session'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n  \\\"additionalData\\\": {\\n    ...\\n  },\\n  \\\"id\\\": \\\"CSD9CAC34EBAE225DD\\\",\\n  \\\"payments\\\": [{\\n    \\\"amount\\\": {\\n      \\\"currency\\\": \\\"EUR\\\",\\n      \\\"value\\\": 1000\\n    },\\n    \\\"paymentMethod\\\": {\\n      \\\"brand\\\": \\\"visa\\\",\\n      \\\"type\\\": \\\"scheme\\\"\\n    },\\n    \\\"pspReference\\\": \\\"TG9SNBJJNXRKDM92\\\",\\n    \\\"resultCode\\\": \\\"Authorised\\\"\\n  }],\\n  \\\"reference\\\": \\\"YOUR_PAYMENT_REFERENCE\\\",\\n  \\\"status\\\": \\\"completed\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/get\/sessions\/(sessionId)#responses-200-additionalData\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">additionalData<\/a> attributes in the response depend on the type of payment made.<\/p>\n<p>Possible statuses:<\/p>\n<table>\n<thead>\n<tr>\n<th><code>status<\/code><\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>completed<\/strong><\/td>\n<td>The shopper completed the payment. This means that the payment was authorized.<\/td>\n<\/tr>\n<tr>\n<td><strong>paymentPending<\/strong><\/td>\n<td>The shopper is in the process of making the payment. This applies to payment methods with an asynchronous flow.<\/td>\n<\/tr>\n<tr>\n<td><strong>canceled<\/strong><\/td>\n<td>The shopper canceled the payment.<\/td>\n<\/tr>\n<tr>\n<td><strong>expired<\/strong><\/td>\n<td>The session expired (default: 1 hour after session creation). Shoppers can no longer complete the payment with this <code>sessionId<\/code>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ol>\n<div class=\"notices green\">\n<p>The <code>status<\/code> 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 <strong>Transactions<\/strong> list in your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>.<\/p>\n<\/div>\n<h2>See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/standard\/integration\/drop-in\/optional-drop-in-configuration\"\n                        target=\"_self\"\n                        >\n                    Drop-in optional configuration\n                <\/a><\/li><li><a href=\"\/standard\/integration\/drop-in\/best-practices\"\n                        target=\"_self\"\n                        >\n                    Best practices\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/standard\/integration\/drop-in\/optional-server-configuration","articleFields":{"description":"Add optional configuration to your payment server."},"algolia":{"url":"https:\/\/docs.adyen.com\/standard\/integration\/drop-in\/optional-server-configuration","title":"Optional server configuration","content":"You can add configuration to your payment server for additional functionality.\n\nUpdate the payment amount of the session\nGet the result of the payment session on your payment server\n\nUpdate the payment amount of the session\nAfter 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.\nCreate a session\nTo enable updating the payment amount of a session, you must indicate it when you create the session.\n\n\nWhen you create a session, additionally include:\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\npayable\n\nIndicates 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.\n\n\n\n\n\n\n\n\nConfirm that the response includes payable: false.\n\n\n\n\n\nUpdate the session amount\nTo update the payment amount, make a PATCH \/sessions\/{sessionId} request, including:\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\nsessionId  Path parameter\n\nThe ID of the session to update.\n\n\nsessionData\n\nThe encoded session data from the original  \/sessions response.\n\n\namount.value\n\nThe updated amount in minor units.\n\n\namount.currency\n\nThe three-character ISO currency code.\n\n\npayable\n\nIf 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.\n\n\n\n\n    \n\n\nAfter 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.\n\nThe response includes the updated session data.\n\n    \n\nUpdate the amount in Drop-in\nUpdate 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.\nShow the updated amount to the shopper\nTo show the updated amount in the payment form:\nFrom your instance of AdyenCheckout, call the update function and pass the new amount.\n\n    \n\nUpdate the server-side session data before payment\nWhen you confirm the final amount, you must update the server-side session data with the amount before the shopper submits the payment.\n\nTrigger the beforeSubmit callback from your instance of AdyenCheckout to make a PATCH \/sessions\/{sessionId} request to update the session from your server.\n\nThe session patching request returns an updated sessionData object. Add it to the actions.resolve method, to pass it to Drop-in.\n\nWhen 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.\n\n\n\n\n\n\nGet the result of the payment session on your payment server\nInstead of only getting the payment result in a webhook message, you can also get the result of the payment session on your payment server. \n\nGet the id from the \/sessions response.\nGet sessionResult from the onPaymentCompleted or onPaymentFailed event.\n\nMake a GET \/sessions\/{id}?sessionResult={sessionResult} request including the id and sessionResult. For example:\n\n\n\nThe response includes the result of the payment session (status). For example:\n\n\n\nThe  additionalData attributes in the response depend on the type of payment made.\nPossible statuses:\n\n\n\nstatus\nDescription\n\n\n\n\ncompleted\nThe shopper completed the payment. This means that the payment was authorized.\n\n\npaymentPending\nThe shopper is in the process of making the payment. This applies to payment methods with an asynchronous flow.\n\n\ncanceled\nThe shopper canceled the payment.\n\n\nexpired\nThe session expired (default: 1 hour after session creation). Shoppers can no longer complete the payment with this sessionId.\n\n\n\n\n\n\nThe 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.\n\nSee also\n\n\n                    Drop-in optional configuration\n                \n                    Best practices\n                \n","type":"page","locale":"en","boost":16,"hierarchy":{"lvl0":"Home","lvl1":"Standard payments integration","lvl2":"Build your integration","lvl3":"Drop-in","lvl4":"Optional server configuration"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/","lvl1":"https:\/\/docs.adyen.com\/standard","lvl2":"https:\/\/docs.adyen.com\/standard\/integration","lvl3":"https:\/\/docs.adyen.com\/standard\/integration\/drop-in","lvl4":"\/standard\/integration\/drop-in\/optional-server-configuration"},"levels":5,"category":"","category_color":"","tags":["Optional","server","configuration"]}}
