{"title":"Two-step checkout","category":"default","creationDate":1776961627,"content":"<p>In a two-step checkout flow, you redirect your shoppers to an additional page before they pay. This lets your shoppers review their order and payment details after they have filled in their details in your checkout form before they pay. A review page can include details of the payment, shipping method and address, billing information, and other details related to the purchase.<\/p>\n<h2>Requirements<\/h2>\n<p>Before you begin, take into account the following requirements, limitations, and preparations.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Requirement<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><strong>Integration type<\/strong><\/td>\n<td style=\"text-align: left;\">Make sure that you have a <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\">Web Components\/Drop-in integration using the Advanced flow<\/a>.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong><a href=\"\/pt\/development-resources\/api-credentials\/roles\/\">API credential roles<\/a><\/strong><\/td>\n<td style=\"text-align: left;\">Make sure that your API credential has the <strong>Checkout webservice role<\/strong>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>How it works<\/h2>\n<ol>\n<li>On your checkout page, collect the shopper's payment details, and show a custom button that redirects shoppers to an additional order review page.<\/li>\n<li>When the shopper selects the button, store the payment data on your server, and redirect them to a page where they can review their payment and order details.<\/li>\n<li>On the review page, show the information that you want to include, and a <strong>Pay<\/strong> button.<\/li>\n<li>When the shopper selects <strong>Pay<\/strong>, make a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> request using the payment data you stored.<\/li>\n<\/ol>\n<h2>Modify your checkout page<\/h2>\n<p>A two-step checkout flow starts with the same steps as the standard checkout flow. You make a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/paymentMethods<\/a> request to <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Components&amp;version=latest#get-available-payment-methods\">get the available payment methods<\/a>, and present the payment methods and the checkout form with our Web <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Drop-in&amp;version=latest#add\">Drop-in<\/a> or <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Components#add&amp;version=latest\">Components<\/a>.<\/p>\n<p>After the shopper selects a payment method, modify your checkout page to implement a two-step checkout flow.<\/p>\n<ol>\n<li>\n<p>In your <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Drop-in&amp;version=latest#add\">Drop-in<\/a> or <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Components&amp;version=latest#add\">Components<\/a> <code>configuration<\/code> object, set <code>showPayButton<\/code> to <strong>false<\/strong> to hide the default <strong>Pay<\/strong> button.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Hide the default pay button'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;const configuration = {\\n  clientKey: \\&quot;YOUR_CLIENT_KEY\\&quot;,\\n  environment: \\&quot;test\\&quot;,\\n  amount: {\\n    value: 1000,\\n    currency: 'EUR'\\n  },\\n  locale: 'nl-NL',\\n  countryCode: 'NL',\\n  \\\/\\\/ The full \\\/paymentMethods response object from your server. Contains the payment methods configured in your account.\\n  paymentMethodsResponse: paymentMethodsResponse,\\n  showPayButton: false,\\n  \\\/\\\/ Your other configurations...\\n}&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>This hides the default <strong>Pay<\/strong> button that otherwise triggers the <code>onSubmit<\/code> event when payment details are valid, and makes a payment request.<\/p>\n<div class=\"notices green\">\n<p>When configuring Drop-in\/Components for cards, you can <a href=\"#show-additional-information-for-cards\">configure optional events<\/a> that let you show additional information on the review page later.<\/p>\n<\/div>\n<\/li>\n<li>\n<p>On the page where the shopper enters their payment details, show your custom button. Implement your button with a function to:<\/p>\n<ol>\n<li>Validate the shopper input in the payment form.<\/li>\n<li>Store the payment data on your server to use it in your  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> request later.\n<ul>\n<li>For <strong>Drop-in<\/strong>, store the <code>dropin.activePaymentMethod.data<\/code>.<\/li>\n<li>For <strong>Components<\/strong>, store the <code>data<\/code> from the payment method component. For example, store <code>card.data<\/code> for the card component.\n<div class=\"notices yellow\">\n<p>The payment data expires after an hour. If you submit a payment request with it after it expires, the request fails. After the payment data expires, the shopper must repeat the checkout process from the beginning.<\/p>\n<\/div><\/li>\n<\/ul><\/li>\n<li>Redirect the shopper to your review page.<\/li>\n<\/ol>\n<p>The following code sample uses the example function <code>handleGoToReview<\/code> for Drop-in.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Implement the custom function for Drop-in'\" :id=\"''\" :code-data='[{\"language\":\"js\",\"tabTitle\":\"\",\"content\":\"handleGoToReview() {\\n    \\\/\\\/ Validate the shopper input in the payment form.\\n    if (dropin.activePaymentMethod.isValid) {\\n       \\\/\\\/ Store the payment data to use in the \\\/payments request.\\n       setPaymentData(dropin.activePaymentMethod.data);\\n       \\\/\\\/ Redirect your shopper to your review page.\\n       showReviewPage();\\n    } else {\\n       \\\/\\\/ If the payment method details are invalid, trigger the validation to focus on the missing field.\\n       dropin.activePaymentMethod.showValidation();\\n   }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>In your <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Drop-in&amp;version=latest#add\">Drop-in<\/a> or <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Components&amp;version=latest#add\">Components<\/a> <code>configuration<\/code> object, call your custom function from the <code>onEnterKeyPressed<\/code> callback.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Call your custom function '\" :id=\"''\" :code-data='[{\"language\":\"js\",\"tabTitle\":\"\",\"content\":\"const configuration = {\\n  \\\/\\\/ Your other Drop-in and Components configurations.\\n  showPayButton: false,\\n  onEnterKeyPressed: () =&gt; {\\n       this.handleGoToReview();\\n  }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2>Implement a review page<\/h2>\n<ol>\n<li>\n<p>On the review page, create a new instance of checkout.<\/p>\n<ul>\n<li>Only if you use <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Drop-in&amp;version=6.0.0#add\">Web Drop-in v6 or later, and import Drop-in with individual payment methods<\/a>, you need to register the payment methods used in the Drop-in.\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Register the payment methods for Drop-in'\" :id=\"''\" :code-data='[{\"language\":\"js\",\"tabTitle\":\"\",\"content\":\"checkoutRef.current.register([Card]);\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div><\/li>\n<\/ul>\n<\/li>\n<li>\n<p>When the shopper selects the <strong>Pay<\/strong> button on your review page, make a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> request. Use the payment data you stored.<\/p>\n<\/li>\n<li>\n<p>Handle the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> response. Implement logic to handle the response with and without the <code>action<\/code> object.<\/p>\n<table>\n<thead>\n<tr>\n<th>Response<\/th>\n<th>Description<\/th>\n<th>Next steps<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Without <code>action<\/code> object<\/td>\n<td>No additional steps are needed to complete the payment.<\/td>\n<td>1. Handle the final state. <br> 2. Get the payment outcome with your <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Components&amp;version=latest#get-the-payment-outcome\">Components<\/a> or <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Drop-in&amp;version=latest#get-the-payment-outcome\">Drop-in<\/a> integration.<\/td>\n<\/tr>\n<tr>\n<td>With <code>action<\/code> object<\/td>\n<td>The shopper needs to do additional actions to complete the payment.<\/td>\n<td>1. Perform additional front-end actions with your <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Drop-in&amp;version=latest#additional-action\">Drop-in<\/a> or <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Components&amp;version=latest#additional-action\">Components<\/a> integration. <br> 2. Get the payment outcome with your <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Components&amp;version=latest#get-the-payment-outcome\">Components<\/a> or <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=Drop-in&amp;version=latest#get-the-payment-outcome\">Drop-in<\/a> integration.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Handle the \/payments response'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;function handleResponse({ action, resultCode, pspReference }) {\\n    if (action) {\\n        checkout.createFromAction(action).mount('.payment-method');\\n    } else {\\n        handleFinalState(resultCode, pspReference);\\n    }\\n}&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2>Show additional information for cards<\/h2>\n<p>For card payments, you can show additional information on the review page using <a href=\"\/pt\/payment-methods\/cards\/web-component\/#optional-configuration\">card component<\/a> events.<\/p>\n<p>When configuring Drop-in\/Components, you can optionally configure the following events that allow you to show additional information on the review page.<\/p>\n<table>\n<thead>\n<tr>\n<th>Event<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>onBrand<\/code><\/td>\n<td>Called when Drop-in\/Component detects the card brand. Use this event to show the card brand on your review page.<\/td>\n<\/tr>\n<tr>\n<td><code>onFieldValid<\/code><\/td>\n<td>Called when the input in a field becomes valid and also if the input changes and becomes invalid. For the card number field, it returns the <code>endDigits<\/code> field that contains the last 4 digits of the card number. Use this event to show the card end digits on your review page.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>See also<\/h2>\n<ul>\n<li><a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\">Advanced flow integration guide<\/a><\/li>\n<\/ul>","url":"https:\/\/docs.adyen.com\/pt\/online-payments\/two-step-checkout","articleFields":{"description":"Add a payment review page in your checkout flow.","feedback_component":true,"filters_component":false,"page_id":"824b32ac-19d2-47e4-9f52-f1c846099318","decision_tree":"[]"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/online-payments\/two-step-checkout","title":"Two-step checkout","content":"In a two-step checkout flow, you redirect your shoppers to an additional page before they pay. This lets your shoppers review their order and payment details after they have filled in their details in your checkout form before they pay. A review page can include details of the payment, shipping method and address, billing information, and other details related to the purchase.\nRequirements\nBefore you begin, take into account the following requirements, limitations, and preparations.\n\n\n\nRequirement\nDescription\n\n\n\n\nIntegration type\nMake sure that you have a Web Components\/Drop-in integration using the Advanced flow.\n\n\nAPI credential roles\nMake sure that your API credential has the Checkout webservice role.\n\n\n\nHow it works\n\nOn your checkout page, collect the shopper's payment details, and show a custom button that redirects shoppers to an additional order review page.\nWhen the shopper selects the button, store the payment data on your server, and redirect them to a page where they can review their payment and order details.\nOn the review page, show the information that you want to include, and a Pay button.\nWhen the shopper selects Pay, make a  \/payments request using the payment data you stored.\n\nModify your checkout page\nA two-step checkout flow starts with the same steps as the standard checkout flow. You make a  \/paymentMethods request to get the available payment methods, and present the payment methods and the checkout form with our Web Drop-in or Components.\nAfter the shopper selects a payment method, modify your checkout page to implement a two-step checkout flow.\n\n\nIn your Drop-in or Components configuration object, set showPayButton to false to hide the default Pay button.\n\n\n\nThis hides the default Pay button that otherwise triggers the onSubmit event when payment details are valid, and makes a payment request.\n\nWhen configuring Drop-in\/Components for cards, you can configure optional events that let you show additional information on the review page later.\n\n\n\nOn the page where the shopper enters their payment details, show your custom button. Implement your button with a function to:\n\nValidate the shopper input in the payment form.\nStore the payment data on your server to use it in your  \/payments request later.\n\nFor Drop-in, store the dropin.activePaymentMethod.data.\nFor Components, store the data from the payment method component. For example, store card.data for the card component.\n\nThe payment data expires after an hour. If you submit a payment request with it after it expires, the request fails. After the payment data expires, the shopper must repeat the checkout process from the beginning.\n\n\nRedirect the shopper to your review page.\n\nThe following code sample uses the example function handleGoToReview for Drop-in.\n\n\n\n\n\nIn your Drop-in or Components configuration object, call your custom function from the onEnterKeyPressed callback.\n\n\n\n\n\nImplement a review page\n\n\nOn the review page, create a new instance of checkout.\n\nOnly if you use Web Drop-in v6 or later, and import Drop-in with individual payment methods, you need to register the payment methods used in the Drop-in.\n\n\n\n\n\n\nWhen the shopper selects the Pay button on your review page, make a  \/payments request. Use the payment data you stored.\n\n\nHandle the  \/payments response. Implement logic to handle the response with and without the action object.\n\n\n\nResponse\nDescription\nNext steps\n\n\n\n\nWithout action object\nNo additional steps are needed to complete the payment.\n1. Handle the final state.  2. Get the payment outcome with your Components or Drop-in integration.\n\n\nWith action object\nThe shopper needs to do additional actions to complete the payment.\n1. Perform additional front-end actions with your Drop-in or Components integration.  2. Get the payment outcome with your Components or Drop-in integration.\n\n\n\n\n\n\n\n\nShow additional information for cards\nFor card payments, you can show additional information on the review page using card component events.\nWhen configuring Drop-in\/Components, you can optionally configure the following events that allow you to show additional information on the review page.\n\n\n\nEvent\nDescription\n\n\n\n\nonBrand\nCalled when Drop-in\/Component detects the card brand. Use this event to show the card brand on your review page.\n\n\nonFieldValid\nCalled when the input in a field becomes valid and also if the input changes and becomes invalid. For the card number field, it returns the endDigits field that contains the last 4 digits of the card number. Use this event to show the card end digits on your review page.\n\n\n\nSee also\n\nAdvanced flow integration guide\n","type":"page","locale":"pt","boost":18,"hierarchy":{"lvl0":"Home","lvl1":"Online payments","lvl2":"Two-step checkout"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/online-payments","lvl2":"\/pt\/online-payments\/two-step-checkout"},"levels":3,"category":"Online Payments","category_color":"green","tags":["Two-step","checkout"]}}
