{"title":"How to get an origin key","category":"default","creationDate":1778252959,"content":"<p>An origin key is a client-side key that is used to validate Adyen's JavaScript component library. It is required for our <a href=\"\/online-payments\/drop-in-web\">Drop-in<\/a> and <a href=\"\/online-payments\/components-web\/\">Component<\/a> integrations.<\/p>\n<div class=\"notices red\">\n<p>The origin key is deprecated, and removed starting <a href=\"\/online-payments\/release-notes#releaseNote=2021-02-25-web-componentsdrop-in-4.0.0\">Web Components 4.0.0<\/a>. <br> <a href=\"\/development-resources\/client-side-authentication\/migrate-from-origin-key-to-client-key\">Switch to using the client key<\/a> for your Web Drop-in or Web Component integration.<\/p>\n<\/div>\n<p>The origin key is linked directly to a combination of three elements:<\/p>\n<ul>\n<li>The account name (either your company or merchant account).<\/li>\n<li>The environment (<em>live<\/em> or <em>test<\/em>).<\/li>\n<li>The website domain where a payment request comes from (including the port).<\/li>\n<\/ul>\n<p>If one or more of these elements change &mdash; such as a change to the protocol, port, or environment &mdash; you will need a different origin key.<\/p>\n<p>For example, if you are initially performing test transactions on your local machine, a domain of <strong>https&#58;\/\/localhost:8080<\/strong>, and you move your tests to a test server on your local network, a domain of <strong>https&#58;\/\/192.168.10.10<\/strong>, you will need need to create a new origin key for this new server.<\/p>\n<p>If you have multiple domains, you can use our <code>\/originKeys<\/code> API call to quickly <a href=\"#generate-multiple-origin-keys\">generate multiple origin keys<\/a>.<\/p>\n<h2 id=\"generate-a-single-origin-key\">Generate a single origin key<\/h2>\n<div class=\"notices red\">\n<p>The origin key is deprecated, and removed starting <a href=\"\/online-payments\/release-notes#releaseNote=2021-02-25-web-componentsdrop-in-4.0.0\">Web Components 4.0.0<\/a>. <br> <a href=\"\/development-resources\/client-side-authentication\/migrate-from-origin-key-to-client-key\">Switch to using the client key<\/a> for your Web Drop-in or Web Component integration.<\/p>\n<\/div>\n<ol>\n<li>\n<p>Log in to your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>.<\/p>\n<\/li>\n<li>\n<p>Navigate to <strong>Developers<\/strong> &gt; <strong>API credentials<\/strong>, and click the user <strong>ws@Company.[YourCompanyAccount]<\/strong>.<\/p>\n<\/li>\n<li>\n<p>Under <strong>Origin key<\/strong>, enter your website's domain, then click <strong>Generate Origin Key<\/strong>.<\/p>\n<p>Use a concatenation of the protocol, host, and port. Do not include subdirectories or a trailing slash. For example,\u00a0<strong>https&#58;\/\/your-company.example.com<\/strong>\u00a0or\u00a0<strong>https&#58;\/\/checkout.your-company.example.com:8080<\/strong>. You can also confirm this by opening the browser console and calling <code>window.location.origin<\/code>.<\/p>\n<\/li>\n<li>\n<p>Copy and safely store the origin key in your system.<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"generate-multiple-origin-keys\">Generate multiple origin keys<\/h2>\n<div class=\"notices red\">\n<p>The origin key is deprecated, and removed starting <a href=\"\/online-payments\/release-notes#releaseNote=2021-02-25-web-componentsdrop-in-4.0.0\">Web Components 4.0.0<\/a>. <br> <a href=\"\/development-resources\/client-side-authentication\/migrate-from-origin-key-to-client-key\">Switch to using the client key<\/a> for your Web Drop-in or Web Component integration.<\/p>\n<\/div>\n<p>If you have many domains, you can use our <code>\/originKeys<\/code> API call to quickly generate multiple origin keys:<\/p>\n<ol>\n<li>\n<p>Make an <code>\/originKeys<\/code> request, specifying:<\/p>\n<ul>\n<li><a href=\"\/development-resources\/api-credentials#generate-api-key\">Your API key<\/a>.<\/li>\n<li><code>originDomains<\/code>: Include each domain that you will use to make payments.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"''\" :id=\"'363494807'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v1\\\/originKeys \\\\\\n-H 'x-api-key: ADYEN_API_KEY\\&quot; \\\\\\n-H 'Content-Type: application\\\/json' \\\\\\n-d '{\\n   \\&quot;originDomains\\&quot;:[\\n      \\&quot;https:\\\/\\\/www.your-company1.com\\&quot;,\\n      \\&quot;https:\\\/\\\/www.your-company2.com\\&quot;,\\n      \\&quot;https:\\\/\\\/www.your-company3.com\\&quot;\\n   ]\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Set your X-API-KEY with the API key from the Customer Area.\\nConfig config = new Config();\\nconfig.setApiKey(\\&quot;Your X-API-KEY\\&quot;));\\nClient client = new Client(config);\\n\\u00a0\\nCheckoutUtility checkoutUtility = new CheckoutUtility(client);\\nOriginKeysRequest originKeysRequest = new OriginKeysRequest();\\noriginKeysRequest.setOriginDomains(new ArrayList&lt;String&gt;(Arrays.asList(\\n    \\&quot;https:\\\/\\\/www.your-company1.com\\&quot;,\\n    \\&quot;https:\\\/\\\/www.your-company2.com\\&quot;,\\n    \\&quot;https:\\\/\\\/www.your-company3.com\\&quot;)\\n));\\nOriginKeysResponse originKeysResponse = checkoutUtility.originKeys(originKeysRequest);&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Set your X-API-KEY with the API key from the Customer Area.\\n$client = new \\\\Adyen\\\\Client();\\n$client-&gt;setXApiKey(\\&quot;YOUR X-API-KEY\\&quot;);\\n$service = new \\\\Adyen\\\\Service\\\\CheckoutUtility($client);\\n\\n$params = array(\\n    \\&quot;originDomains\\&quot; =&gt; array(\\n        \\&quot;https:\\\/\\\/www.your-domain1.com\\&quot;,\\n        \\&quot;https:\\\/\\\/www.your-domain2.com\\&quot;,\\n        \\&quot;https:\\\/\\\/www.your-domain3.com\\&quot;\\n    )\\n);\\n\\n$result = $service-&gt;originKeys($params);&quot;},{&quot;language&quot;:&quot;ruby&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Set your X-API-KEY with the API key from the Customer Area.\\nadyen = Adyen::Client.new\\nadyen.api_key = \\&quot;YOUR X-API-KEY\\&quot;\\n\\nresponse = adyen.checkout_utility.origin_keys({\\n   :originDomains =&gt; [\\n      \\&quot;https:\\\/\\\/www.your-company1.com\\&quot;,\\n      \\&quot;https:\\\/\\\/www.your-company2.com\\&quot;,\\n      \\&quot;https:\\\/\\\/www.your-company3.com\\&quot;\\n   ]\\n})&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The <code>\/originKeys<\/code> response contains a list of origin key for all requested domains. For each list item, the key is the domain, and the value is its associated origin key.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'\/originKeys response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"originKeys\\\":{\\n      \\\"https:\\\/\\\/www.your-company1.com\\\":\\\"pub.v2.99...\\\",\\n      \\\"https:\\\/\\\/www.your-company2.com\\\":\\\"pub.v2.99...\\\",\\n      \\\"https:\\\/\\\/www.your-company3.com\\\":\\\"pub.v2.99...\\\"\\n   }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Copy and safely store the origin keys in your system.<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"see-also\">See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/development-resources\/api-credentials\"\n                        target=\"_self\"\n                        >\n                    How to get the API key\n                <\/a><\/li><li><a href=\"\/online-payments\/drop-in-web\"\n                        target=\"_self\"\n                        >\n                    Drop-in\n                <\/a><\/li><li><a href=\"\/online-payments\/components-web\"\n                        target=\"_self\"\n                        >\n                    Components\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/development-resources\/how-to-get-an-origin-key","articleFields":{"id":"47481345","type":"page","_expandable":{"operations":""},"status":"current","last_edit_on":"13-08-2020 10:00"},"algolia":{"url":"https:\/\/docs.adyen.com\/development-resources\/how-to-get-an-origin-key","title":"How to get an origin key","content":"An origin key is a client-side key that is used to validate Adyen's JavaScript component library. It is required for our Drop-in and Component integrations.\n\nThe origin key is deprecated, and removed starting Web Components 4.0.0.  Switch to using the client key for your Web Drop-in or Web Component integration.\n\nThe origin key is linked directly to a combination of three elements:\n\nThe account name (either your company or merchant account).\nThe environment (live or test).\nThe website domain where a payment request comes from (including the port).\n\nIf one or more of these elements change &mdash; such as a change to the protocol, port, or environment &mdash; you will need a different origin key.\nFor example, if you are initially performing test transactions on your local machine, a domain of https&#58;\/\/localhost:8080, and you move your tests to a test server on your local network, a domain of https&#58;\/\/192.168.10.10, you will need need to create a new origin key for this new server.\nIf you have multiple domains, you can use our \/originKeys API call to quickly generate multiple origin keys.\nGenerate a single origin key\n\nThe origin key is deprecated, and removed starting Web Components 4.0.0.  Switch to using the client key for your Web Drop-in or Web Component integration.\n\n\n\nLog in to your Customer Area.\n\n\nNavigate to Developers &gt; API credentials, and click the user ws@Company.[YourCompanyAccount].\n\n\nUnder Origin key, enter your website's domain, then click Generate Origin Key.\nUse a concatenation of the protocol, host, and port. Do not include subdirectories or a trailing slash. For example,\u00a0https&#58;\/\/your-company.example.com\u00a0or\u00a0https&#58;\/\/checkout.your-company.example.com:8080. You can also confirm this by opening the browser console and calling window.location.origin.\n\n\nCopy and safely store the origin key in your system.\n\n\nGenerate multiple origin keys\n\nThe origin key is deprecated, and removed starting Web Components 4.0.0.  Switch to using the client key for your Web Drop-in or Web Component integration.\n\nIf you have many domains, you can use our \/originKeys API call to quickly generate multiple origin keys:\n\n\nMake an \/originKeys request, specifying:\n\nYour API key.\noriginDomains: Include each domain that you will use to make payments.\n\n\n\n\nThe \/originKeys response contains a list of origin key for all requested domains. For each list item, the key is the domain, and the value is its associated origin key.\n\n\n\n\n\nCopy and safely store the origin keys in your system.\n\n\nSee also\n\n\n                    How to get the API key\n                \n                    Drop-in\n                \n                    Components\n                \n","type":"page","locale":"en","boost":18,"hierarchy":{"lvl0":"Home","lvl1":"Development resources","lvl2":"How to get an origin key"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/","lvl1":"https:\/\/docs.adyen.com\/development-resources","lvl2":"\/development-resources\/how-to-get-an-origin-key"},"levels":3,"category":"Development Resources","category_color":"green","tags":["origin"]}}
