{"title":"Classic API integration","category":"default","creationDate":1776961627,"content":"<div class=\"sc-notice warning\"><div>\n<p><strong>Adyen is no longer developing the Classic API integration<\/strong><\/p>\n<p>This page is for the Classic API (<code>\/authorise<\/code>) integration, which we no longer accept new integrations with. <\/p>\n<p>We strongly recommend migrating to the newer <a href=\"\/online-payments\/build-your-integration\/advanced-flow?platform=Web\">Web Drop-in and Components<\/a> integration. To use this newer integration, you must also <a href=\"\/pt\/online-payments\/upgrade-your-integration\/migrate-to-checkout-api\">migrate to the Checkout API<\/a>.<\/p>\n<\/div><\/div>\n<div class=\"additional-info-block output-inline\">\n<div class=\"additional-info-block__body\"><p><strong>Local payment methods<\/strong><\/p><p>If you want to learn how to accept local payment methods, see <a href=\"\/pt\/online-payments\/classic-integrations\/hosted-payment-pages\/directory-lookup\">Directory Lookup<\/a>.<\/p><\/div><\/div>\n\n<p>The Classic API integration lets you accept payments on your website and mobile application, if you support <a href=\"\/pt\/development-resources\/pci-dss-compliance-guide\">PCI compliance at Level 1 or 2<\/a>. This tutorial explains how you can collect raw card data from your shoppers and pass this data in payment requests to the Adyen API.<\/p>\n<p>When you want to reduce your PCI compliance requirements, we recommend that you integrate with our <a href=\"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/client-side-encryption\">Client-Side Encryption<\/a> library instead.<\/p>\n<h2 id=\"before-you-begin\">Requirements<\/h2>\n<p>Before you begin to integrate, make sure you have followed the <a href=\"\/pt\/get-started-with-adyen\">Get started with Adyen guide<\/a> to:<\/p>\n<ul>\n<li>Get an overview of the steps needed to accept live payments.<\/li>\n<li>Create your test account.<\/li>\n<\/ul>\n<p>After you have created your test account, get your <a href=\"\/pt\/development-resources\/api-credentials#generate-api-key\">API key<\/a> or <a href=\"\/pt\/development-resources\/api-credentials#basic-authentication\">basic authentication<\/a> credentials. Save a copy as you'll need it for API calls you make to the Adyen payments platform.<\/p>\n<h2 id=\"overview\">Overview<\/h2>\n<p>Your card payments go through many stages. The diagram below helps you understand the flow:<\/p>\n<p><img alt=\"\" src=\"\/user\/pages\/docs\/02.online-payments\/60.classic-integrations\/01.classic-api-integration\/cards-flow-api.png\" \/><\/p>\n<div class=\"sc-notice info\"><div>\n<p>If you are integrating the plataforma de pagamentos da Adyen of products and services with a third-party system, we strongly recommend you follow <a href=\"https:\/\/en.wikipedia.org\/wiki\/Defensive_programming\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">defensive programming<\/a> best practices.<\/p>\n<\/div><\/div>\n<h2 id=\"authorise-request\">Authorise request<\/h2>\n<div class=\"additional-info-block output-inline\">\n<div class=\"additional-info-block__body\"><p><strong>Test cards<\/strong><\/p><p>To test the payment request, use one of our <a href=\"\/pt\/development-resources\/test-cards-and-credentials\/test-card-numbers\">test credit cards<\/a>.<\/p><\/div><\/div>\n\n<p>From your server, make an HTTP POST request to the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/latest\/post\/authorise\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise<\/a> endpoint.<\/p>\n<p>In this request, include  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/latest\/post\/authorise#request-merchantAccount\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">merchantAccount<\/a>,  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/latest\/post\/authorise#request-reference\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">reference<\/a>, and the payment  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/latest\/post\/authorise#request-amount\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">amount<\/a>. The amount's value is in minor units, e.g. 20000 is 200 euros. You can find the number of decimal points per currency in <a href=\"\/pt\/development-resources\/currency-codes\">Currency codes<\/a>.<\/p>\n<p>In addition, include card information, as shown in the example below.<\/p>\n<pre><code class=\"language-json\">{\n  \"card\": {\n    \"number\": \"4111111111111111\",\n    \"expiryMonth\": \"03\",\n    \"expiryYear\": \"2030\",\n    \"cvc\": \"737\",\n    \"holderName\": \"John Smith\"\n  },\n  \"amount\": {\n    \"value\": 1500,\n    \"currency\": \"EUR\"\n  },\n  \"reference\": \"payment-2016-9-4-11\",\n  \"merchantAccount\": \"NewCoCOM\"\n}<\/code><\/pre>\n<p>To know more about the required fields see <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/latest\/post\/authorise#request\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">PaymentRequest<\/a>.<\/p>\n<h2 id=\"authorise-response\">Authorise response<\/h2>\n<p>If the message passes validation, the system performs a risk analysis. Depending on the outcome, the system attempts an authorisation and you receive a payment response. The response includes a PSP reference, which uniquely identifies each payment and can be used later for cancel\/refund if needed.<\/p>\n<pre><code class=\"language-json\">{\n  \"pspReference\": \"8814689190961342\",\n  \"resultCode\": \"Authorised\",\n  \"authCode\": \"83152\"\n}<\/code><\/pre>\n<p>For other possible response codes and fields of the payment response, refer to <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/68\/post\/authorise#responses\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">PaymentResult<\/a>.<\/p>\n<h2 id=\"requirements-for-co-badged-cards\">Requirements for co-badged cards<\/h2>\n<p><a href=\"\/pt\/online-payments\/co-badged-cards-compliance\">Regulatory guidelines for some regions<\/a> require the following:<\/p>\n<ul>\n<li>When a shopper presents a co-badged card, they must be allowed to select their preferred brand.<\/li>\n<li>If the shopper selected a preferred brand, the payment must be completed with this brand.<\/li>\n<\/ul>\n<p>To comply with these guidelines:<\/p>\n<ol>\n<li>If a card is co-badged, present all supported brands to the shopper, allowing them to click on the brand they want to pay with.<\/li>\n<li>If the shopper makes a choice, pass their selected brand as  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/latest\/post\/authorise#request-selectedBrand\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">selectedBrand<\/a> in your  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Payment\/latest\/post\/authorise\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise<\/a> request.<\/li>\n<\/ol>","url":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration","articleFields":{"next_steps":[{"title":"Capture a payment","description":"Capture approved authorisation when it is necessary to complete the payment.","url":"\/online-payments\/capture","required":true},{"title":"Set up webhooks","description":"Receive confirmation when a payment is authorised or fails.","url":"\/development-resources\/webhooks","required":true}],"id":"24216170","type":"page","_expandable":{"operations":""},"status":"current","robots":"noindex,nofollow","sitemap":{"priority":0.1},"parameters":{"anchor_new":"<a href=\"\/online-payments\/build-your-integration\/advanced-flow?platform=Web\">Web Drop-in and Components<\/a>","parent_page":"Classic API (<code>\/authorise<\/code>)"}},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration","title":"Classic API integration","content":"\nAdyen is no longer developing the Classic API integration\nThis page is for the Classic API (\/authorise) integration, which we no longer accept new integrations with. \nWe strongly recommend migrating to the newer Web Drop-in and Components integration. To use this newer integration, you must also migrate to the Checkout API.\n\n\nLocal payment methodsIf you want to learn how to accept local payment methods, see Directory Lookup.\n\nThe Classic API integration lets you accept payments on your website and mobile application, if you support PCI compliance at Level 1 or 2. This tutorial explains how you can collect raw card data from your shoppers and pass this data in payment requests to the Adyen API.\nWhen you want to reduce your PCI compliance requirements, we recommend that you integrate with our Client-Side Encryption library instead.\nRequirements\nBefore you begin to integrate, make sure you have followed the Get started with Adyen guide to:\n\nGet an overview of the steps needed to accept live payments.\nCreate your test account.\n\nAfter you have created your test account, get your API key or basic authentication credentials. Save a copy as you'll need it for API calls you make to the Adyen payments platform.\nOverview\nYour card payments go through many stages. The diagram below helps you understand the flow:\n\n\nIf you are integrating the plataforma de pagamentos da Adyen of products and services with a third-party system, we strongly recommend you follow defensive programming best practices.\n\nAuthorise request\n\nTest cardsTo test the payment request, use one of our test credit cards.\n\nFrom your server, make an HTTP POST request to the  \/authorise endpoint.\nIn this request, include  merchantAccount,  reference, and the payment  amount. The amount's value is in minor units, e.g. 20000 is 200 euros. You can find the number of decimal points per currency in Currency codes.\nIn addition, include card information, as shown in the example below.\n{\n  \"card\": {\n    \"number\": \"4111111111111111\",\n    \"expiryMonth\": \"03\",\n    \"expiryYear\": \"2030\",\n    \"cvc\": \"737\",\n    \"holderName\": \"John Smith\"\n  },\n  \"amount\": {\n    \"value\": 1500,\n    \"currency\": \"EUR\"\n  },\n  \"reference\": \"payment-2016-9-4-11\",\n  \"merchantAccount\": \"NewCoCOM\"\n}\nTo know more about the required fields see PaymentRequest.\nAuthorise response\nIf the message passes validation, the system performs a risk analysis. Depending on the outcome, the system attempts an authorisation and you receive a payment response. The response includes a PSP reference, which uniquely identifies each payment and can be used later for cancel\/refund if needed.\n{\n  \"pspReference\": \"8814689190961342\",\n  \"resultCode\": \"Authorised\",\n  \"authCode\": \"83152\"\n}\nFor other possible response codes and fields of the payment response, refer to PaymentResult.\nRequirements for co-badged cards\nRegulatory guidelines for some regions require the following:\n\nWhen a shopper presents a co-badged card, they must be allowed to select their preferred brand.\nIf the shopper selected a preferred brand, the payment must be completed with this brand.\n\nTo comply with these guidelines:\n\nIf a card is co-badged, present all supported brands to the shopper, allowing them to click on the brand they want to pay with.\nIf the shopper makes a choice, pass their selected brand as  selectedBrand in your  \/authorise request.\n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Online payments","lvl2":"Classic integrations for Ecommerce","lvl3":"Classic API integration"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/online-payments","lvl2":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations","lvl3":"\/pt\/online-payments\/classic-integrations\/classic-api-integration"},"levels":4,"category":"Online Payments","category_color":"green","tags":["Classic","integration"]},"articleFiles":{"cards-flow-api.png":"<img alt=\"\" src=\"https:\/\/docs.adyen.com\/user\/pages\/docs\/02.online-payments\/60.classic-integrations\/01.classic-api-integration\/cards-flow-api.png\" \/>"}}
