{"title":"Apple Pay for API only","category":"default","creationDate":1567783140,"content":"<p>Accept Apple Pay payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.<\/p>\n<div class=\"notices yellow\">\n<p>Adyen does not currently support China UnionPay cards when using Apple Pay. You cannot send the <a href=\"https:\/\/developer.apple.com\/documentation\/apple_pay_on_the_web\/applepaypaymentrequest\/1916123-merchantcapabilities\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">merchantCapability<\/a> \"supportsEMV\" in your Apple Pay integration.<\/p>\n<\/div>\n<h2>Requirements<\/h2>\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 built an Advanced flow <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow?platform=Web&amp;integration=API%20only\">API-only integration<\/a>.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong><a href=\"\/pt\/account\/user-roles\">Customer Area roles<\/a><\/strong><\/td>\n<td style=\"text-align: left;\"><strong>Change payment methods<\/strong> <a href=\"\/pt\/development-resources\/api-credentials\/roles\/#management-api\">role<\/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;\">To <a href=\"#going-live\">process live Apple Pay payments<\/a> make sure that you have the following role <ul><li markdown=\"1\"><strong>API Clientside Encryption Payments role<\/strong>.<\/li><\/ul><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Setup steps<\/strong><\/td>\n<td style=\"text-align: left;\">Before you begin, make sure that you have: <ul><li markdown=\"1\">Set up Apple Pay with your own or Adyen's <a href=\"\/pt\/payment-methods\/apple-pay\/apple-pay-certificate\">Apple Pay certificate<\/a>. <br> You can use Adyen's Apple Pay certificate if you have a web integration, which makes it quicker to set up Apple Pay. If you have a mobile integration, use your own Apple Developer account and certificate which requires extra configuration steps.<\/li><li markdown=\"1\"><a href=\"\/pt\/payment-methods\/add-payment-methods\">Added Apple Pay in your Customer Area<\/a>.<\/li><li>Read the Apple Pay documentation to learn about how you can offer Apple Pay on the <a href=\"https:\/\/developer.apple.com\/documentation\/apple_pay_on_the_web\/apple_pay_js_api\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">web<\/a>, or in your <a href=\"https:\/\/developer.apple.com\/documentation\/passkit\/offering-apple-pay-in-your-app\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">mobile app<\/a>. <\/ul><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Build your payment form for Apple Pay<\/h2>\n<p>After you have finished setting up Apple Pay, you can show Apple Pay as an available payment method in <a href=\"https:\/\/www.adyen.com\/payment-methods#pmx=apple-pay\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">countries\/regions where Apple Pay is supported<\/a>. You can <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=API%20only#downloading-logos\">download logos<\/a> for Apple Pay which you can use on your payment form.<\/p>\n<p>When the shopper selects Apple Pay, they are presented with a prompt to verify the payment using Touch ID or Face ID. If the shopper is using a Mac without Touch ID, they will be prompted to verify the payment using an iPhone or Apple Watch registered to the same iCloud account.<\/p>\n<ol>\n<li>\n<p>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, specifying:<\/p>\n<ul>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">countryCode<\/a>&#58; Countries\/regions where Apple Pay is supported. For example, <span translate=\"no\"><strong>NL<\/strong><\/span>.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods#request-amount\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">amount.currency<\/a>&#58; Any supported currency. For example, <span translate=\"no\"><strong>EUR<\/strong><\/span>.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods#request-channel\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">channel<\/a>&#58; Set this to\u00a0<span translate=\"no\"><strong>Web<\/strong><\/span>\u00a0if the payment is being initiated from Safari, or\u00a0<span translate=\"no\"><strong>iOS<\/strong><\/span>\u00a0for in-app payments.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>In the response, you receive:<\/p>\n<ul>\n<li><code>type<\/code>: <span translate=\"no\"><strong>applepay<\/strong><\/span>.<\/li>\n<li><code>merchantId<\/code> and <code>merchantName<\/code>: If you use Adyen's Apple Pay certificate, you need these details in the next step to <a href=\"\/pt\/payment-methods\/apple-pay\/api-only?tab=adyen-certificate-validation_1\">complete the Apple Pay session validation<\/a>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<pre><code class=\"language-json\">{\n  \"paymentMethods\": [\n    ...\n    {\n        \"brands\": [\n            \"amex\",\n            \"mc\"\n        ],\n        \"configuration\": {\n            \"merchantId\": \"com.test.merchant\",\n            \"merchantName\": \"Your Store\"\n        },\n        \"details\": [\n            {\n                \"key\": \"applepay.token\",\n                \"type\": \"applePayToken\"\n            }\n        ],\n        \"name\": \"Apple Pay\",\n        \"type\": \"applepay\"\n    },\n    ...\n  ]\n}<\/code><\/pre>\n<h2 id=\"complete-apple-pay-session-validation\">Complete the Apple Pay session validation<\/h2>\n<div class=\"notices yellow\">\n<p>This step is only required for web integrations. You do not need to complete the Apple Pay session validation for in-app payments.<\/p>\n<\/div>\n<p>When the shopper selects to pay with Apple Pay, you get the <a href=\"https:\/\/developer.apple.com\/documentation\/apple_pay_on_the_web\/applepaysession\/1778021-onvalidatemerchant\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">\n  <code>onvalidatemerchant<\/code>\n<\/a> event handler. You then need to complete the Apple Pay session validation using the <a href=\"https:\/\/developer.apple.com\/documentation\/apple_pay_on_the_web\/applepaysession\/1778015-completemerchantvalidation\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">\n  <code>completeMerchantValidation<\/code>\n<\/a> method.<\/p>\n<p>You can do this by using Adyen's Apple Pay certificate, or you can use your own:<\/p>\n\n<div id=\"tab5isGB\">\n    <div data-component-wrapper=\"tabs\">\n        <tabs\n                        :items=\"[{&quot;title&quot;:&quot;Use Adyen&#039;s Apple Pay certificate&quot;,&quot;content&quot;:&quot;\\n&lt;ol&gt;\\n&lt;li&gt;\\n&lt;p&gt;Make an &lt;code&gt;\\\/applePay\\\/sessions&lt;\\\/code&gt; call to retrieve the payment session for Apple Pay, and include:&lt;\\\/p&gt;\\n&lt;table&gt;\\n&lt;thead&gt;\\n&lt;tr&gt;\\n&lt;th style=\\&quot;text-align: left;\\&quot;&gt;Parameters&lt;\\\/th&gt;\\n&lt;th style=\\&quot;text-align: left;\\&quot;&gt;Required&lt;\\\/th&gt;\\n&lt;th&gt;Description&lt;\\\/th&gt;\\n&lt;\\\/tr&gt;\\n&lt;\\\/thead&gt;\\n&lt;tbody&gt;\\n&lt;tr&gt;\\n&lt;td style=\\&quot;text-align: left;\\&quot;&gt;&lt;code&gt;displayName&lt;\\\/code&gt;&lt;\\\/td&gt;\\n&lt;td style=\\&quot;text-align: left;\\&quot;&gt;&lt;img title=\\&quot;-white_check_mark-\\&quot; alt=\\&quot;-white_check_mark-\\&quot; class=\\&quot;smileys\\&quot; src=\\&quot;\\\/user\\\/data\\\/smileys\\\/emoji\\\/white_check_mark.png\\&quot; \\\/&gt;&lt;\\\/td&gt;\\n&lt;td&gt;The value of the &lt;code&gt;configuration.merchantName&lt;\\\/code&gt; field from the  &lt;a href=\\&quot;https:\\\/\\\/docs.adyen.com\\\/api-explorer\\\/Checkout\\\/latest\\\/post\\\/paymentMethods\\&quot; class=\\&quot;codeLabel  external-link no-image\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot;&gt;\\\/paymentMethods&lt;\\\/a&gt; response.&lt;\\\/td&gt;\\n&lt;\\\/tr&gt;\\n&lt;tr&gt;\\n&lt;td style=\\&quot;text-align: left;\\&quot;&gt;&lt;code&gt;domainName&lt;\\\/code&gt;&lt;\\\/td&gt;\\n&lt;td style=\\&quot;text-align: left;\\&quot;&gt;&lt;img title=\\&quot;-white_check_mark-\\&quot; alt=\\&quot;-white_check_mark-\\&quot; class=\\&quot;smileys\\&quot; src=\\&quot;\\\/user\\\/data\\\/smileys\\\/emoji\\\/white_check_mark.png\\&quot; \\\/&gt;&lt;\\\/td&gt;\\n&lt;td&gt;The domain name you provided when you added Apple Pay in your Customer Area.  This has to match the &lt;code&gt;window.location.hostname&lt;\\\/code&gt; of the web shop.&lt;\\\/td&gt;\\n&lt;\\\/tr&gt;\\n&lt;tr&gt;\\n&lt;td style=\\&quot;text-align: left;\\&quot;&gt;&lt;code&gt;merchantIdentifier&lt;\\\/code&gt;&lt;\\\/td&gt;\\n&lt;td style=\\&quot;text-align: left;\\&quot;&gt;&lt;img title=\\&quot;-white_check_mark-\\&quot; alt=\\&quot;-white_check_mark-\\&quot; class=\\&quot;smileys\\&quot; src=\\&quot;\\\/user\\\/data\\\/smileys\\\/emoji\\\/white_check_mark.png\\&quot; \\\/&gt;&lt;\\\/td&gt;\\n&lt;td&gt;The value of &lt;code&gt;configuration.merchantId&lt;\\\/code&gt; field from the  &lt;a href=\\&quot;https:\\\/\\\/docs.adyen.com\\\/api-explorer\\\/Checkout\\\/latest\\\/post\\\/paymentMethods\\&quot; class=\\&quot;codeLabel  external-link no-image\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot;&gt;\\\/paymentMethods&lt;\\\/a&gt; response.&lt;\\\/td&gt;\\n&lt;\\\/tr&gt;\\n&lt;\\\/tbody&gt;\\n&lt;\\\/table&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;\\\/applePay\\\/sessions request&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=\\&quot;[{&amp;quot;language&amp;quot;:&amp;quot;sh&amp;quot;,&amp;quot;tabTitle&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;curl https:\\\\\\\/\\\\\\\/checkout-test.adyen.com\\\\\\\/v64\\\\\\\/applePay\\\\\\\/sessions \\\\\\\\\\\\n-H &#039;x-api-key: ADYEN_API_KEY&#039; \\\\\\\\\\\\n-H &#039;content-type: application\\\\\\\/json&#039; \\\\\\\\\\\\n-d &#039;{\\\\n  \\\\&amp;quot;displayName\\\\&amp;quot;: \\\\&amp;quot;YOUR_MERCHANT_NAME\\\\&amp;quot;,\\\\n  \\\\&amp;quot;domainName\\\\&amp;quot;: \\\\&amp;quot;YOUR_DOMAIN_NAME\\\\&amp;quot;,\\\\n  \\\\&amp;quot;merchantIdentifier\\\\&amp;quot;: \\\\&amp;quot;YOUR_MERCHANT_ID\\\\&amp;quot;\\\\n}&#039;&amp;quot;}]\\&quot; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;Decode the base64-encoded &lt;code&gt;data&lt;\\\/code&gt; object you get in the response:&lt;\\\/p&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;\\\/applePay\\\/sessions response&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=&#039;[{\\&quot;language\\&quot;:\\&quot;json\\&quot;,\\&quot;tabTitle\\&quot;:\\&quot;\\&quot;,\\&quot;content\\&quot;:\\&quot;{\\\\n  \\\\\\&quot;data\\\\\\&quot;: \\\\\\&quot;BASE_64_ENCODED_DATA\\\\\\&quot;\\\\n}\\&quot;}]&#039; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;Pass the decoded data as an object to the &lt;a href=\\&quot;https:\\\/\\\/developer.apple.com\\\/documentation\\\/apple_pay_on_the_web\\\/applepaysession\\\/1778015-completemerchantvalidation\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot; class=\\&quot;external-link no-image\\&quot;&gt;\\n  &lt;code&gt;completeMerchantValidation&lt;\\\/code&gt;\\n&lt;\\\/a&gt; method to complete the Apple Pay session validation.&lt;\\\/p&gt;\\n&lt;\\\/li&gt;\\n&lt;\\\/ol&gt;\\n&quot;,&quot;altTitle&quot;:&quot;adyen-certificate&quot;,&quot;oldTabId&quot;:&quot;adyen-certificate-validation_1&quot;,&quot;relation&quot;:&quot;adyen-certificate&quot;},{&quot;title&quot;:&quot;Use your own Apple Pay certificate&quot;,&quot;content&quot;:&quot;\\n&lt;ol&gt;\\n&lt;li&gt;\\n&lt;p&gt;&lt;a href=\\&quot;https:\\\/\\\/developer.apple.com\\\/documentation\\\/apple_pay_on_the_web\\\/apple_pay_js_api\\\/requesting_an_apple_pay_payment_session\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot; class=\\&quot;external-link no-image\\&quot;&gt;Request a valid session&lt;\\\/a&gt; from the Apple Pay server.&lt;\\\/p&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;Use the session object from the response to &lt;a href=\\&quot;https:\\\/\\\/developer.apple.com\\\/documentation\\\/apple_pay_on_the_web\\\/applepaysession\\\/1778015-completemerchantvalidation\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot; class=\\&quot;external-link no-image\\&quot;&gt;complete the Apple Pay session validation&lt;\\\/a&gt;&lt;\\\/p&gt;\\n&lt;\\\/li&gt;\\n&lt;\\\/ol&gt;\\n&quot;,&quot;altTitle&quot;:&quot;your-certificate&quot;,&quot;oldTabId&quot;:&quot;your-certificate-validation_2&quot;,&quot;relation&quot;:&quot;your-certificate&quot;}]\"\n            :should-update-when-url-changes='true'>\n        <\/tabs>\n    <\/div>\n<\/div>\n\n<div class=\"notices yellow\">\n<p>The Apple Pay session data expires after five minutes, so make sure you complete the Apple Pay session validation within this time.<\/p>\n<\/div>\n<p>If the Apple Pay session is successfully validated, Apple Pay prompts the shopper to authorize the payment using Touch ID or Face ID.<\/p>\n<h2 id=\"make-payment\">Make a payment<\/h2>\n<ol>\n<li>\n<p>After the shopper authorizes the payment, get the token from the Apple Pay framework and decrypt it in one of two ways:<\/p>\n<ul>\n<li><a href=\"\/pt\/payment-methods\/apple-pay\/api-only\/apple-pay-token-decryption#let-adyen-handle-the-decryption\">Let Adyen handle the decryption<\/a><\/li>\n<li><a href=\"\/pt\/payment-methods\/apple-pay\/api-only\/apple-pay-token-decryption#handle-the-decryption-on-your-own\">Handle the decryption yourself<\/a>. This is only allowed if you are PCI-compliant.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Stringify and Base64-encode the entire <code>paymentData<\/code> object.<\/p>\n<\/li>\n<li>\n<p>From your server, 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\u00a0providing:<\/p>\n<ul>\n<li><code>paymentMethod.type<\/code>: <span translate=\"no\"><strong>applepay<\/strong><\/span><\/li>\n<li><code>applePayToken<\/code>: The stringified and base64 encoded <code>paymentData<\/code> you retrieved from the Apple framework.\u00a0<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"''\" :id=\"'apple-pay-api'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v72\\\/payments \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n  \\&quot;merchantAccount\\&quot;:\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;reference\\&quot;:\\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  \\&quot;amount\\&quot;:{\\n    \\&quot;currency\\&quot;:\\&quot;EUR\\&quot;,\\n    \\&quot;value\\&quot;:1000\\n  },\\n  \\&quot;paymentMethod\\&quot;:{\\n    \\&quot;type\\&quot;:\\&quot;applepay\\&quot;,\\n    \\&quot;applePayToken\\&quot;: \\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;\\n  },\\n  \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v27.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.checkout.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.model.RequestOptions;\\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\\n\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount()\\n  .currency(\\&quot;EUR\\&quot;)\\n  .value(1000L);\\n\\nApplePayDetails applePayDetails = new ApplePayDetails()\\n  .applePayToken(\\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;)\\n  .type(ApplePayDetails.TypeEnum.APPLEPAY);\\n\\nPaymentRequest paymentRequest = new PaymentRequest()\\n  .reference(\\&quot;YOUR_ORDER_NUMBER\\&quot;)\\n  .amount(amount)\\n  .merchantAccount(\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;)\\n  .paymentMethod(new CheckoutPaymentMethod(applePayDetails))\\n  .returnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;);\\n\\n\\\/\\\/ Send the request\\nPaymentsApi service = new PaymentsApi(client);\\nPaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey(\\&quot;UUID\\&quot;));&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen PHP API Library v19.0.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Model\\\\Checkout\\\\Amount;\\nuse Adyen\\\\Model\\\\Checkout\\\\CheckoutPaymentMethod;\\nuse Adyen\\\\Model\\\\Checkout\\\\PaymentRequest;\\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\\n\\\/\\\/ Create the request object(s)\\n$amount = new Amount();\\n$amount\\n  -&gt;setCurrency(\\&quot;EUR\\&quot;)\\n  -&gt;setValue(1000);\\n\\n$checkoutPaymentMethod = new CheckoutPaymentMethod();\\n$checkoutPaymentMethod\\n  -&gt;setApplePayToken(\\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;)\\n  -&gt;setType(\\&quot;applepay\\&quot;);\\n\\n$paymentRequest = new PaymentRequest();\\n$paymentRequest\\n  -&gt;setReference(\\&quot;YOUR_ORDER_NUMBER\\&quot;)\\n  -&gt;setAmount($amount)\\n  -&gt;setMerchantAccount(\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;)\\n  -&gt;setPaymentMethod($checkoutPaymentMethod)\\n  -&gt;setReturnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;);\\n\\n$requestOptions['idempotencyKey'] = 'UUID';\\n\\n\\\/\\\/ Send the request\\n$service = new PaymentsApi($client);\\n$response = $service-&gt;payments($paymentRequest, $requestOptions);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v17.0.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.Checkout;\\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\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount\\n{\\n  Currency = \\&quot;EUR\\&quot;,\\n  Value = 1000\\n};\\n\\nApplePayDetails applePayDetails = new ApplePayDetails\\n{\\n  ApplePayToken = \\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;,\\n  Type = ApplePayDetails.TypeEnum.Applepay\\n};\\n\\nPaymentRequest paymentRequest = new PaymentRequest\\n{\\n  Reference = \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  Amount = amount,\\n  MerchantAccount = \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  PaymentMethod = new CheckoutPaymentMethod(applePayDetails),\\n  ReturnUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n};\\n\\n\\\/\\\/ Send the request\\nvar service = new PaymentsService(client);\\nvar response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = \\&quot;UUID\\&quot;});&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v18.0.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\\\/\\\/ Create the request object(s)\\nconst paymentRequest = {\\n  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  amount: {\\n    currency: \\&quot;EUR\\&quot;,\\n    value: 1000\\n  },\\n  paymentMethod: {\\n    type: \\&quot;applepay\\&quot;,\\n    applePayToken: \\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;\\n  },\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n}\\n\\n\\\/\\\/ Send the request\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: \\&quot;UUID\\&quot; });&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v10.4.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/checkout\\&quot;\\n)\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Create the request object(s)\\namount := checkout.Amount{\\n  Currency: \\&quot;EUR\\&quot;,\\n  Value: 1000,\\n}\\n\\napplePayDetails := checkout.ApplePayDetails{\\n  ApplePayToken: \\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;,\\n  Type: common.PtrString(\\&quot;applepay\\&quot;),\\n}\\n\\npaymentRequest := checkout.PaymentRequest{\\n  Reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  Amount: amount,\\n  MerchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  PaymentMethod: checkout.ApplePayDetailsAsCheckoutPaymentMethod(&amp;applePayDetails),\\n  ReturnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n}\\n\\n\\\/\\\/ Send the request\\nservice := client.Checkout()\\nreq := service.PaymentsApi.PaymentsInput().IdempotencyKey(\\&quot;UUID\\&quot;).PaymentRequest(paymentRequest)\\nres, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v12.5.1\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_API_KEY\\&quot;\\n# For the live environment, additionally include your liveEndpointUrlPrefix.\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\n# Create the request object(s)\\njson_request = {\\n  \\&quot;merchantAccount\\&quot;: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;reference\\&quot;: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;currency\\&quot;: \\&quot;EUR\\&quot;,\\n    \\&quot;value\\&quot;: 1000\\n  },\\n  \\&quot;paymentMethod\\&quot;: {\\n    \\&quot;type\\&quot;: \\&quot;applepay\\&quot;,\\n    \\&quot;applePayToken\\&quot;: \\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;\\n  },\\n  \\&quot;returnUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n}\\n\\n# Send the request\\nresult = adyen.checkout.payments_api.payments(request=json_request, idempotency_key=\\&quot;UUID\\&quot;)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v9.5.1\\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)\\nrequest_body = {\\n  :merchantAccount =&gt; 'ADYEN_MERCHANT_ACCOUNT',\\n  :reference =&gt; 'YOUR_ORDER_NUMBER',\\n  :amount =&gt; {\\n    :currency =&gt; 'EUR',\\n    :value =&gt; 1000\\n  },\\n  :paymentMethod =&gt; {\\n    :type =&gt; 'applepay',\\n    :applePayToken =&gt; 'QWIwMmI0YzAhQlFBQkFnQjMv..'\\n  },\\n  :returnUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..'\\n}\\n\\n# Send the request\\nresult = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' =&gt; 'UUID' })&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v18.0.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\\\/\\\/ Create the request object(s)\\nconst amount: Types.checkout.Amount = {\\n  currency: \\&quot;EUR\\&quot;,\\n  value: 1000\\n};\\n\\nconst applePayDetails: Types.checkout.ApplePayDetails = {\\n  applePayToken: \\&quot;QWIwMmI0YzAhQlFBQkFnQjMv..\\&quot;,\\n  type: Types.checkout.ApplePayDetails.TypeEnum.Applepay\\n};\\n\\nconst paymentRequest: Types.checkout.PaymentRequest = {\\n  reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  amount: amount,\\n  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  paymentMethod: applePayDetails,\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n};\\n\\n\\\/\\\/ Send the request\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: \\&quot;UUID\\&quot; });&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains the result of the payment.<\/p>\n<pre><code class=\"language-json\">{\n  \"pspReference\": \"881539337151149C\",\n  \"resultCode\": \"Authorised\"\n}<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2>Present the payment result<\/h2>\n<p>Use the\u00a0<code>resultCode<\/code> that you received in response to 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> call\u00a0to present the payment result to your shopper.<\/p>\n<p>The <code>resultCode<\/code> values you can receive for Apple Pay are:<\/p>\n<table>\n<thead>\n<tr>\n<th>resultCode<\/th>\n<th>Description<\/th>\n<th>Action to take<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Authorised<\/strong><\/td>\n<td>The payment was successful.<\/td>\n<td>Inform the shopper that the payment has been successful.<\/td>\n<\/tr>\n<tr>\n<td><strong>Refused<\/strong><\/td>\n<td>The payment was refused by the shopper's bank.<\/td>\n<td>Ask the shopper to try the payment again using a different payment method.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"recurring-payments\">Recurring payments<\/h2>\n<p>To make recurring Apple Pay payments, first <a href=\"\/pt\/online-payments\/tokenization\/create-tokens\">create a shopper token<\/a> and then <a href=\"\/pt\/online-payments\/tokenization\/make-token-payments\">make subsequent recurring transactions<\/a> with the token.<\/p>\n<h2 id=\"test-and-go-live\">Test and go live<\/h2>\n<p>Use Apple's test\u00a0card numbers\u00a0to\u00a0test your integration.<\/p>\n<p>For a full list of test cards and instructions how to add these to your test device, see <a href=\"https:\/\/developer.apple.com\/apple-pay\/sandbox-testing\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Sandbox testing<\/a>\u00a0on\u00a0Apple's Developer website.<\/p>\n<p> <\/p>\n<p>Check the status of an Apple Pay test payment in your\u00a0<a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>\u00a0&gt;\u00a0<strong>Transactions<\/strong>\u00a0&gt; <strong>\u00a0Payments<\/strong>.<\/p>\n<h3>Going live<\/h3>\n<p>To process live Apple Pay payments, your API credential needs to have the <strong>API Clientside Encryption Payments role<\/strong>. You can check this in your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">live Customer Area<\/a> or ask your Admin user to verify.<\/p>\n<p> <\/p>\n<p>Enable Apple Pay either using Adyen's Apple Pay certificate, which is quicker, or you can also use your own Apple Developer account and certificate which requires extra configuration steps:<\/p>\n\n<div id=\"tabrDlPO\">\n    <div data-component-wrapper=\"tabs\">\n        <tabs\n                        :items=\"[{&quot;title&quot;:&quot;Use Adyen&#039;s Apple Pay certificate&quot;,&quot;content&quot;:&quot;\\n&lt;ol&gt;\\n&lt;li&gt;\\n&lt;p&gt;Download and unzip the &lt;a href=\\&quot;\\\/pt\\\/payment-methods\\\/apple-pay\\\/api-only\\\/apple-developer-merchantid-domain-association-2024.zip\\&quot;&gt;domain association file&lt;\\\/a&gt;.&lt;\\\/p&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;Host the domain association file on each domain you want to use, including subdomains. To host the file, use the exact file name &lt;strong&gt;apple-developer-merchantid-domain-association&lt;\\\/strong&gt; under the following path:&lt;\\\/p&gt;\\n&lt;pre&gt;&lt;code class=\\&quot;language-bash\\&quot;&gt;\\\/.well-known\\\/apple-developer-merchantid-domain-association&lt;\\\/code&gt;&lt;\\\/pre&gt;\\n&lt;p&gt;The file must:&lt;\\\/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;Have &lt;code&gt;Content-Type: text\\\/plain&lt;\\\/code&gt; in the header.&lt;\\\/li&gt;\\n&lt;li&gt;Be externally accessible.&lt;\\\/li&gt;\\n&lt;li&gt;Not be password protected.&lt;\\\/li&gt;\\n&lt;li&gt;Not be behind a proxy or redirect.&lt;\\\/li&gt;\\n&lt;\\\/ul&gt;\\n&lt;p&gt;See an example of a &lt;a href=\\&quot;https:\\\/\\\/eu.adyen.link\\\/.well-known\\\/apple-developer-merchantid-domain-association\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot; class=\\&quot;external-link no-image\\&quot;&gt;working domain association file&lt;\\\/a&gt;.&lt;\\\/p&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;&lt;a href=\\&quot;\\\/pt\\\/payment-methods\\\/add-payment-methods\\&quot;&gt;Add Apple Pay in your live Customer Area&lt;\\\/a&gt;&lt;\\\/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;You&#039;ll be asked for &lt;strong&gt;Shop websites&lt;\\\/strong&gt;: your website URLs, for example &lt;code&gt;https:\\\/\\\/www.mystore.com&lt;\\\/code&gt;. If you add more than one, separate them with a comma.&lt;\\\/li&gt;\\n&lt;\\\/ul&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;To update or add new Apple Pay domains:&lt;\\\/p&gt;\\n&lt;ol&gt;\\n&lt;li&gt;Go to &lt;a href=\\&quot;https:\\\/\\\/ca-live.adyen.com\\\/\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot; class=\\&quot;external-link no-image\\&quot;&gt;live Customer Area&lt;\\\/a&gt; &amp;gt; &lt;strong&gt;Payment Methods&lt;\\\/strong&gt;.&lt;\\\/li&gt;\\n&lt;li&gt;Select the specific Apple Pay payment method you want to update.&lt;\\\/li&gt;\\n&lt;li&gt;In the sidebar on the right, go to the &lt;strong&gt;Apple Pay domains&lt;\\\/strong&gt; section to find a list of domains currently configured for this payment method. To update the domains, select the &lt;strong&gt;Edit&lt;\\\/strong&gt; button next to the Apple Pay domains heading.&lt;br \\\/&gt;\\nA new sidebar opens where you can make the necessary changes. If there are any errors, this is indicated with red dot.&lt;\\\/li&gt;\\n&lt;li&gt;To view and fix any errors, select &lt;strong&gt;Edit&lt;\\\/strong&gt; next to the affected domain.\\n&lt;div class=\\&quot;sc-notice info\\&quot;&gt;&lt;div&gt;\\n&lt;ul&gt;\\n&lt;li&gt;You must be assigned the &lt;strong&gt;Change payment methods&lt;\\\/strong&gt; role in Customer Area to be able to make domain updates.&lt;\\\/li&gt;\\n&lt;li&gt;Domain configuration updates apply only to the generic Apple Pay payment method. Scheme-specific variants, like AMEX Apple Pay, Visa Apple Pay, and Mastercard Apple Pay, do not require domain configuration and are not supported by this flow.\\n&lt;\\\/div&gt;&lt;\\\/div&gt;\\n&quot;,&quot;altTitle&quot;:&quot;adyen-certificate&quot;,&quot;oldTabId&quot;:&quot;adyen-certificate-live_1&quot;,&quot;relation&quot;:&quot;adyen-certificate&quot;},{&quot;title&quot;:&quot;Use your own Apple Pay certificate&quot;,&quot;content&quot;:&quot;\\n&lt;ol&gt;\\n&lt;li&gt;\\n&lt;p&gt;&lt;a href=\\&quot;\\\/pt\\\/payment-methods\\\/apple-pay\\\/apple-pay-certificate\\\/web\\&quot;&gt;Set up Apple Pay&lt;\\\/a&gt; on your Apple Pay Developer account for your live merchant identifier.&lt;\\\/p&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;Configure your firewall&#039;s allow-list:&lt;\\\/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;&lt;a href=\\&quot;https:\\\/\\\/developer.apple.com\\\/documentation\\\/apple_pay_on_the_web\\\/setting_up_your_server\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot; class=\\&quot;external-link no-image\\&quot;&gt;Allow Apple IP Addresses for Domain Verification&lt;\\\/a&gt;&lt;\\\/li&gt;\\n&lt;li&gt;Include &lt;code&gt;out.adyen.com&lt;\\\/code&gt; in your configuration to allow communication from our network.&lt;\\\/li&gt;\\n&lt;\\\/ul&gt;\\n&lt;div class=\\&quot;sc-notice info\\&quot;&gt;&lt;div&gt;\\n&lt;p&gt;We do not provide a list of IP addresses for allow-listing, because over time the list may change for various reasons, for example, due to ISP configuration changes.&lt;\\\/p&gt;\\n&lt;p&gt;If you are unable to configure your firewall with a domain allow-list, attempt to resolve our IP addresses by performing a DNS lookup on &lt;code&gt;out.adyen.com&lt;\\\/code&gt;, and then add those IP addresses to your allow-list. Beware that you still run the risk of a disruption if the IP addresses change.&lt;\\\/p&gt;\\n&lt;\\\/div&gt;&lt;\\\/div&gt;\\n&lt;\\\/li&gt;\\n&lt;\\\/ol&gt;\\n&quot;,&quot;altTitle&quot;:&quot;your-certificate&quot;,&quot;oldTabId&quot;:&quot;your-certificate-live_2&quot;,&quot;relation&quot;:&quot;your-certificate&quot;}]\"\n            :should-update-when-url-changes='true'>\n        <\/tabs>\n    <\/div>\n<\/div>\n\n<h2 id=\"see-also\">See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/online-payments\/api-only\"\n                        target=\"_self\"\n                        >\n                    API-only integration guide\n                <\/a><\/li><li><a href=\"https:\/\/developer.apple.com\/apple-pay\/implementation\"\n                        target=\"_blank\"\n                         class=\"external\">\n                    Apple Pay documentation\n                <\/a><\/li><li><a href=\"\/online-payments\/tokenization\"\n                        target=\"_self\"\n                        >\n                    Tokenization\n                <\/a><\/li><li><a href=\"\/development-resources\/error-codes#apple-pay-error-codes\"\n                        target=\"_self\"\n                        >\n                    Apple Pay error codes\n                <\/a><\/li><li><a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/overview\"\n                        target=\"_blank\"\n                         class=\"external\">\n                    API Explorer\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/apple-pay\/api-only","articleFields":{"description":"Add Apple Pay to an existing API-only integration.","feedback_component":true,"last_edit_on":"05-03-2025 18:05","parameters":{"payment_method":"Apple Pay","integration":"API-only","platform":"Web","integration_type":"api"},"page_id":"5b00a96d-4b69-4c10-964b-34c6592afd1b","filters_component":false,"decision_tree":"[]"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/apple-pay\/api-only","title":"Apple Pay for API only","content":"Accept Apple Pay payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.\n\nAdyen does not currently support China UnionPay cards when using Apple Pay. You cannot send the merchantCapability \"supportsEMV\" in your Apple Pay integration.\n\nRequirements\n\n\n\nRequirement\nDescription\n\n\n\n\nIntegration type\nMake sure that you have built an Advanced flow API-only integration.\n\n\nCustomer Area roles\nChange payment methods role.\n\n\nAPI credential roles\nTo process live Apple Pay payments make sure that you have the following role API Clientside Encryption Payments role.\n\n\nSetup steps\nBefore you begin, make sure that you have: Set up Apple Pay with your own or Adyen's Apple Pay certificate.  You can use Adyen's Apple Pay certificate if you have a web integration, which makes it quicker to set up Apple Pay. If you have a mobile integration, use your own Apple Developer account and certificate which requires extra configuration steps.Added Apple Pay in your Customer Area.Read the Apple Pay documentation to learn about how you can offer Apple Pay on the web, or in your mobile app. \n\n\n\nBuild your payment form for Apple Pay\nAfter you have finished setting up Apple Pay, you can show Apple Pay as an available payment method in countries\/regions where Apple Pay is supported. You can download logos for Apple Pay which you can use on your payment form.\nWhen the shopper selects Apple Pay, they are presented with a prompt to verify the payment using Touch ID or Face ID. If the shopper is using a Mac without Touch ID, they will be prompted to verify the payment using an iPhone or Apple Watch registered to the same iCloud account.\n\n\nMake a  \/paymentMethods request, specifying:\n\n countryCode&#58; Countries\/regions where Apple Pay is supported. For example, NL.\n amount.currency&#58; Any supported currency. For example, EUR.\n channel&#58; Set this to\u00a0Web\u00a0if the payment is being initiated from Safari, or\u00a0iOS\u00a0for in-app payments.\n\n\n\nIn the response, you receive:\n\ntype: applepay.\nmerchantId and merchantName: If you use Adyen's Apple Pay certificate, you need these details in the next step to complete the Apple Pay session validation.\n\n\n\n{\n  \"paymentMethods\": [\n    ...\n    {\n        \"brands\": [\n            \"amex\",\n            \"mc\"\n        ],\n        \"configuration\": {\n            \"merchantId\": \"com.test.merchant\",\n            \"merchantName\": \"Your Store\"\n        },\n        \"details\": [\n            {\n                \"key\": \"applepay.token\",\n                \"type\": \"applePayToken\"\n            }\n        ],\n        \"name\": \"Apple Pay\",\n        \"type\": \"applepay\"\n    },\n    ...\n  ]\n}\nComplete the Apple Pay session validation\n\nThis step is only required for web integrations. You do not need to complete the Apple Pay session validation for in-app payments.\n\nWhen the shopper selects to pay with Apple Pay, you get the \n  onvalidatemerchant\n event handler. You then need to complete the Apple Pay session validation using the \n  completeMerchantValidation\n method.\nYou can do this by using Adyen's Apple Pay certificate, or you can use your own:\n\n\n    \n        \n        \n    \n\n\n\nThe Apple Pay session data expires after five minutes, so make sure you complete the Apple Pay session validation within this time.\n\nIf the Apple Pay session is successfully validated, Apple Pay prompts the shopper to authorize the payment using Touch ID or Face ID.\nMake a payment\n\n\nAfter the shopper authorizes the payment, get the token from the Apple Pay framework and decrypt it in one of two ways:\n\nLet Adyen handle the decryption\nHandle the decryption yourself. This is only allowed if you are PCI-compliant.\n\n\n\nStringify and Base64-encode the entire paymentData object.\n\n\nFrom your server, make a  \/payments request\u00a0providing:\n\npaymentMethod.type: applepay\napplePayToken: The stringified and base64 encoded paymentData you retrieved from the Apple framework.\u00a0\n\n\n\n\nThe response contains the result of the payment.\n{\n  \"pspReference\": \"881539337151149C\",\n  \"resultCode\": \"Authorised\"\n}\n\n\nPresent the payment result\nUse the\u00a0resultCode that you received in response to your  \/payments call\u00a0to present the payment result to your shopper.\nThe resultCode values you can receive for Apple Pay are:\n\n\n\nresultCode\nDescription\nAction to take\n\n\n\n\nAuthorised\nThe payment was successful.\nInform the shopper that the payment has been successful.\n\n\nRefused\nThe payment was refused by the shopper's bank.\nAsk the shopper to try the payment again using a different payment method.\n\n\n\nRecurring payments\nTo make recurring Apple Pay payments, first create a shopper token and then make subsequent recurring transactions with the token.\nTest and go live\nUse Apple's test\u00a0card numbers\u00a0to\u00a0test your integration.\nFor a full list of test cards and instructions how to add these to your test device, see Sandbox testing\u00a0on\u00a0Apple's Developer website.\n \nCheck the status of an Apple Pay test payment in your\u00a0Customer Area\u00a0&gt;\u00a0Transactions\u00a0&gt; \u00a0Payments.\nGoing live\nTo process live Apple Pay payments, your API credential needs to have the API Clientside Encryption Payments role. You can check this in your live Customer Area or ask your Admin user to verify.\n \nEnable Apple Pay either using Adyen's Apple Pay certificate, which is quicker, or you can also use your own Apple Developer account and certificate which requires extra configuration steps:\n\n\n    \n        \n        \n    \n\n\nSee also\n\n\n                    API-only integration guide\n                \n                    Apple Pay documentation\n                \n                    Tokenization\n                \n                    Apple Pay error codes\n                \n                    API Explorer\n                \n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Payment methods","lvl2":"Apple Pay","lvl3":"Apple Pay for API only"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/payment-methods","lvl2":"https:\/\/docs.adyen.com\/pt\/payment-methods\/apple-pay","lvl3":"\/pt\/payment-methods\/apple-pay\/api-only"},"levels":4,"category":"Payment method","category_color":"green","tags":["Apple"]},"articleFiles":{"apple-developer-merchantid-domain-association-2024.zip":"<p alt=\"\">apple-developer-merchantid-domain-association-2024.zip<\/p>","apple-pay-api.js":"<p alt=\"\">apple-pay-api.js<\/p>"}}
