{"title":"Afterpay for API only","category":"default","creationDate":1776961628,"content":"<p>You can add Afterpay to your existing integration. The following instructions show only what you must add to your integration specifically for Afterpay.<\/p>\n<p>If an instruction on this page corresponds with a step in the main integration guide, it includes a link to the corresponding step of the main integration guide.<\/p>\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 an existing <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow?platform=Web&amp;integration=API%20only\">API-only integration<\/a>. <br> This page includes only instructions to add Afterpay to your existing integration.<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Checkout API<\/strong><\/td>\n<td style=\"text-align: left;\">Make sure that you use Checkout API v or later.<\/td>\n<td> <\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Redirect handling<\/strong><\/td>\n<td style=\"text-align: left;\">Make sure that your existing integration is set up to <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow?platform=Web&amp;integration=API%20only#handle-the-redirect\">handle the redirect<\/a>. <br>  <code>action.type<\/code>: <span translate=\"no\"><strong>redirect<\/strong><\/span><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Limitations<\/strong><\/td>\n<td style=\"text-align: left;\">Tokenization for recurring and on-file payments is only supported for Australia and New Zealand.<\/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, <a href=\"\/pt\/payment-methods\/add-payment-methods\">add Afterpay in your Customer Area<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Get Afterpay as an available payment method<\/h2>\n<p>When you make the  <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> call to <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow?platform=Web&amp;integration=API%20only#get-available-payment-methods\">get available payment methods<\/a>, specify one of the following combinations of  <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> and  <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> so that Afterpay is included in the response.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Country\/region<\/th>\n<th style=\"text-align: left;\"><code>countryCode<\/code><\/th>\n<th style=\"text-align: left;\"><code>amount.currency<\/code><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">Australia<\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>AU<\/strong><\/span><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>AUD<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">New Zealand<\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>NZ<\/strong><\/span><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>NZD<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Canada<\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>CA<\/strong><\/span><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>CAD<\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Build your payment form<\/h2>\n<div class=\"sc-notice info\"><div>\n<p>We provide the logo for Afterpay that <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=API%20only#downloading-logos\">you can download<\/a>.<\/p>\n<\/div><\/div>\n<p>To perform risk checks, Afterpay requires you to collect the following shopper details:<\/p>\n<ul>\n<li>Full name<\/li>\n<li>Email address<\/li>\n<li>Billing address and delivery address.<\/li>\n<\/ul>\n<p>Accept Afterpay 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<h2>Add additional parameters to your \/payments request<\/h2>\n<p>When you <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow?platform=Web&amp;integration=API%20only#make-a-payment\">make a payment<\/a>, add the following parameters:<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter name<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>paymentMethod<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td><span translate=\"no\"><strong>afterpaytouch<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-shopperName\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">shopperName<\/a><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The shopper's full name.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-shopperEmail\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">shopperEmail<\/a><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The shopper's email address.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-shopperReference\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">shopperReference<\/a><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>A unique reference to identify the shopper. Minimum length: three characters.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-countryCode\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">countryCode<\/a><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The shopper's country\/region.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-billingAddress\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">billingAddress<\/a><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The postal address to be included on the invoice.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-deliveryAddress\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">deliveryAddress<\/a><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The postal address where the goods will be shipped.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-lineItems\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lineItems<\/a><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Price and product information about the purchased items.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-telephoneNumber\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">telephoneNumber<\/a><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td>The shopper's telephone number, if provided.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"''\" :id=\"'payments'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v68\\\/payments \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n  \\&quot;paymentMethod\\&quot;:{\\n    \\&quot;type\\&quot;:\\&quot;afterpaytouch\\&quot;\\n  },\\n  \\&quot;amount\\&quot;:{\\n     \\&quot;value\\&quot;:1000,\\n     \\&quot;currency\\&quot;:\\&quot;AUD\\&quot;\\n  },\\n  \\&quot;countryCode\\&quot;:\\&quot;AU\\&quot;,\\n  \\&quot;shopperName\\&quot;:{\\n     \\&quot;firstName\\&quot;:\\&quot;Simon\\&quot;,\\n     \\&quot;lastName\\&quot;:\\&quot;Hopper\\&quot;\\n  },\\n  \\&quot;telephoneNumber\\&quot;:\\&quot;+61 2 8520 3890\\&quot;,\\n  \\&quot;shopperEmail\\&quot;:\\&quot;s.hopper@example.com\\&quot;,\\n  \\&quot;shopperReference\\&quot;:\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  \\&quot;reference\\&quot;:\\&quot;YOUR_ORDER_REFERENCE\\&quot;,\\n  \\&quot;merchantAccount\\&quot;:\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  \\&quot;billingAddress\\&quot;:{\\n     \\&quot;city\\&quot;:\\&quot;Sydney\\&quot;,\\n     \\&quot;country\\&quot;:\\&quot;AU\\&quot;,\\n     \\&quot;houseNumberOrName\\&quot;:\\&quot;123\\&quot;,\\n     \\&quot;postalCode\\&quot;:\\&quot;2000\\&quot;,\\n     \\&quot;stateOrProvince\\&quot;:\\&quot;NSW\\&quot;,\\n     \\&quot;street\\&quot;:\\&quot;Happy Street\\&quot;\\n  },\\n  \\&quot;deliveryAddress\\&quot;:{\\n     \\&quot;city\\&quot;:\\&quot;Sydney\\&quot;,\\n     \\&quot;country\\&quot;:\\&quot;AU\\&quot;,\\n     \\&quot;houseNumberOrName\\&quot;:\\&quot;123\\&quot;,\\n     \\&quot;postalCode\\&quot;:\\&quot;2000\\&quot;,\\n     \\&quot;stateOrProvince\\&quot;:\\&quot;NSW\\&quot;,\\n     \\&quot;street\\&quot;:\\&quot;Happy Street\\&quot;\\n  },\\n  \\&quot;lineItems\\&quot;:[\\n     {\\n        \\&quot;description\\&quot;:\\&quot;Shoes\\&quot;,\\n        \\&quot;quantity\\&quot;:\\&quot;1\\&quot;,\\n        \\&quot;amountIncludingTax\\&quot;:\\&quot;400\\&quot;,\\n        \\&quot;amountExcludingTax\\&quot;: \\&quot;331\\&quot;,\\n        \\&quot;taxAmount\\&quot;: \\&quot;69\\&quot;,\\n        \\&quot;id\\&quot;:\\&quot;Item #1\\&quot;\\n     },\\n     {\\n        \\&quot;description\\&quot;:\\&quot;Socks\\&quot;,\\n        \\&quot;quantity\\&quot;:\\&quot;2\\&quot;,\\n        \\&quot;amountIncludingTax\\&quot;:\\&quot;300\\&quot;,\\n        \\&quot;amountExcludingTax\\&quot;: \\&quot;248\\&quot;,\\n        \\&quot;taxAmount\\&quot;: \\&quot;52\\&quot;,\\n        \\&quot;id\\&quot;:\\&quot;Item #2\\&quot;\\n     }\\n  ]\\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;AUD\\&quot;)\\n  .value(1000L);\\n\\nLineItem lineItem1 = new LineItem()\\n  .quantity(1L)\\n  .amountExcludingTax(331L)\\n  .description(\\&quot;Shoes\\&quot;)\\n  .id(\\&quot;Item #1\\&quot;)\\n  .amountIncludingTax(400L)\\n  .taxAmount(69L);\\n\\nLineItem lineItem2 = new LineItem()\\n  .quantity(2L)\\n  .amountExcludingTax(248L)\\n  .description(\\&quot;Socks\\&quot;)\\n  .id(\\&quot;Item #2\\&quot;)\\n  .amountIncludingTax(300L)\\n  .taxAmount(52L);\\n\\nName name = new Name()\\n  .firstName(\\&quot;Simon\\&quot;)\\n  .lastName(\\&quot;Hopper\\&quot;);\\n\\nDeliveryAddress deliveryAddress = new DeliveryAddress()\\n  .country(\\&quot;AU\\&quot;)\\n  .stateOrProvince(\\&quot;NSW\\&quot;)\\n  .city(\\&quot;Sydney\\&quot;)\\n  .houseNumberOrName(\\&quot;123\\&quot;)\\n  .street(\\&quot;Happy Street\\&quot;)\\n  .postalCode(\\&quot;2000\\&quot;);\\n\\nAfterpayDetails afterpayDetails = new AfterpayDetails()\\n  .type(AfterpayDetails.TypeEnum.AFTERPAYTOUCH);\\n\\nBillingAddress billingAddress = new BillingAddress()\\n  .country(\\&quot;AU\\&quot;)\\n  .stateOrProvince(\\&quot;NSW\\&quot;)\\n  .city(\\&quot;Sydney\\&quot;)\\n  .houseNumberOrName(\\&quot;123\\&quot;)\\n  .street(\\&quot;Happy Street\\&quot;)\\n  .postalCode(\\&quot;2000\\&quot;);\\n\\nPaymentRequest paymentRequest = new PaymentRequest()\\n  .amount(amount)\\n  .telephoneNumber(\\&quot;+61 2 8520 3890\\&quot;)\\n  .shopperEmail(\\&quot;s.hopper@example.com\\&quot;)\\n  .reference(\\&quot;YOUR_ORDER_REFERENCE\\&quot;)\\n  .lineItems(Arrays.asList(lineItem1, lineItem2))\\n  .shopperName(name)\\n  .merchantAccount(\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;)\\n  .deliveryAddress(deliveryAddress)\\n  .countryCode(\\&quot;AU\\&quot;)\\n  .paymentMethod(new CheckoutPaymentMethod(afterpayDetails))\\n  .billingAddress(billingAddress)\\n  .returnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;)\\n  .shopperReference(\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&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\\\\LineItem;\\nuse Adyen\\\\Model\\\\Checkout\\\\Name;\\nuse Adyen\\\\Model\\\\Checkout\\\\DeliveryAddress;\\nuse Adyen\\\\Model\\\\Checkout\\\\CheckoutPaymentMethod;\\nuse Adyen\\\\Model\\\\Checkout\\\\BillingAddress;\\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;AUD\\&quot;)\\n  -&gt;setValue(1000);\\n\\n$lineItem1 = new LineItem();\\n$lineItem1\\n  -&gt;setQuantity(1)\\n  -&gt;setAmountExcludingTax(331)\\n  -&gt;setDescription(\\&quot;Shoes\\&quot;)\\n  -&gt;setId(\\&quot;Item #1\\&quot;)\\n  -&gt;setAmountIncludingTax(400)\\n  -&gt;setTaxAmount(69);\\n\\n$lineItem2 = new LineItem();\\n$lineItem2\\n  -&gt;setQuantity(2)\\n  -&gt;setAmountExcludingTax(248)\\n  -&gt;setDescription(\\&quot;Socks\\&quot;)\\n  -&gt;setId(\\&quot;Item #2\\&quot;)\\n  -&gt;setAmountIncludingTax(300)\\n  -&gt;setTaxAmount(52);\\n\\n$name = new Name();\\n$name\\n  -&gt;setFirstName(\\&quot;Simon\\&quot;)\\n  -&gt;setLastName(\\&quot;Hopper\\&quot;);\\n\\n$deliveryAddress = new DeliveryAddress();\\n$deliveryAddress\\n  -&gt;setCountry(\\&quot;AU\\&quot;)\\n  -&gt;setStateOrProvince(\\&quot;NSW\\&quot;)\\n  -&gt;setCity(\\&quot;Sydney\\&quot;)\\n  -&gt;setHouseNumberOrName(\\&quot;123\\&quot;)\\n  -&gt;setStreet(\\&quot;Happy Street\\&quot;)\\n  -&gt;setPostalCode(\\&quot;2000\\&quot;);\\n\\n$checkoutPaymentMethod = new CheckoutPaymentMethod();\\n$checkoutPaymentMethod\\n  -&gt;setType(\\&quot;afterpaytouch\\&quot;);\\n\\n$billingAddress = new BillingAddress();\\n$billingAddress\\n  -&gt;setCountry(\\&quot;AU\\&quot;)\\n  -&gt;setStateOrProvince(\\&quot;NSW\\&quot;)\\n  -&gt;setCity(\\&quot;Sydney\\&quot;)\\n  -&gt;setHouseNumberOrName(\\&quot;123\\&quot;)\\n  -&gt;setStreet(\\&quot;Happy Street\\&quot;)\\n  -&gt;setPostalCode(\\&quot;2000\\&quot;);\\n\\n$paymentRequest = new PaymentRequest();\\n$paymentRequest\\n  -&gt;setAmount($amount)\\n  -&gt;setTelephoneNumber(\\&quot;+61 2 8520 3890\\&quot;)\\n  -&gt;setShopperEmail(\\&quot;s.hopper@example.com\\&quot;)\\n  -&gt;setReference(\\&quot;YOUR_ORDER_REFERENCE\\&quot;)\\n  -&gt;setLineItems(array($lineItem1, $lineItem2))\\n  -&gt;setShopperName($name)\\n  -&gt;setMerchantAccount(\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;)\\n  -&gt;setDeliveryAddress($deliveryAddress)\\n  -&gt;setCountryCode(\\&quot;AU\\&quot;)\\n  -&gt;setPaymentMethod($checkoutPaymentMethod)\\n  -&gt;setBillingAddress($billingAddress)\\n  -&gt;setReturnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;)\\n  -&gt;setShopperReference(\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&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;AUD\\&quot;,\\n  Value = 1000\\n};\\n\\nLineItem lineItem1 = new LineItem\\n{\\n  Quantity = 1,\\n  AmountExcludingTax = 331,\\n  Description = \\&quot;Shoes\\&quot;,\\n  Id = \\&quot;Item #1\\&quot;,\\n  AmountIncludingTax = 400,\\n  TaxAmount = 69\\n};\\n\\nLineItem lineItem2 = new LineItem\\n{\\n  Quantity = 2,\\n  AmountExcludingTax = 248,\\n  Description = \\&quot;Socks\\&quot;,\\n  Id = \\&quot;Item #2\\&quot;,\\n  AmountIncludingTax = 300,\\n  TaxAmount = 52\\n};\\n\\nName name = new Name\\n{\\n  FirstName = \\&quot;Simon\\&quot;,\\n  LastName = \\&quot;Hopper\\&quot;\\n};\\n\\nDeliveryAddress deliveryAddress = new DeliveryAddress\\n{\\n  Country = \\&quot;AU\\&quot;,\\n  StateOrProvince = \\&quot;NSW\\&quot;,\\n  City = \\&quot;Sydney\\&quot;,\\n  HouseNumberOrName = \\&quot;123\\&quot;,\\n  Street = \\&quot;Happy Street\\&quot;,\\n  PostalCode = \\&quot;2000\\&quot;\\n};\\n\\nAfterpayDetails afterpayDetails = new AfterpayDetails\\n{\\n  Type = AfterpayDetails.TypeEnum.Afterpaytouch\\n};\\n\\nBillingAddress billingAddress = new BillingAddress\\n{\\n  Country = \\&quot;AU\\&quot;,\\n  StateOrProvince = \\&quot;NSW\\&quot;,\\n  City = \\&quot;Sydney\\&quot;,\\n  HouseNumberOrName = \\&quot;123\\&quot;,\\n  Street = \\&quot;Happy Street\\&quot;,\\n  PostalCode = \\&quot;2000\\&quot;\\n};\\n\\nPaymentRequest paymentRequest = new PaymentRequest\\n{\\n  Amount = amount,\\n  TelephoneNumber = \\&quot;+61 2 8520 3890\\&quot;,\\n  ShopperEmail = \\&quot;s.hopper@example.com\\&quot;,\\n  Reference = \\&quot;YOUR_ORDER_REFERENCE\\&quot;,\\n  LineItems = new List&lt;LineItem&gt;{ lineItem1, lineItem2 },\\n  ShopperName = name,\\n  MerchantAccount = \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  DeliveryAddress = deliveryAddress,\\n  CountryCode = \\&quot;AU\\&quot;,\\n  PaymentMethod = new CheckoutPaymentMethod(afterpayDetails),\\n  BillingAddress = billingAddress,\\n  ReturnUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  ShopperReference = \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&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  paymentMethod: {\\n    type: \\&quot;afterpaytouch\\&quot;\\n  },\\n  amount: {\\n    value: 1000,\\n    currency: \\&quot;AUD\\&quot;\\n  },\\n  shopperName: {\\n    firstName: \\&quot;Simon\\&quot;,\\n    lastName: \\&quot;Hopper\\&quot;\\n  },\\n  shopperEmail: \\&quot;s.hopper@example.com\\&quot;,\\n  shopperReference: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  reference: \\&quot;YOUR_ORDER_REFERENCE\\&quot;,\\n  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  countryCode: \\&quot;AU\\&quot;,\\n  telephoneNumber: \\&quot;+61 2 8520 3890\\&quot;,\\n  billingAddress: {\\n    city: \\&quot;Sydney\\&quot;,\\n    country: \\&quot;AU\\&quot;,\\n    houseNumberOrName: \\&quot;123\\&quot;,\\n    postalCode: \\&quot;2000\\&quot;,\\n    stateOrProvince: \\&quot;NSW\\&quot;,\\n    street: \\&quot;Happy Street\\&quot;\\n  },\\n  deliveryAddress: {\\n    city: \\&quot;Sydney\\&quot;,\\n    country: \\&quot;AU\\&quot;,\\n    houseNumberOrName: \\&quot;123\\&quot;,\\n    postalCode: \\&quot;2000\\&quot;,\\n    stateOrProvince: \\&quot;NSW\\&quot;,\\n    street: \\&quot;Happy Street\\&quot;\\n  },\\n  lineItems: [ {\\n    description: \\&quot;Shoes\\&quot;,\\n    quantity: \\&quot;1\\&quot;,\\n    amountIncludingTax: \\&quot;400\\&quot;,\\n    amountExcludingTax: \\&quot;331\\&quot;,\\n    taxAmount: \\&quot;69\\&quot;,\\n    id: \\&quot;Item #1\\&quot;\\n  }, {\\n    description: \\&quot;Socks\\&quot;,\\n    quantity: \\&quot;2\\&quot;,\\n    amountIncludingTax: \\&quot;300\\&quot;,\\n    amountExcludingTax: \\&quot;248\\&quot;,\\n    taxAmount: \\&quot;52\\&quot;,\\n    id: \\&quot;Item #2\\&quot;\\n  } ]\\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;AUD\\&quot;,\\n  Value: 1000,\\n}\\n\\nlineItem1 := checkout.LineItem{\\n  Quantity: common.PtrInt64(1),\\n  AmountExcludingTax: common.PtrInt64(331),\\n  Description: common.PtrString(\\&quot;Shoes\\&quot;),\\n  Id: common.PtrString(\\&quot;Item #1\\&quot;),\\n  AmountIncludingTax: common.PtrInt64(400),\\n  TaxAmount: common.PtrInt64(69),\\n}\\n\\nlineItem2 := checkout.LineItem{\\n  Quantity: common.PtrInt64(2),\\n  AmountExcludingTax: common.PtrInt64(248),\\n  Description: common.PtrString(\\&quot;Socks\\&quot;),\\n  Id: common.PtrString(\\&quot;Item #2\\&quot;),\\n  AmountIncludingTax: common.PtrInt64(300),\\n  TaxAmount: common.PtrInt64(52),\\n}\\n\\nname := checkout.Name{\\n  FirstName: \\&quot;Simon\\&quot;,\\n  LastName: \\&quot;Hopper\\&quot;,\\n}\\n\\ndeliveryAddress := checkout.DeliveryAddress{\\n  Country: \\&quot;AU\\&quot;,\\n  StateOrProvince: common.PtrString(\\&quot;NSW\\&quot;),\\n  City: \\&quot;Sydney\\&quot;,\\n  HouseNumberOrName: \\&quot;123\\&quot;,\\n  Street: \\&quot;Happy Street\\&quot;,\\n  PostalCode: \\&quot;2000\\&quot;,\\n}\\n\\nafterpayDetails := checkout.AfterpayDetails{\\n  Type: \\&quot;afterpaytouch\\&quot;,\\n}\\n\\nbillingAddress := checkout.BillingAddress{\\n  Country: \\&quot;AU\\&quot;,\\n  StateOrProvince: common.PtrString(\\&quot;NSW\\&quot;),\\n  City: \\&quot;Sydney\\&quot;,\\n  HouseNumberOrName: \\&quot;123\\&quot;,\\n  Street: \\&quot;Happy Street\\&quot;,\\n  PostalCode: \\&quot;2000\\&quot;,\\n}\\n\\npaymentRequest := checkout.PaymentRequest{\\n  Amount: amount,\\n  TelephoneNumber: common.PtrString(\\&quot;+61 2 8520 3890\\&quot;),\\n  ShopperEmail: common.PtrString(\\&quot;s.hopper@example.com\\&quot;),\\n  Reference: \\&quot;YOUR_ORDER_REFERENCE\\&quot;,\\n  LineItems: []checkout.LineItem{\\n      lineItem1, lineItem2,\\n  },\\n  ShopperName: &amp;name,\\n  MerchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  DeliveryAddress: &amp;deliveryAddress,\\n  CountryCode: common.PtrString(\\&quot;AU\\&quot;),\\n  PaymentMethod: checkout.AfterpayDetailsAsCheckoutPaymentMethod(&amp;afterpayDetails),\\n  BillingAddress: &amp;billingAddress,\\n  ReturnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  ShopperReference: common.PtrString(\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&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;paymentMethod\\&quot;: {\\n    \\&quot;type\\&quot;: \\&quot;afterpaytouch\\&quot;\\n  },\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;value\\&quot;: 1000,\\n    \\&quot;currency\\&quot;: \\&quot;AUD\\&quot;\\n  },\\n  \\&quot;shopperName\\&quot;: {\\n    \\&quot;firstName\\&quot;: \\&quot;Simon\\&quot;,\\n    \\&quot;lastName\\&quot;: \\&quot;Hopper\\&quot;\\n  },\\n  \\&quot;shopperEmail\\&quot;: \\&quot;s.hopper@example.com\\&quot;,\\n  \\&quot;shopperReference\\&quot;: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  \\&quot;reference\\&quot;: \\&quot;YOUR_ORDER_REFERENCE\\&quot;,\\n  \\&quot;merchantAccount\\&quot;: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;returnUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  \\&quot;countryCode\\&quot;: \\&quot;AU\\&quot;,\\n  \\&quot;telephoneNumber\\&quot;: \\&quot;+61 2 8520 3890\\&quot;,\\n  \\&quot;billingAddress\\&quot;: {\\n    \\&quot;city\\&quot;: \\&quot;Sydney\\&quot;,\\n    \\&quot;country\\&quot;: \\&quot;AU\\&quot;,\\n    \\&quot;houseNumberOrName\\&quot;: \\&quot;123\\&quot;,\\n    \\&quot;postalCode\\&quot;: \\&quot;2000\\&quot;,\\n    \\&quot;stateOrProvince\\&quot;: \\&quot;NSW\\&quot;,\\n    \\&quot;street\\&quot;: \\&quot;Happy Street\\&quot;\\n  },\\n  \\&quot;deliveryAddress\\&quot;: {\\n    \\&quot;city\\&quot;: \\&quot;Sydney\\&quot;,\\n    \\&quot;country\\&quot;: \\&quot;AU\\&quot;,\\n    \\&quot;houseNumberOrName\\&quot;: \\&quot;123\\&quot;,\\n    \\&quot;postalCode\\&quot;: \\&quot;2000\\&quot;,\\n    \\&quot;stateOrProvince\\&quot;: \\&quot;NSW\\&quot;,\\n    \\&quot;street\\&quot;: \\&quot;Happy Street\\&quot;\\n  },\\n  \\&quot;lineItems\\&quot;: [ {\\n    \\&quot;description\\&quot;: \\&quot;Shoes\\&quot;,\\n    \\&quot;quantity\\&quot;: \\&quot;1\\&quot;,\\n    \\&quot;amountIncludingTax\\&quot;: \\&quot;400\\&quot;,\\n    \\&quot;amountExcludingTax\\&quot;: \\&quot;331\\&quot;,\\n    \\&quot;taxAmount\\&quot;: \\&quot;69\\&quot;,\\n    \\&quot;id\\&quot;: \\&quot;Item #1\\&quot;\\n  }, {\\n    \\&quot;description\\&quot;: \\&quot;Socks\\&quot;,\\n    \\&quot;quantity\\&quot;: \\&quot;2\\&quot;,\\n    \\&quot;amountIncludingTax\\&quot;: \\&quot;300\\&quot;,\\n    \\&quot;amountExcludingTax\\&quot;: \\&quot;248\\&quot;,\\n    \\&quot;taxAmount\\&quot;: \\&quot;52\\&quot;,\\n    \\&quot;id\\&quot;: \\&quot;Item #2\\&quot;\\n  } ]\\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  :paymentMethod =&gt; {\\n    :type =&gt; 'afterpaytouch'\\n  },\\n  :amount =&gt; {\\n    :value =&gt; 1000,\\n    :currency =&gt; 'AUD'\\n  },\\n  :shopperName =&gt; {\\n    :firstName =&gt; 'Simon',\\n    :lastName =&gt; 'Hopper'\\n  },\\n  :shopperEmail =&gt; 's.hopper@example.com',\\n  :shopperReference =&gt; 'YOUR_UNIQUE_SHOPPER_ID',\\n  :reference =&gt; 'YOUR_ORDER_REFERENCE',\\n  :merchantAccount =&gt; 'ADYEN_MERCHANT_ACCOUNT',\\n  :returnUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..',\\n  :countryCode =&gt; 'AU',\\n  :telephoneNumber =&gt; '+61 2 8520 3890',\\n  :billingAddress =&gt; {\\n    :city =&gt; 'Sydney',\\n    :country =&gt; 'AU',\\n    :houseNumberOrName =&gt; '123',\\n    :postalCode =&gt; '2000',\\n    :stateOrProvince =&gt; 'NSW',\\n    :street =&gt; 'Happy Street'\\n  },\\n  :deliveryAddress =&gt; {\\n    :city =&gt; 'Sydney',\\n    :country =&gt; 'AU',\\n    :houseNumberOrName =&gt; '123',\\n    :postalCode =&gt; '2000',\\n    :stateOrProvince =&gt; 'NSW',\\n    :street =&gt; 'Happy Street'\\n  },\\n  :lineItems =&gt; [ {\\n    :description =&gt; 'Shoes',\\n    :quantity =&gt; '1',\\n    :amountIncludingTax =&gt; '400',\\n    :amountExcludingTax =&gt; '331',\\n    :taxAmount =&gt; '69',\\n    :id =&gt; 'Item #1'\\n  }, {\\n    :description =&gt; 'Socks',\\n    :quantity =&gt; '2',\\n    :amountIncludingTax =&gt; '300',\\n    :amountExcludingTax =&gt; '248',\\n    :taxAmount =&gt; '52',\\n    :id =&gt; 'Item #2'\\n  } ]\\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;AUD\\&quot;,\\n  value: 1000\\n};\\n\\nconst lineItem1: Types.checkout.LineItem = {\\n  quantity: 1,\\n  amountExcludingTax: 331,\\n  description: \\&quot;Shoes\\&quot;,\\n  id: \\&quot;Item #1\\&quot;,\\n  amountIncludingTax: 400,\\n  taxAmount: 69\\n};\\n\\nconst lineItem2: Types.checkout.LineItem = {\\n  quantity: 2,\\n  amountExcludingTax: 248,\\n  description: \\&quot;Socks\\&quot;,\\n  id: \\&quot;Item #2\\&quot;,\\n  amountIncludingTax: 300,\\n  taxAmount: 52\\n};\\n\\nconst name: Types.checkout.Name = {\\n  firstName: \\&quot;Simon\\&quot;,\\n  lastName: \\&quot;Hopper\\&quot;\\n};\\n\\nconst deliveryAddress: Types.checkout.DeliveryAddress = {\\n  country: \\&quot;AU\\&quot;,\\n  stateOrProvince: \\&quot;NSW\\&quot;,\\n  city: \\&quot;Sydney\\&quot;,\\n  houseNumberOrName: \\&quot;123\\&quot;,\\n  street: \\&quot;Happy Street\\&quot;,\\n  postalCode: \\&quot;2000\\&quot;\\n};\\n\\nconst afterpayDetails: Types.checkout.AfterpayDetails = {\\n  type: Types.checkout.AfterpayDetails.TypeEnum.Afterpaytouch\\n};\\n\\nconst billingAddress: Types.checkout.BillingAddress = {\\n  country: \\&quot;AU\\&quot;,\\n  stateOrProvince: \\&quot;NSW\\&quot;,\\n  city: \\&quot;Sydney\\&quot;,\\n  houseNumberOrName: \\&quot;123\\&quot;,\\n  street: \\&quot;Happy Street\\&quot;,\\n  postalCode: \\&quot;2000\\&quot;\\n};\\n\\nconst paymentRequest: Types.checkout.PaymentRequest = {\\n  amount: amount,\\n  telephoneNumber: \\&quot;+61 2 8520 3890\\&quot;,\\n  shopperEmail: \\&quot;s.hopper@example.com\\&quot;,\\n  reference: \\&quot;YOUR_ORDER_REFERENCE\\&quot;,\\n  lineItems: [lineItem1, lineItem2],\\n  shopperName: name,\\n  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  deliveryAddress: deliveryAddress,\\n  countryCode: \\&quot;AU\\&quot;,\\n  paymentMethod: afterpayDetails,\\n  billingAddress: billingAddress,\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  shopperReference: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&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<h2>Handle the redirect<\/h2>\n<p>You must <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow?platform=Web&amp;integration=API%2Bonly&amp;version=71#handle-the-redirect\">handle the additional action<\/a>.<\/p>\n<p>The <code>action.type<\/code> is <span translate=\"no\"><strong>redirect<\/strong><\/span>.<\/p>\n<h2>Capture the payment<\/h2>\n<p>Depending on your merchant account configuration, Afterpay payments are captured automatically after authorisation, or manually captured. If you prefer to capture the payment after the goods have been sent, you need to set up a <a href=\"\/pt\/online-payments\/capture#delayed-automatic-capture\">capture delay<\/a> or use <a href=\"\/pt\/online-payments\/capture#capture-a-payment\">manual capture<\/a>. To partially capture a payment, you also need to use manual capture.<\/p>\n<p>Afterpay payments have to be captured within 13 days after authorisation.<\/p>\n<p>During authorisation, the shopper is charged for the first installment. If the payment is not captured within 13 days, before the second installment, Afterpay cancels the payment and refunds the first installment to the shopper.<\/p>\n<div class=\"notices blue\">\n<p>For testing purposes, Afterpay authorisations expire in one day. When you use manual capture, you need to capture test Afterpay payments within one day after authorisation.<\/p>\n<\/div>\n<h3 id=\"partial-captures\">Full or partial manual captures<\/h3>\n<p>When you use manual capture, in your  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/(paymentPspReference)\/captures\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments\/{paymentPspReference}\/captures<\/a> request specify:<\/p>\n<ul>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/(paymentPspReference)\/captures#request-amount-value\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">amount.value<\/a>: the full or partial amount that the shopper should pay.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/(paymentPspReference)\/captures#request-lineItems\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lineItems<\/a>: (optional) price and product information for the items that the shopper should pay for.<\/li>\n<\/ul>\n<p>Any unclaimed amount that is left over after partially capturing a payment is automatically cancelled. When your account is enabled for <em>multiple<\/em> partial captures, the unclaimed amount after an initial capture is not automatically cancelled.<\/p>\n<div class=\"sc-notice info\"><div>\n<p>To set up multiple partial captures, contact our <a href=\"https:\/\/ca-test.adyen.com\/ca\/ca\/contactUs\/support.shtml?form=other\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Support Team<\/a>. Multiple partial captures will create a new invoice for each capture.<\/p>\n<\/div><\/div>\n<h2>Refunds and cancellations<\/h2>\n<p>If a payment has not yet been captured, you can <a href=\"\/pt\/online-payments\/cancel\">cancel<\/a> it. If a payment has already been captured and you want to return the funds to the shopper, you need to <a href=\"\/pt\/online-payments\/refund\">refund<\/a> the payment.<\/p>\n<h3 id=\"partial-refunds\">Full or partial refunds<\/h3>\n<p>To fully or partially refund a payment, in your  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/(paymentPspReference)\/refunds\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments\/{paymentPspReference}\/refunds<\/a> request specify:<\/p>\n<ul>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/(paymentPspReference)\/refunds#request-amount-value\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">amount.value<\/a>: the full or partial amount to be refunded to the shopper.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/(paymentPspReference)\/refunds#request-lineItems\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lineItems<\/a>: (optional) price and product information about the refunded items.<\/li>\n<\/ul>\n<h2>Discounts<\/h2>\n<p>To offer discounts, your payment request must include the negative amount to be added to the original price. The following example shows how to specify a discount of 1 AUD on Item #2:<\/p>\n<pre><code class=\"language-json\">{\n  \"amount\":{\n     \"value\":800,\n     \"currency\":\"AUD\"\n  },\n  ...\n  \"lineItems\":[\n\n     {\n        \"description\":\"Test Afterpay 1\",\n        \"quantity\":\"1\",\n        \"amountIncludingTax\":\"400\",\n        \"id\":\"Item #1\"\n     },\n     {\n        \"description\":\"Test Afterpay 2\",\n        \"quantity\":\"2\",\n        \"amountIncludingTax\":\"300\",\n        \"id\":\"Item #2\"\n     }\n\n     {\n        \"description\":\"Discount\",\n        \"quantity\":\"2\",\n        \"amountIncludingTax\":\"-100\",\n        \"id\":\"Item #2 Discount\"\n     }\n  ]\n}<\/code><\/pre>\n<h2>Recurring and on-file payments<\/h2>\n<p>Afterpay supports <a href=\"\/pt\/online-payments\/tokenization\">tokenization<\/a> of the shopper's payment details for future recurring payments and on-file payments. On-file payments are later ad-hoc payments where you use the shopper's token. By getting the shopper's permission to save their payment details when you create the token, the shopper approval step is bypassed on future payments with the token.<\/p>\n<div class=\"notices yellow\">\n<p>Tokenization is only supported for Australia and New Zealand.<\/p>\n<\/div>\n<p>Proceed as follows:<\/p>\n<ol>\n<li>\n<p>Make sure you receive the tokens that we generate for your shoppers:<\/p>\n<ul>\n<li><a href=\"\/pt\/online-payments\/tokenization\/create-tokens#enable-the-webhook\">Enable tokenization webhooks<\/a>. You will receive the token in a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Tokenization-webhooks\/latest\/post\/recurring.token.created\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">recurring.token.created<\/a> webhook.<\/li>\n<li>\n<p>To receive the token in the API response as well: in your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a> go to <strong>Developers<\/strong> &gt; <strong>Additional data settings<\/strong> and enable <strong>Recurring details<\/strong>.<\/p>\n<!-- list separator -->\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>In your initial <code>\/payments<\/code> request, add parameters to create a token. This can be a request for a payment, or a zero-value authorization without payment.<br \/>\nThe shopper is redirected to Afterpay to approve:<\/p>\n<ul>\n<li>Paying the first installment as well as storing the payment details for future payments.<\/li>\n<li>Only storing the payment details for future payments, in case of a zero-value authorization.<\/li>\n<\/ul>\n\n<div id=\"tabsIJeO\">\n    <div data-component-wrapper=\"tabs\">\n        <tabs\n                        :items=\"[{&quot;title&quot;:&quot;Create a token with a payment&quot;,&quot;content&quot;:&quot;\\n&lt;p&gt;Make a POST &lt;code&gt;\\\/payments&lt;\\\/code&gt; request as usual, but add the &lt;a href=\\&quot;\\\/pt\\\/online-payments\\\/tokenization\\\/make-token-payments\\&quot;&gt;tokenization parameters&lt;\\\/a&gt;.&lt;\\\/p&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;&#039;\\&quot; :id=\\&quot;&#039;create-token&#039;\\&quot; :code-data=\\&quot;[{&amp;quot;language&amp;quot;:&amp;quot;bash&amp;quot;,&amp;quot;tabTitle&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;curl https:\\\\\\\/\\\\\\\/checkout-test.adyen.com\\\\\\\/v72\\\\\\\/payments \\\\\\\\\\\\n-H &#039;x-api-key: ADYEN_API_KEY&#039; \\\\\\\\\\\\n-H &#039;content-type: application\\\\\\\/json&#039; \\\\\\\\\\\\n-X POST\\\\n-d &#039;{\\\\n  \\\\&amp;quot;paymentMethod\\\\&amp;quot;:{\\\\n    \\\\&amp;quot;type\\\\&amp;quot;:\\\\&amp;quot;afterpaytouch\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;amount\\\\&amp;quot;:{\\\\n     \\\\&amp;quot;value\\\\&amp;quot;:1000,\\\\n     \\\\&amp;quot;currency\\\\&amp;quot;:\\\\&amp;quot;AUD\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;countryCode\\\\&amp;quot;:\\\\&amp;quot;AU\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperName\\\\&amp;quot;:{\\\\n     \\\\&amp;quot;firstName\\\\&amp;quot;:\\\\&amp;quot;Simon\\\\&amp;quot;,\\\\n     \\\\&amp;quot;lastName\\\\&amp;quot;:\\\\&amp;quot;Hopper\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;telephoneNumber\\\\&amp;quot;:\\\\&amp;quot;+61 2 8520 3890\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperEmail\\\\&amp;quot;:\\\\&amp;quot;s.hopper@example.com\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperReference\\\\&amp;quot;:\\\\&amp;quot;YOUR_UNIQUE_SHOPPER_ID\\\\&amp;quot;,\\\\n  \\\\&amp;quot;storePaymentMethod\\\\&amp;quot;:\\\\&amp;quot;true\\\\&amp;quot;,\\\\n  \\\\&amp;quot;recurringProcessingModel\\\\&amp;quot;:\\\\&amp;quot;CardOnFile\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperInteraction\\\\&amp;quot;:\\\\&amp;quot;Ecommerce\\\\&amp;quot;,\\\\n  \\\\&amp;quot;reference\\\\&amp;quot;:\\\\&amp;quot;YOUR_ORDER_REFERENCE\\\\&amp;quot;,\\\\n  \\\\&amp;quot;merchantAccount\\\\&amp;quot;:\\\\&amp;quot;ADYEN_MERCHANT_ACCOUNT\\\\&amp;quot;,\\\\n  \\\\&amp;quot;returnUrl\\\\&amp;quot;:\\\\&amp;quot;https:\\\\\\\/\\\\\\\/your-company.example.com\\\\\\\/checkout?shopperOrder=12xy..\\\\&amp;quot;,\\\\n  \\\\&amp;quot;billingAddress\\\\&amp;quot;:{\\\\n     \\\\&amp;quot;city\\\\&amp;quot;:\\\\&amp;quot;Sydney\\\\&amp;quot;,\\\\n     \\\\&amp;quot;country\\\\&amp;quot;:\\\\&amp;quot;AU\\\\&amp;quot;,\\\\n     \\\\&amp;quot;houseNumberOrName\\\\&amp;quot;:\\\\&amp;quot;123\\\\&amp;quot;,\\\\n     \\\\&amp;quot;postalCode\\\\&amp;quot;:\\\\&amp;quot;2000\\\\&amp;quot;,\\\\n     \\\\&amp;quot;stateOrProvince\\\\&amp;quot;:\\\\&amp;quot;NSW\\\\&amp;quot;,\\\\n     \\\\&amp;quot;street\\\\&amp;quot;:\\\\&amp;quot;Happy Street\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;deliveryAddress\\\\&amp;quot;:{\\\\n     \\\\&amp;quot;city\\\\&amp;quot;:\\\\&amp;quot;Sydney\\\\&amp;quot;,\\\\n     \\\\&amp;quot;country\\\\&amp;quot;:\\\\&amp;quot;AU\\\\&amp;quot;,\\\\n     \\\\&amp;quot;houseNumberOrName\\\\&amp;quot;:\\\\&amp;quot;123\\\\&amp;quot;,\\\\n     \\\\&amp;quot;postalCode\\\\&amp;quot;:\\\\&amp;quot;2000\\\\&amp;quot;,\\\\n     \\\\&amp;quot;stateOrProvince\\\\&amp;quot;:\\\\&amp;quot;NSW\\\\&amp;quot;,\\\\n     \\\\&amp;quot;street\\\\&amp;quot;:\\\\&amp;quot;Happy Street\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;lineItems\\\\&amp;quot;:[\\\\n     {\\\\n        \\\\&amp;quot;description\\\\&amp;quot;:\\\\&amp;quot;Shoes\\\\&amp;quot;,\\\\n        \\\\&amp;quot;quantity\\\\&amp;quot;:\\\\&amp;quot;1\\\\&amp;quot;,\\\\n        \\\\&amp;quot;amountIncludingTax\\\\&amp;quot;:\\\\&amp;quot;400\\\\&amp;quot;,\\\\n        \\\\&amp;quot;amountExcludingTax\\\\&amp;quot;: \\\\&amp;quot;331\\\\&amp;quot;,\\\\n        \\\\&amp;quot;taxAmount\\\\&amp;quot;: \\\\&amp;quot;69\\\\&amp;quot;,\\\\n        \\\\&amp;quot;id\\\\&amp;quot;:\\\\&amp;quot;Item #1\\\\&amp;quot;\\\\n     },\\\\n     {\\\\n        \\\\&amp;quot;description\\\\&amp;quot;:\\\\&amp;quot;Socks\\\\&amp;quot;,\\\\n        \\\\&amp;quot;quantity\\\\&amp;quot;:\\\\&amp;quot;2\\\\&amp;quot;,\\\\n        \\\\&amp;quot;amountIncludingTax\\\\&amp;quot;:\\\\&amp;quot;300\\\\&amp;quot;,\\\\n        \\\\&amp;quot;amountExcludingTax\\\\&amp;quot;: \\\\&amp;quot;248\\\\&amp;quot;,\\\\n        \\\\&amp;quot;taxAmount\\\\&amp;quot;: \\\\&amp;quot;52\\\\&amp;quot;,\\\\n        \\\\&amp;quot;id\\\\&amp;quot;:\\\\&amp;quot;Item #2\\\\&amp;quot;\\\\n     }\\\\n  ]\\\\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&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:&quot;create_a_token_with_a_payment_0_1&quot;,&quot;relation&quot;:&quot;&quot;},{&quot;title&quot;:&quot;Create a token through zero-value authorization&quot;,&quot;content&quot;:&quot;\\n&lt;p&gt;Make a POST &lt;code&gt;\\\/payments&lt;\\\/code&gt; request with:&lt;\\\/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;The &lt;a href=\\&quot;\\\/pt\\\/online-payments\\\/tokenization\\\/create-tokens\\&quot;&gt;tokenization parameters&lt;\\\/a&gt;.&lt;\\\/li&gt;\\n&lt;li&gt;An &lt;code&gt;amount.value&lt;\\\/code&gt; of &lt;strong&gt;0&lt;\\\/strong&gt; (zero).&lt;\\\/li&gt;\\n&lt;\\\/ul&gt;\\n&lt;p&gt;&lt;\\\/p&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;&#039;\\&quot; :id=\\&quot;&#039;zero-auth&#039;\\&quot; :code-data=\\&quot;[{&amp;quot;language&amp;quot;:&amp;quot;bash&amp;quot;,&amp;quot;tabTitle&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;curl https:\\\\\\\/\\\\\\\/checkout-test.adyen.com\\\\\\\/v72\\\\\\\/payments \\\\\\\\\\\\n-H &#039;x-api-key: ADYEN_API_KEY&#039; \\\\\\\\\\\\n-H &#039;content-type: application\\\\\\\/json&#039; \\\\\\\\\\\\n-X POST\\\\n-d &#039;{\\\\n  \\\\&amp;quot;paymentMethod\\\\&amp;quot;:{\\\\n    \\\\&amp;quot;type\\\\&amp;quot;:\\\\&amp;quot;afterpaytouch\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;amount\\\\&amp;quot;:{\\\\n     \\\\&amp;quot;value\\\\&amp;quot;:0,\\\\n     \\\\&amp;quot;currency\\\\&amp;quot;:\\\\&amp;quot;AUD\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;countryCode\\\\&amp;quot;:\\\\&amp;quot;AU\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperName\\\\&amp;quot;:{\\\\n     \\\\&amp;quot;firstName\\\\&amp;quot;:\\\\&amp;quot;Simon\\\\&amp;quot;,\\\\n     \\\\&amp;quot;lastName\\\\&amp;quot;:\\\\&amp;quot;Hopper\\\\&amp;quot;\\\\n  },\\\\n  \\\\&amp;quot;telephoneNumber\\\\&amp;quot;:\\\\&amp;quot;+61 2 8520 3890\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperEmail\\\\&amp;quot;:\\\\&amp;quot;s.hopper@example.com\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperReference\\\\&amp;quot;:\\\\&amp;quot;YOUR_UNIQUE_SHOPPER_ID\\\\&amp;quot;,\\\\n  \\\\&amp;quot;recurringProcessingModel\\\\&amp;quot;:\\\\&amp;quot;CardOnFile\\\\&amp;quot;,\\\\n  \\\\&amp;quot;storePaymentMethod\\\\&amp;quot;:\\\\&amp;quot;true\\\\&amp;quot;,\\\\n  \\\\&amp;quot;shopperInteraction\\\\&amp;quot;:\\\\&amp;quot;Ecommerce\\\\&amp;quot;,\\\\n  \\\\&amp;quot;reference\\\\&amp;quot;:\\\\&amp;quot;YOUR_ORDER_REFERENCE\\\\&amp;quot;,\\\\n  \\\\&amp;quot;merchantAccount\\\\&amp;quot;:\\\\&amp;quot;ADYEN_MERCHANT_ACCOUNT\\\\&amp;quot;,\\\\n  \\\\&amp;quot;returnUrl\\\\&amp;quot;:\\\\&amp;quot;https:\\\\\\\/\\\\\\\/your-company.example.com\\\\\\\/checkout?shopperOrder=12xy..\\\\&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&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:&quot;create_a_token_through_zero-value_authorization_1_2&quot;,&quot;relation&quot;:&quot;&quot;}]\"\n            :should-update-when-url-changes='false'>\n        <\/tabs>\n    <\/div>\n<\/div>\n\n<div class=\"notices green\">\n<p>The shopper is <strong>redirected to Afterpay<\/strong> as usual.<\/p>\n<\/div>\n<\/li>\n<li>\n<p>From the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Tokenization-webhooks\/latest\/post\/recurring.token.created\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">recurring.token.created<\/a> webhook, save the following data in your system:<\/p>\n<ul>\n<li><code>storedPaymentMethodId<\/code>: the token that we generated for the shopper. For example: <span translate=\"no\"><strong>M5N7TQ4TG5PFWR50<\/strong><\/span>.<\/li>\n<li><code>shopperReference<\/code>: your unique identification of the shopper.<\/li>\n<\/ul>\n<p>The <code>\/payments\/details<\/code> response returns this data in the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/details#responses-200-additionalData-ResponseAdditionalDataCommon\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">additionalData<\/a> object.<\/p>\n<\/li>\n<li>\n<p>If your request included paying the first installment, make sure the payment is <a href=\"#capture-the-payment\">captured<\/a>.<\/p>\n<\/li>\n<li>\n<p>In later payments for the same shopper, in your <code>\/payments<\/code> request add the shopper's <code>storedPaymentMethodId<\/code>. See <a href=\"\/pt\/online-payments\/tokenization\/make-token-payments\">Pay with a token<\/a> for more details.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"''\" :id=\"'tokenized-payments'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&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-X POST\\n-d '{\\n  \\&quot;paymentMethod\\&quot;:{\\n    \\&quot;type\\&quot;:\\&quot;afterpaytouch\\&quot;,\\n    \\&quot;storedPaymentMethodId\\&quot;:\\&quot;M5N7TQ4TG5PFWR50\\&quot;\\n  },\\n  \\&quot;amount\\&quot;:{\\n     \\&quot;value\\&quot;:1000,\\n     \\&quot;currency\\&quot;:\\&quot;AUD\\&quot;\\n  },\\n  \\&quot;countryCode\\&quot;:\\&quot;AU\\&quot;,\\n  \\&quot;shopperName\\&quot;:{\\n     \\&quot;firstName\\&quot;:\\&quot;Simon\\&quot;,\\n     \\&quot;lastName\\&quot;:\\&quot;Hopper\\&quot;\\n  },\\n  \\&quot;telephoneNumber\\&quot;:\\&quot;+61 2 8520 3890\\&quot;,\\n  \\&quot;shopperEmail\\&quot;:\\&quot;s.hopper@example.com\\&quot;,\\n  \\&quot;shopperReference\\&quot;:\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  \\&quot;shopperInteraction\\&quot;:\\&quot;ContAuth\\&quot;,\\n  \\&quot;recurringProcessingModel\\&quot;:\\&quot;CardOnFile\\&quot;,\\n  \\&quot;reference\\&quot;:\\&quot;YOUR_ORDER_REFERENCE\\&quot;,\\n  \\&quot;merchantAccount\\&quot;:\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  \\&quot;billingAddress\\&quot;:{\\n     \\&quot;city\\&quot;:\\&quot;Sydney\\&quot;,\\n     \\&quot;country\\&quot;:\\&quot;AU\\&quot;,\\n     \\&quot;houseNumberOrName\\&quot;:\\&quot;123\\&quot;,\\n     \\&quot;postalCode\\&quot;:\\&quot;2000\\&quot;,\\n     \\&quot;stateOrProvince\\&quot;:\\&quot;NSW\\&quot;,\\n     \\&quot;street\\&quot;:\\&quot;Happy Street\\&quot;\\n  },\\n  \\&quot;deliveryAddress\\&quot;:{\\n     \\&quot;city\\&quot;:\\&quot;Sydney\\&quot;,\\n     \\&quot;country\\&quot;:\\&quot;AU\\&quot;,\\n     \\&quot;houseNumberOrName\\&quot;:\\&quot;123\\&quot;,\\n     \\&quot;postalCode\\&quot;:\\&quot;2000\\&quot;,\\n     \\&quot;stateOrProvince\\&quot;:\\&quot;NSW\\&quot;,\\n     \\&quot;street\\&quot;:\\&quot;Happy Street\\&quot;\\n  },\\n  \\&quot;lineItems\\&quot;:[\\n     {\\n        \\&quot;description\\&quot;:\\&quot;Shoes\\&quot;,\\n        \\&quot;quantity\\&quot;:\\&quot;1\\&quot;,\\n        \\&quot;amountIncludingTax\\&quot;:\\&quot;400\\&quot;,\\n        \\&quot;amountExcludingTax\\&quot;: \\&quot;331\\&quot;,\\n        \\&quot;taxAmount\\&quot;: \\&quot;69\\&quot;,\\n        \\&quot;id\\&quot;:\\&quot;Item #1\\&quot;\\n     },\\n     {\\n        \\&quot;description\\&quot;:\\&quot;Socks\\&quot;,\\n        \\&quot;quantity\\&quot;:\\&quot;2\\&quot;,\\n        \\&quot;amountIncludingTax\\&quot;:\\&quot;300\\&quot;,\\n        \\&quot;amountExcludingTax\\&quot;: \\&quot;248\\&quot;,\\n        \\&quot;taxAmount\\&quot;: \\&quot;52\\&quot;,\\n        \\&quot;id\\&quot;:\\&quot;Item #2\\&quot;\\n     }\\n  ]\\n}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<div class=\"notices green\">\n<p>The shopper is <strong>not redirected to Afterpay<\/strong> because they have given their approval for the use of their stored payment details.<\/p>\n<\/div>\n<\/li>\n<li>\n<p>In the <code>\/payments<\/code> response, note that this includes the <code>pspReference<\/code>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'\/payments response for a tokenized payment'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n  \\\"amount\\\": {\\n    \\\"value\\\": 1000,\\n    \\\"currency\\\": \\\"AUD\\\"\\n  },\\n  \\\"resultCode\\\": \\\"Authorised\\\",\\n  \\\"afterpaytouch.consumerReference\\\": \\\"cdc4f629fdb91725ca22d693730184e67b3a3e7f46d66d4844dedf7ecf793b53\\\",\\n  \\\"pspReference\\\": \\\"VK9DRSLLRCQ2WN82\\\",\\n  \\\"paymentMethod\\\": {\\n    \\\"type\\\": \\\"afterpaytouch\\\"\\n  },\\n  \\\"merchantReference\\\": \\\"YOUR_ORDER_REFERENCE\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Make sure the payment is captured.<\/p>\n<\/li>\n<\/ol>\n<h2>Test and go live<\/h2>\n<p>To test Afterpay payments, you need a test shopper account in the Afterpay sandbox environment. If you are testing in multiple countries or regions, create a different test account for each.<\/p>\n<p>To create a test account:<\/p>\n<ol>\n<li>Go to <a href=\"https:\/\/portal.sandbox.afterpay.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">https:\/\/portal.sandbox.afterpay.com\/<\/a>.<\/li>\n<li>Enter a real email address and select <strong>Continue<\/strong>. You'll get confirmations of payments and refunds like any other shopper on this email address.<\/li>\n<li>From the drop-down menu, select the country\/region for which you want to create a test shopper account. Select <strong>Australia<\/strong>, <strong>New Zealand<\/strong>, <strong>US<\/strong>, or <strong>Canada<\/strong>.<\/li>\n<li>Enter a unique mobile number in the correct format and select <strong>Continue<\/strong>. Ensure the number is not associated with an existing account to avoid being redirected to a login page.<\/li>\n<li>When you are prompted to enter your SMS verification code, enter <strong>111111<\/strong>.<\/li>\n<li>Follow the instructions on your screen to complete your profile, accept the terms and conditions, and select <strong>Continue<\/strong>.<\/li>\n<\/ol>\n<p> <\/p>\n<p>To test payments, add a test card to your Afterpay test shopper account.<\/p>\n<p>You can use the card details provided in the <a href=\"https:\/\/developers.afterpay.com\/afterpay-online-developer\/home\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Afterpay developer documentation<\/a>, or use one of the Adyen <a href=\"\/pt\/development-resources\/test-cards-and-credentials\/test-card-numbers\">test cards<\/a>. Use CVV 000 to simulate authorised payments, or CVV 051 to simulate refused payments.<\/p>\n<p> <\/p>\n<p>You can check the status of test payments 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;\u00a0<strong>Payments<\/strong>.<\/p>\n<p> <\/p>\n<p>Before you can accept live Afterpay payments, you need to <a href=\"\/pt\/payment-methods\/add-payment-methods\">submit a request for Afterpay<\/a> in your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">live Customer Area<\/a>.<\/p>\n<h2>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=\"\/development-resources\/webhooks\"\n                        target=\"_self\"\n                        >\n                    Webhooks\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\/afterpaytouch\/api-only","articleFields":{"description":"Add Afterpay to an existing API-only integration.","id":"42832270","type":"page","parameters":{"action_type":"redirect","integration":"API-only","platform":"Web","integration_guide_url":"\/online-payments\/build-your-integration\/advanced-flow?platform=Web&integration=API%20only","payment_method":"Afterpay","payment_method_uk":"Clearpay","country_code":"AU","currency_code":"AUD","country_code_uk":"GB","currency_code_uk":"GBP","city":"Sydney","city_uk":"London","housenumberorname":123,"housenumberorname_uk":"8-10","postalcode":2000,"postalcode_uk":"SW1H 0BG","street":"Happy Street","street_uk":"Broadway","stateorprovince":"NSW","stateorprovince_uk":"Westminster","payment_method_type":"afterpaytouch","payment_method_type_uk":"clearpay","shopper_email":"s.hopper@example.com","telephone_number":"+61 2 8520 3890","telephone_number_uk":"+44 203 936 4029","return_url":"https:\/\/your-company.example.com\/checkout?shopperOrder=12xy.."},"feedback_component":true},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/afterpaytouch\/api-only","title":"Afterpay for API only","content":"You can add Afterpay to your existing integration. The following instructions show only what you must add to your integration specifically for Afterpay.\nIf an instruction on this page corresponds with a step in the main integration guide, it includes a link to the corresponding step of the main integration guide.\nRequirements\n\n\n\nRequirement\nDescription\n\n\n\n\nIntegration type\nMake sure that you have an existing API-only integration.  This page includes only instructions to add Afterpay to your existing integration.\n\n\n\nCheckout API\nMake sure that you use Checkout API v or later.\n \n\n\nRedirect handling\nMake sure that your existing integration is set up to handle the redirect.   action.type: redirect\n\n\n\nLimitations\nTokenization for recurring and on-file payments is only supported for Australia and New Zealand.\n\n\nSetup steps\nBefore you begin, add Afterpay in your Customer Area.\n\n\n\nGet Afterpay as an available payment method\nWhen you make the  \/paymentMethods call to get available payment methods, specify one of the following combinations of  countryCode and  amount.currency so that Afterpay is included in the response.\n\n\n\nCountry\/region\ncountryCode\namount.currency\n\n\n\n\nAustralia\nAU\nAUD\n\n\nNew Zealand\nNZ\nNZD\n\n\nCanada\nCA\nCAD\n\n\n\nBuild your payment form\n\nWe provide the logo for Afterpay that you can download.\n\nTo perform risk checks, Afterpay requires you to collect the following shopper details:\n\nFull name\nEmail address\nBilling address and delivery address.\n\nAccept Afterpay payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.\nAdd additional parameters to your \/payments request\nWhen you make a payment, add the following parameters:\n\n\n\nParameter name\nRequired\nDescription\n\n\n\n\npaymentMethod\n\nafterpaytouch\n\n\n shopperName\n\nThe shopper's full name.\n\n\n shopperEmail\n\nThe shopper's email address.\n\n\n shopperReference\n\nA unique reference to identify the shopper. Minimum length: three characters.\n\n\n countryCode\n\nThe shopper's country\/region.\n\n\n billingAddress\n\nThe postal address to be included on the invoice.\n\n\n deliveryAddress\n\nThe postal address where the goods will be shipped.\n\n\n lineItems\n\nPrice and product information about the purchased items.\n\n\n telephoneNumber\n\nThe shopper's telephone number, if provided.\n\n\n\n\n    \n\nHandle the redirect\nYou must handle the additional action.\nThe action.type is redirect.\nCapture the payment\nDepending on your merchant account configuration, Afterpay payments are captured automatically after authorisation, or manually captured. If you prefer to capture the payment after the goods have been sent, you need to set up a capture delay or use manual capture. To partially capture a payment, you also need to use manual capture.\nAfterpay payments have to be captured within 13 days after authorisation.\nDuring authorisation, the shopper is charged for the first installment. If the payment is not captured within 13 days, before the second installment, Afterpay cancels the payment and refunds the first installment to the shopper.\n\nFor testing purposes, Afterpay authorisations expire in one day. When you use manual capture, you need to capture test Afterpay payments within one day after authorisation.\n\nFull or partial manual captures\nWhen you use manual capture, in your  \/payments\/{paymentPspReference}\/captures request specify:\n\n amount.value: the full or partial amount that the shopper should pay.\n lineItems: (optional) price and product information for the items that the shopper should pay for.\n\nAny unclaimed amount that is left over after partially capturing a payment is automatically cancelled. When your account is enabled for multiple partial captures, the unclaimed amount after an initial capture is not automatically cancelled.\n\nTo set up multiple partial captures, contact our Support Team. Multiple partial captures will create a new invoice for each capture.\n\nRefunds and cancellations\nIf a payment has not yet been captured, you can cancel it. If a payment has already been captured and you want to return the funds to the shopper, you need to refund the payment.\nFull or partial refunds\nTo fully or partially refund a payment, in your  \/payments\/{paymentPspReference}\/refunds request specify:\n\n amount.value: the full or partial amount to be refunded to the shopper.\n lineItems: (optional) price and product information about the refunded items.\n\nDiscounts\nTo offer discounts, your payment request must include the negative amount to be added to the original price. The following example shows how to specify a discount of 1 AUD on Item #2:\n{\n  \"amount\":{\n     \"value\":800,\n     \"currency\":\"AUD\"\n  },\n  ...\n  \"lineItems\":[\n\n     {\n        \"description\":\"Test Afterpay 1\",\n        \"quantity\":\"1\",\n        \"amountIncludingTax\":\"400\",\n        \"id\":\"Item #1\"\n     },\n     {\n        \"description\":\"Test Afterpay 2\",\n        \"quantity\":\"2\",\n        \"amountIncludingTax\":\"300\",\n        \"id\":\"Item #2\"\n     }\n\n     {\n        \"description\":\"Discount\",\n        \"quantity\":\"2\",\n        \"amountIncludingTax\":\"-100\",\n        \"id\":\"Item #2 Discount\"\n     }\n  ]\n}\nRecurring and on-file payments\nAfterpay supports tokenization of the shopper's payment details for future recurring payments and on-file payments. On-file payments are later ad-hoc payments where you use the shopper's token. By getting the shopper's permission to save their payment details when you create the token, the shopper approval step is bypassed on future payments with the token.\n\nTokenization is only supported for Australia and New Zealand.\n\nProceed as follows:\n\n\nMake sure you receive the tokens that we generate for your shoppers:\n\nEnable tokenization webhooks. You will receive the token in a  recurring.token.created webhook.\n\nTo receive the token in the API response as well: in your Customer Area go to Developers &gt; Additional data settings and enable Recurring details.\n\n\n\n\n\nIn your initial \/payments request, add parameters to create a token. This can be a request for a payment, or a zero-value authorization without payment.\nThe shopper is redirected to Afterpay to approve:\n\nPaying the first installment as well as storing the payment details for future payments.\nOnly storing the payment details for future payments, in case of a zero-value authorization.\n\n\n\n    \n        \n        \n    \n\n\n\nThe shopper is redirected to Afterpay as usual.\n\n\n\nFrom the  recurring.token.created webhook, save the following data in your system:\n\nstoredPaymentMethodId: the token that we generated for the shopper. For example: M5N7TQ4TG5PFWR50.\nshopperReference: your unique identification of the shopper.\n\nThe \/payments\/details response returns this data in the  additionalData object.\n\n\nIf your request included paying the first installment, make sure the payment is captured.\n\n\nIn later payments for the same shopper, in your \/payments request add the shopper's storedPaymentMethodId. See Pay with a token for more details.\n\n\n\n\nThe shopper is not redirected to Afterpay because they have given their approval for the use of their stored payment details.\n\n\n\nIn the \/payments response, note that this includes the pspReference.\n\n\n\n\n\nMake sure the payment is captured.\n\n\nTest and go live\nTo test Afterpay payments, you need a test shopper account in the Afterpay sandbox environment. If you are testing in multiple countries or regions, create a different test account for each.\nTo create a test account:\n\nGo to https:\/\/portal.sandbox.afterpay.com\/.\nEnter a real email address and select Continue. You'll get confirmations of payments and refunds like any other shopper on this email address.\nFrom the drop-down menu, select the country\/region for which you want to create a test shopper account. Select Australia, New Zealand, US, or Canada.\nEnter a unique mobile number in the correct format and select Continue. Ensure the number is not associated with an existing account to avoid being redirected to a login page.\nWhen you are prompted to enter your SMS verification code, enter 111111.\nFollow the instructions on your screen to complete your profile, accept the terms and conditions, and select Continue.\n\n \nTo test payments, add a test card to your Afterpay test shopper account.\nYou can use the card details provided in the Afterpay developer documentation, or use one of the Adyen test cards. Use CVV 000 to simulate authorised payments, or CVV 051 to simulate refused payments.\n \nYou can check the status of test payments in your\u00a0Customer Area\u00a0&gt;\u00a0Transactions\u00a0&gt;\u00a0Payments.\n \nBefore you can accept live Afterpay payments, you need to submit a request for Afterpay in your live Customer Area.\nSee also\n\n\n                    API-only integration guide\n                \n                    Webhooks\n                \n                    API Explorer\n                \n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Payment methods","lvl2":"Afterpay","lvl3":"Afterpay 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\/afterpaytouch","lvl3":"\/pt\/payment-methods\/afterpaytouch\/api-only"},"levels":4,"category":"Payment method","category_color":"green","tags":["Afterpay"]},"articleFiles":{"payments.js":"<p alt=\"\">payments.js<\/p>"}}
