{"title":"Affirm for API only","category":"default","creationDate":1776961628,"content":"<p>Accept Affirm 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<p>When making an Affirm payment, you also need to:<\/p>\n<ol>\n<li>Provide details about the items being purchased <a href=\"#make-a-payment\">when making a payment request<\/a>.<\/li>\n<li><a href=\"#capture-the-payment\">Capture<\/a> the payment after the transaction has been fulfilled. When the payment has been captured, Affirm starts the repayment period for the shopper.<\/li>\n<\/ol>\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 <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>Setup steps<\/strong><\/td>\n<td style=\"text-align: left;\">Before you begin, <a href=\"\/pt\/payment-methods\/add-payment-methods\">add Affirm in your test Customer Area<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Build your payment form for Affirm<\/h2>\n<p>To make an Affirm payment, you need to collect the following shopper details:<\/p>\n<table>\n<thead>\n<tr>\n<th>Name<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>firstName<\/code><\/td>\n<td>Shopper's first name.<\/td>\n<\/tr>\n<tr>\n<td><code>lastName<\/code><\/td>\n<td>Shopper's last name.<\/td>\n<\/tr>\n<tr>\n<td><code>telephoneNumber<\/code><\/td>\n<td>Shopper's phone number.<\/td>\n<\/tr>\n<tr>\n<td><code>shopperEmail<\/code><\/td>\n<td>Shopper's email address.<\/td>\n<\/tr>\n<tr>\n<td><code>billingAddress<\/code><\/td>\n<td>The address where to send the invoice.<\/td>\n<\/tr>\n<tr>\n<td><code>deliveryAddress<\/code><\/td>\n<td>The address where the purchased goods should be delivered.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"notices green\">\n<p>We provide an Affirm logo which you can use in your payment form. For more information, refer to <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=API%20only#downloading-logos\">Downloading logos<\/a>.<\/p>\n<\/div>\n<h2 id=\"make-a-payment\">Make a payment<\/h2>\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, specifying:<\/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.type<\/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>Set to <span translate=\"no\"><strong>affirm<\/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>Shopper's first name and last name.<\/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;\"><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 phone number.<\/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;\"><\/td>\n<td>The shopper's country in two-letter <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO_3166-1_alpha-2\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">ISO 3166-1 alpha-2<\/a> format. <div class=\"sc-notice note\"><div>Required when transacting in Canada or the United Kingdom, because the default <span translate=\"no\"><strong>US<\/strong><\/span> is used if you omit this parameter.<\/div><\/div><\/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;\"><\/td>\n<td>The address where to send the invoice. The <code>stateOrProvince<\/code> address field is required for Canada and the US, and optional for the UK.<\/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;\"><\/td>\n<td>The address where the purchased goods should be delivered. The <code>stateOrProvince<\/code> address field is required for Canada and the US, and optional for the UK. <br> If blank or missing, <code>billingAddress<\/code> is used by default.<\/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;\"><\/td>\n<td>Price and product information about the purchased items. This is optional, but we recommend to include this data to improve approval rates.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"''\" :id=\"'affirm-api-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;merchantAccount\\&quot;:\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n    \\&quot;countryCode\\&quot;:\\&quot;US\\&quot;,\\n    \\&quot;amount\\&quot;:{\\n       \\&quot;currency\\&quot;:\\&quot;USD\\&quot;,\\n       \\&quot;value\\&quot;: 1000\\n    },\\n    \\&quot;shopperReference\\&quot;:\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n    \\&quot;reference\\&quot;:\\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n    \\&quot;channel\\&quot;: \\&quot;Web\\&quot;,\\n    \\&quot;paymentMethod\\&quot;: {\\n        \\&quot;type\\&quot;: \\&quot;affirm\\&quot;\\n      },\\n    \\&quot;shopperName\\&quot;: {\\n      \\&quot;firstName\\&quot;: \\&quot;Simon\\&quot;,\\n      \\&quot;lastName\\&quot;: \\&quot;Hopper\\&quot;\\n    },\\n    \\&quot;telephoneNumber\\&quot;: \\&quot;+31612345678\\&quot;,\\n    \\&quot;shopperEmail\\&quot;: \\&quot;s.hopper@example.com\\&quot;,\\n    \\&quot;billingAddress\\&quot;: {\\n      \\&quot;city\\&quot;: \\&quot;San Francisco\\&quot;,\\n      \\&quot;country\\&quot;: \\&quot;US\\&quot;,\\n      \\&quot;houseNumberOrName\\&quot;: \\&quot;274\\&quot;,\\n      \\&quot;postalCode\\&quot;: \\&quot;94107\\&quot;,\\n      \\&quot;stateOrProvince\\&quot;: \\&quot;CA\\&quot;,\\n      \\&quot;street\\&quot;: \\&quot;Brannan St.\\&quot;\\n    },\\n    \\&quot;deliveryAddress\\&quot;: {\\n      \\&quot;city\\&quot;: \\&quot;San Francisco\\&quot;,\\n      \\&quot;country\\&quot;: \\&quot;US\\&quot;,\\n      \\&quot;houseNumberOrName\\&quot;: \\&quot;274\\&quot;,\\n      \\&quot;postalCode\\&quot;: \\&quot;94107\\&quot;,\\n      \\&quot;stateOrProvince\\&quot;: \\&quot;CA\\&quot;,\\n      \\&quot;street\\&quot;: \\&quot;Brannan St.\\&quot;\\n    },\\n\\t  \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n    \\&quot;lineItems\\&quot;:[\\n       {\\n          \\&quot;quantity\\&quot;: \\&quot;1\\&quot;,\\n          \\&quot;amountExcludingTax\\&quot;: \\&quot;331\\&quot;,\\n          \\&quot;description\\&quot;: \\&quot;Shoes\\&quot;,\\n          \\&quot;id\\&quot;: \\&quot;Item #1\\&quot;,\\n          \\&quot;taxAmount\\&quot;: \\&quot;69\\&quot;,\\n          \\&quot;productUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;,\\n          \\&quot;imageUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;\\n       },\\n       {\\n          \\&quot;quantity\\&quot;: \\&quot;2\\&quot;,\\n          \\&quot;amountExcludingTax\\&quot;: \\&quot;248\\&quot;,\\n          \\&quot;description\\&quot;: \\&quot;Socks\\&quot;,\\n          \\&quot;id\\&quot;: \\&quot;Item #2\\&quot;,\\n          \\&quot;taxAmount\\&quot;: \\&quot;52\\&quot;,\\n\\t\\t      \\&quot;productUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;,\\n          \\&quot;imageUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&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;USD\\&quot;)\\n  .value(1000L);\\n\\nLineItem lineItem1 = new LineItem()\\n  .quantity(1L)\\n  .amountExcludingTax(331L)\\n  .imageUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;)\\n  .description(\\&quot;Shoes\\&quot;)\\n  .id(\\&quot;Item #1\\&quot;)\\n  .taxAmount(69L)\\n  .productUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;);\\n\\nLineItem lineItem2 = new LineItem()\\n  .quantity(2L)\\n  .amountExcludingTax(248L)\\n  .imageUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&quot;)\\n  .description(\\&quot;Socks\\&quot;)\\n  .id(\\&quot;Item #2\\&quot;)\\n  .taxAmount(52L)\\n  .productUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;);\\n\\nName name = new Name()\\n  .firstName(\\&quot;Simon\\&quot;)\\n  .lastName(\\&quot;Hopper\\&quot;);\\n\\nDeliveryAddress deliveryAddress = new DeliveryAddress()\\n  .country(\\&quot;US\\&quot;)\\n  .stateOrProvince(\\&quot;CA\\&quot;)\\n  .city(\\&quot;San Francisco\\&quot;)\\n  .houseNumberOrName(\\&quot;274\\&quot;)\\n  .street(\\&quot;Brannan St.\\&quot;)\\n  .postalCode(\\&quot;94107\\&quot;);\\n\\nPaymentDetails paymentDetails = new PaymentDetails()\\n  .type(PaymentDetails.TypeEnum.AFFIRM);\\n\\nBillingAddress billingAddress = new BillingAddress()\\n  .country(\\&quot;US\\&quot;)\\n  .stateOrProvince(\\&quot;CA\\&quot;)\\n  .city(\\&quot;San Francisco\\&quot;)\\n  .houseNumberOrName(\\&quot;274\\&quot;)\\n  .street(\\&quot;Brannan St.\\&quot;)\\n  .postalCode(\\&quot;94107\\&quot;);\\n\\nPaymentRequest paymentRequest = new PaymentRequest()\\n  .amount(amount)\\n  .telephoneNumber(\\&quot;+31612345678\\&quot;)\\n  .channel(PaymentRequest.ChannelEnum.WEB)\\n  .shopperEmail(\\&quot;s.hopper@example.com\\&quot;)\\n  .reference(\\&quot;YOUR_ORDER_NUMBER\\&quot;)\\n  .lineItems(Arrays.asList(lineItem1, lineItem2))\\n  .shopperName(name)\\n  .merchantAccount(\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;)\\n  .deliveryAddress(deliveryAddress)\\n  .countryCode(\\&quot;US\\&quot;)\\n  .paymentMethod(new CheckoutPaymentMethod(paymentDetails))\\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;USD\\&quot;)\\n  -&gt;setValue(1000);\\n\\n$lineItem1 = new LineItem();\\n$lineItem1\\n  -&gt;setQuantity(1)\\n  -&gt;setAmountExcludingTax(331)\\n  -&gt;setImageUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;)\\n  -&gt;setDescription(\\&quot;Shoes\\&quot;)\\n  -&gt;setId(\\&quot;Item #1\\&quot;)\\n  -&gt;setTaxAmount(69)\\n  -&gt;setProductUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;);\\n\\n$lineItem2 = new LineItem();\\n$lineItem2\\n  -&gt;setQuantity(2)\\n  -&gt;setAmountExcludingTax(248)\\n  -&gt;setImageUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&quot;)\\n  -&gt;setDescription(\\&quot;Socks\\&quot;)\\n  -&gt;setId(\\&quot;Item #2\\&quot;)\\n  -&gt;setTaxAmount(52)\\n  -&gt;setProductUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;);\\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;US\\&quot;)\\n  -&gt;setStateOrProvince(\\&quot;CA\\&quot;)\\n  -&gt;setCity(\\&quot;San Francisco\\&quot;)\\n  -&gt;setHouseNumberOrName(\\&quot;274\\&quot;)\\n  -&gt;setStreet(\\&quot;Brannan St.\\&quot;)\\n  -&gt;setPostalCode(\\&quot;94107\\&quot;);\\n\\n$checkoutPaymentMethod = new CheckoutPaymentMethod();\\n$checkoutPaymentMethod\\n  -&gt;setType(\\&quot;affirm\\&quot;);\\n\\n$billingAddress = new BillingAddress();\\n$billingAddress\\n  -&gt;setCountry(\\&quot;US\\&quot;)\\n  -&gt;setStateOrProvince(\\&quot;CA\\&quot;)\\n  -&gt;setCity(\\&quot;San Francisco\\&quot;)\\n  -&gt;setHouseNumberOrName(\\&quot;274\\&quot;)\\n  -&gt;setStreet(\\&quot;Brannan St.\\&quot;)\\n  -&gt;setPostalCode(\\&quot;94107\\&quot;);\\n\\n$paymentRequest = new PaymentRequest();\\n$paymentRequest\\n  -&gt;setAmount($amount)\\n  -&gt;setTelephoneNumber(\\&quot;+31612345678\\&quot;)\\n  -&gt;setChannel(\\&quot;Web\\&quot;)\\n  -&gt;setShopperEmail(\\&quot;s.hopper@example.com\\&quot;)\\n  -&gt;setReference(\\&quot;YOUR_ORDER_NUMBER\\&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;US\\&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;USD\\&quot;,\\n  Value = 1000\\n};\\n\\nLineItem lineItem1 = new LineItem\\n{\\n  Quantity = 1,\\n  AmountExcludingTax = 331,\\n  ImageUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;,\\n  Description = \\&quot;Shoes\\&quot;,\\n  Id = \\&quot;Item #1\\&quot;,\\n  TaxAmount = 69,\\n  ProductUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;\\n};\\n\\nLineItem lineItem2 = new LineItem\\n{\\n  Quantity = 2,\\n  AmountExcludingTax = 248,\\n  ImageUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&quot;,\\n  Description = \\&quot;Socks\\&quot;,\\n  Id = \\&quot;Item #2\\&quot;,\\n  TaxAmount = 52,\\n  ProductUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;\\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;US\\&quot;,\\n  StateOrProvince = \\&quot;CA\\&quot;,\\n  City = \\&quot;San Francisco\\&quot;,\\n  HouseNumberOrName = \\&quot;274\\&quot;,\\n  Street = \\&quot;Brannan St.\\&quot;,\\n  PostalCode = \\&quot;94107\\&quot;\\n};\\n\\nPaymentDetails paymentDetails = new PaymentDetails\\n{\\n  Type = PaymentDetails.TypeEnum.Affirm\\n};\\n\\nBillingAddress billingAddress = new BillingAddress\\n{\\n  Country = \\&quot;US\\&quot;,\\n  StateOrProvince = \\&quot;CA\\&quot;,\\n  City = \\&quot;San Francisco\\&quot;,\\n  HouseNumberOrName = \\&quot;274\\&quot;,\\n  Street = \\&quot;Brannan St.\\&quot;,\\n  PostalCode = \\&quot;94107\\&quot;\\n};\\n\\nPaymentRequest paymentRequest = new PaymentRequest\\n{\\n  Amount = amount,\\n  TelephoneNumber = \\&quot;+31612345678\\&quot;,\\n  Channel = PaymentRequest.ChannelEnum.Web,\\n  ShopperEmail = \\&quot;s.hopper@example.com\\&quot;,\\n  Reference = \\&quot;YOUR_ORDER_NUMBER\\&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;US\\&quot;,\\n  PaymentMethod = new CheckoutPaymentMethod(paymentDetails),\\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  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  countryCode: \\&quot;US\\&quot;,\\n  amount: {\\n    currency: \\&quot;USD\\&quot;,\\n    value: 1000\\n  },\\n  shopperReference: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  channel: \\&quot;Web\\&quot;,\\n  paymentMethod: {\\n    type: \\&quot;affirm\\&quot;\\n  },\\n  shopperName: {\\n    firstName: \\&quot;Simon\\&quot;,\\n    lastName: \\&quot;Hopper\\&quot;\\n  },\\n  telephoneNumber: \\&quot;+31612345678\\&quot;,\\n  shopperEmail: \\&quot;s.hopper@example.com\\&quot;,\\n  billingAddress: {\\n    city: \\&quot;San Francisco\\&quot;,\\n    country: \\&quot;US\\&quot;,\\n    houseNumberOrName: \\&quot;274\\&quot;,\\n    postalCode: \\&quot;94107\\&quot;,\\n    stateOrProvince: \\&quot;CA\\&quot;,\\n    street: \\&quot;Brannan St.\\&quot;\\n  },\\n  deliveryAddress: {\\n    city: \\&quot;San Francisco\\&quot;,\\n    country: \\&quot;US\\&quot;,\\n    houseNumberOrName: \\&quot;274\\&quot;,\\n    postalCode: \\&quot;94107\\&quot;,\\n    stateOrProvince: \\&quot;CA\\&quot;,\\n    street: \\&quot;Brannan St.\\&quot;\\n  },\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  lineItems: [ {\\n    quantity: \\&quot;1\\&quot;,\\n    amountExcludingTax: \\&quot;331\\&quot;,\\n    description: \\&quot;Shoes\\&quot;,\\n    id: \\&quot;Item #1\\&quot;,\\n    taxAmount: \\&quot;69\\&quot;,\\n    productUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;,\\n    imageUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;\\n  }, {\\n    quantity: \\&quot;2\\&quot;,\\n    amountExcludingTax: \\&quot;248\\&quot;,\\n    description: \\&quot;Socks\\&quot;,\\n    id: \\&quot;Item #2\\&quot;,\\n    taxAmount: \\&quot;52\\&quot;,\\n    productUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;,\\n    imageUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&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;USD\\&quot;,\\n  Value: 1000,\\n}\\n\\nlineItem1 := checkout.LineItem{\\n  Quantity: common.PtrInt64(1),\\n  AmountExcludingTax: common.PtrInt64(331),\\n  ImageUrl: common.PtrString(\\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;),\\n  Description: common.PtrString(\\&quot;Shoes\\&quot;),\\n  Id: common.PtrString(\\&quot;Item #1\\&quot;),\\n  TaxAmount: common.PtrInt64(69),\\n  ProductUrl: common.PtrString(\\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;),\\n}\\n\\nlineItem2 := checkout.LineItem{\\n  Quantity: common.PtrInt64(2),\\n  AmountExcludingTax: common.PtrInt64(248),\\n  ImageUrl: common.PtrString(\\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&quot;),\\n  Description: common.PtrString(\\&quot;Socks\\&quot;),\\n  Id: common.PtrString(\\&quot;Item #2\\&quot;),\\n  TaxAmount: common.PtrInt64(52),\\n  ProductUrl: common.PtrString(\\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;),\\n}\\n\\nname := checkout.Name{\\n  FirstName: \\&quot;Simon\\&quot;,\\n  LastName: \\&quot;Hopper\\&quot;,\\n}\\n\\ndeliveryAddress := checkout.DeliveryAddress{\\n  Country: \\&quot;US\\&quot;,\\n  StateOrProvince: common.PtrString(\\&quot;CA\\&quot;),\\n  City: \\&quot;San Francisco\\&quot;,\\n  HouseNumberOrName: \\&quot;274\\&quot;,\\n  Street: \\&quot;Brannan St.\\&quot;,\\n  PostalCode: \\&quot;94107\\&quot;,\\n}\\n\\npaymentDetails := checkout.PaymentDetails{\\n  Type: common.PtrString(\\&quot;affirm\\&quot;),\\n}\\n\\nbillingAddress := checkout.BillingAddress{\\n  Country: \\&quot;US\\&quot;,\\n  StateOrProvince: common.PtrString(\\&quot;CA\\&quot;),\\n  City: \\&quot;San Francisco\\&quot;,\\n  HouseNumberOrName: \\&quot;274\\&quot;,\\n  Street: \\&quot;Brannan St.\\&quot;,\\n  PostalCode: \\&quot;94107\\&quot;,\\n}\\n\\npaymentRequest := checkout.PaymentRequest{\\n  Amount: amount,\\n  TelephoneNumber: common.PtrString(\\&quot;+31612345678\\&quot;),\\n  Channel: common.PtrString(\\&quot;Web\\&quot;),\\n  ShopperEmail: common.PtrString(\\&quot;s.hopper@example.com\\&quot;),\\n  Reference: \\&quot;YOUR_ORDER_NUMBER\\&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;US\\&quot;),\\n  PaymentMethod: checkout.PaymentDetailsAsCheckoutPaymentMethod(&amp;paymentDetails),\\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;merchantAccount\\&quot;: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;countryCode\\&quot;: \\&quot;US\\&quot;,\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;currency\\&quot;: \\&quot;USD\\&quot;,\\n    \\&quot;value\\&quot;: 1000\\n  },\\n  \\&quot;shopperReference\\&quot;: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  \\&quot;reference\\&quot;: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  \\&quot;channel\\&quot;: \\&quot;Web\\&quot;,\\n  \\&quot;paymentMethod\\&quot;: {\\n    \\&quot;type\\&quot;: \\&quot;affirm\\&quot;\\n  },\\n  \\&quot;shopperName\\&quot;: {\\n    \\&quot;firstName\\&quot;: \\&quot;Simon\\&quot;,\\n    \\&quot;lastName\\&quot;: \\&quot;Hopper\\&quot;\\n  },\\n  \\&quot;telephoneNumber\\&quot;: \\&quot;+31612345678\\&quot;,\\n  \\&quot;shopperEmail\\&quot;: \\&quot;s.hopper@example.com\\&quot;,\\n  \\&quot;billingAddress\\&quot;: {\\n    \\&quot;city\\&quot;: \\&quot;San Francisco\\&quot;,\\n    \\&quot;country\\&quot;: \\&quot;US\\&quot;,\\n    \\&quot;houseNumberOrName\\&quot;: \\&quot;274\\&quot;,\\n    \\&quot;postalCode\\&quot;: \\&quot;94107\\&quot;,\\n    \\&quot;stateOrProvince\\&quot;: \\&quot;CA\\&quot;,\\n    \\&quot;street\\&quot;: \\&quot;Brannan St.\\&quot;\\n  },\\n  \\&quot;deliveryAddress\\&quot;: {\\n    \\&quot;city\\&quot;: \\&quot;San Francisco\\&quot;,\\n    \\&quot;country\\&quot;: \\&quot;US\\&quot;,\\n    \\&quot;houseNumberOrName\\&quot;: \\&quot;274\\&quot;,\\n    \\&quot;postalCode\\&quot;: \\&quot;94107\\&quot;,\\n    \\&quot;stateOrProvince\\&quot;: \\&quot;CA\\&quot;,\\n    \\&quot;street\\&quot;: \\&quot;Brannan St.\\&quot;\\n  },\\n  \\&quot;returnUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  \\&quot;lineItems\\&quot;: [ {\\n    \\&quot;quantity\\&quot;: \\&quot;1\\&quot;,\\n    \\&quot;amountExcludingTax\\&quot;: \\&quot;331\\&quot;,\\n    \\&quot;description\\&quot;: \\&quot;Shoes\\&quot;,\\n    \\&quot;id\\&quot;: \\&quot;Item #1\\&quot;,\\n    \\&quot;taxAmount\\&quot;: \\&quot;69\\&quot;,\\n    \\&quot;productUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;,\\n    \\&quot;imageUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;\\n  }, {\\n    \\&quot;quantity\\&quot;: \\&quot;2\\&quot;,\\n    \\&quot;amountExcludingTax\\&quot;: \\&quot;248\\&quot;,\\n    \\&quot;description\\&quot;: \\&quot;Socks\\&quot;,\\n    \\&quot;id\\&quot;: \\&quot;Item #2\\&quot;,\\n    \\&quot;taxAmount\\&quot;: \\&quot;52\\&quot;,\\n    \\&quot;productUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;,\\n    \\&quot;imageUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&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  :merchantAccount =&gt; 'ADYEN_MERCHANT_ACCOUNT',\\n  :countryCode =&gt; 'US',\\n  :amount =&gt; {\\n    :currency =&gt; 'USD',\\n    :value =&gt; 1000\\n  },\\n  :shopperReference =&gt; 'YOUR_UNIQUE_SHOPPER_ID',\\n  :reference =&gt; 'YOUR_ORDER_NUMBER',\\n  :channel =&gt; 'Web',\\n  :paymentMethod =&gt; {\\n    :type =&gt; 'affirm'\\n  },\\n  :shopperName =&gt; {\\n    :firstName =&gt; 'Simon',\\n    :lastName =&gt; 'Hopper'\\n  },\\n  :telephoneNumber =&gt; '+31612345678',\\n  :shopperEmail =&gt; 's.hopper@example.com',\\n  :billingAddress =&gt; {\\n    :city =&gt; 'San Francisco',\\n    :country =&gt; 'US',\\n    :houseNumberOrName =&gt; '274',\\n    :postalCode =&gt; '94107',\\n    :stateOrProvince =&gt; 'CA',\\n    :street =&gt; 'Brannan St.'\\n  },\\n  :deliveryAddress =&gt; {\\n    :city =&gt; 'San Francisco',\\n    :country =&gt; 'US',\\n    :houseNumberOrName =&gt; '274',\\n    :postalCode =&gt; '94107',\\n    :stateOrProvince =&gt; 'CA',\\n    :street =&gt; 'Brannan St.'\\n  },\\n  :returnUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..',\\n  :lineItems =&gt; [ {\\n    :quantity =&gt; '1',\\n    :amountExcludingTax =&gt; '331',\\n    :description =&gt; 'Shoes',\\n    :id =&gt; 'Item #1',\\n    :taxAmount =&gt; '69',\\n    :productUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/item1\\\/',\\n    :imageUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/item1.jpg'\\n  }, {\\n    :quantity =&gt; '2',\\n    :amountExcludingTax =&gt; '248',\\n    :description =&gt; 'Socks',\\n    :id =&gt; 'Item #2',\\n    :taxAmount =&gt; '52',\\n    :productUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/item2\\\/',\\n    :imageUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/item2.jpg'\\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;USD\\&quot;,\\n  value: 1000\\n};\\n\\nconst lineItem1: Types.checkout.LineItem = {\\n  quantity: 1,\\n  amountExcludingTax: 331,\\n  imageUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1.jpg\\&quot;,\\n  description: \\&quot;Shoes\\&quot;,\\n  id: \\&quot;Item #1\\&quot;,\\n  taxAmount: 69,\\n  productUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item1\\\/\\&quot;\\n};\\n\\nconst lineItem2: Types.checkout.LineItem = {\\n  quantity: 2,\\n  amountExcludingTax: 248,\\n  imageUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2.jpg\\&quot;,\\n  description: \\&quot;Socks\\&quot;,\\n  id: \\&quot;Item #2\\&quot;,\\n  taxAmount: 52,\\n  productUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/item2\\\/\\&quot;\\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;US\\&quot;,\\n  stateOrProvince: \\&quot;CA\\&quot;,\\n  city: \\&quot;San Francisco\\&quot;,\\n  houseNumberOrName: \\&quot;274\\&quot;,\\n  street: \\&quot;Brannan St.\\&quot;,\\n  postalCode: \\&quot;94107\\&quot;\\n};\\n\\nconst paymentDetails: Types.checkout.PaymentDetails = {\\n  type: Types.checkout.PaymentDetails.TypeEnum.Affirm\\n};\\n\\nconst billingAddress: Types.checkout.BillingAddress = {\\n  country: \\&quot;US\\&quot;,\\n  stateOrProvince: \\&quot;CA\\&quot;,\\n  city: \\&quot;San Francisco\\&quot;,\\n  houseNumberOrName: \\&quot;274\\&quot;,\\n  street: \\&quot;Brannan St.\\&quot;,\\n  postalCode: \\&quot;94107\\&quot;\\n};\\n\\nconst paymentRequest: Types.checkout.PaymentRequest = {\\n  amount: amount,\\n  telephoneNumber: \\&quot;+31612345678\\&quot;,\\n  channel: Types.checkout.PaymentRequest.ChannelEnum.Web,\\n  shopperEmail: \\&quot;s.hopper@example.com\\&quot;,\\n  reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  lineItems: [lineItem1, lineItem2],\\n  shopperName: name,\\n  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  deliveryAddress: deliveryAddress,\\n  countryCode: \\&quot;US\\&quot;,\\n  paymentMethod: paymentDetails,\\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<p>In the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> response, check the <code>action<\/code> object for the information that you must use to redirect the shopper.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'\/payments response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n  \\\"resultCode\\\":\\\"RedirectShopper\\\",\\n  \\\"action\\\":{\\n    \\\"paymentMethodType\\\":\\\"affirm\\\",\\n    \\\"method\\\":\\\"GET\\\",\\n    \\\"url\\\":\\\"https:\\\/\\\/checkoutshopper-test.adyen.com\\\/checkoutshopper\\\/checkoutPaymentRedirect?redirectData=...\\\",\\n    \\\"type\\\":\\\"redirect\\\"\\n  }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h2>Handle the redirect<\/h2>\n<ol>\n<li>\n<p>To complete the payment, redirect the shopper to the <code>action.url<\/code> returned in the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> response, taking into account the following recommendations:<\/p>\n<ul>\n<li>\n<p><strong>When using the HTTP GET method:<\/strong><br \/>\nFor security reasons, when showing the redirect in the app, we recommend that you use <a href=\"https:\/\/developer.apple.com\/documentation\/safariservices\/sfsafariviewcontroller\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">SFSafariViewController<\/a> for iOS or <a href=\"https:\/\/developer.chrome.com\/multidevice\/android\/customtabs\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Chrome Custom Tabs<\/a> for Android, instead of WebView objects. Also refer to the <a href=\"https:\/\/developer.android.com\/topic\/security\/best-practices#webview\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">security best practices<\/a> for WebView.<\/p>\n<\/li>\n<li>\n<p><strong>Redirection for mobile integrations:<\/strong><br \/>\nFor mobile integrations, we strongly recommended that you redirect the shopper to the default browser of their device. Redirecting to the default browser ensures the best compatibility, handling of multi-factor authentication, app-to-app redirection, and error handling.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>After the shopper is redirected back to your website, check the payment result by making a POST  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/details\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments\/details<\/a> request, specifying:<\/p>\n<ul>\n<li><code>details<\/code>: object that contains the URL-decoded <code>redirectResult<\/code> returned when the shopper was redirected back to your site.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'\/payments\/details request'\" :id=\"''\" :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\\\/details \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n   \\&quot;details\\&quot;: {\\n      \\&quot;redirectResult\\&quot;: \\&quot;eyJ0cmFuc1N0YXR1cyI6IlkifQ==\\&quot;\\n   }\\n}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>In the response note the following:<\/p>\n<ul>\n<li><code>resultCode<\/code>: use this to present the result to your shopper.<\/li>\n<li><code>pspReference<\/code>: our unique identifier for the transaction.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'\/payments\/details response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"resultCode\\\": \\\"Authorised\\\",\\n   \\\"pspReference\\\": \\\"V4HZ4RBFJGXXGN82\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"present-the-payment-result\">Present the payment result<\/h2>\n<p>Use the\u00a0 <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/details#responses-200-resultCode\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">resultCode<\/a> that you received in the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/details\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments\/details<\/a> response to present the payment result to your shopper.<\/p>\n<p>The <code>resultCode<\/code> values you can receive for Affirm 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 successfully authorised.<\/td>\n<td>Inform the shopper that the payment was successful. <br> After the goods have been sent, you also need to <a href=\"#capture-the-payment\">capture<\/a> the payment.<\/td>\n<\/tr>\n<tr>\n<td><strong>Cancelled<\/strong><\/td>\n<td>The shopper cancelled the payment.<\/td>\n<td>Ask the shopper whether they want to continue with the order, or ask them to select a different payment method.<\/td>\n<\/tr>\n<tr>\n<td><strong>Pending<\/strong><\/td>\n<td>The shopper has completed the payment but the final result is not yet known.<\/td>\n<td>Inform the shopper that you have received their order, and are waiting for the payment to be completed. <br> To know the final result of the payment, wait for the <a href=\"\/pt\/development-resources\/webhooks\/webhook-types\">AUTHORISATION webhook<\/a>.<\/td>\n<\/tr>\n<tr>\n<td><strong>Refused<\/strong><\/td>\n<td>The payment was refused by Affirm.<\/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=\"capture-the-payment\">Capture the payment<\/h2>\n<p>After the goods have been sent, you also need to capture the payment. All Affirm payments have to be captured within 28 days. Capturing the payment is what triggers the installment payment schedule for the shopper. If you do not capture the payment within 28 days, the authorization will expire.<\/p>\n<p>If for any reason you need to capture a lesser amount than what was authorised, you need to issue a <a href=\"\/pt\/online-payments\/refund\">refund<\/a> for the difference after the capture. For example, a customer purchases two items of USD&nbsp;500 each, totaling USD&nbsp;1,000, but only one is fulfilled. After capturing USD&nbsp;1,000, you should issue a subsequent refund for the unfulfilled item of USD&nbsp;500.<\/p>\n<h2 id=\"refunds-and-cancellations\">Refunds and cancellations<\/h2>\n<p>If an Affirm payment hasn't been captured yet, you can <a href=\"\/pt\/online-payments\/cancel\">cancel<\/a> it. If the Affirm 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> it.<\/p>\n<h3 id=\"partial-refunds\">Partial refunds<\/h3>\n<p>To <a href=\"\/pt\/online-payments\/refund\">partially refund<\/a> an Affirm payment, specify 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:<\/p>\n<ul>\n<li><code>modificationAmount<\/code>: The amount to be refunded to the shopper.<\/li>\n<li><code>additionalData.acquirerReference<\/code>: The <code>acquirerReference<\/code> of the capture. This is needed if there are multiple partial captures available for the payment. When refunding in your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>, you can add the <code>acquirerReference<\/code> manually as well.<\/li>\n<\/ul>\n<p>The following example shows how to make a partial refund request if the shopper returned the shoes included in the <a href=\"#make-a-payment\">original payment request<\/a>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'\/refund request'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"merchantAccount\\\":\\\"YOUR_MERCHANT_ACCOUNT\\\",\\n   \\\"originalReference\\\":\\\"COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE\\\",\\n   \\\"modificationAmount\\\":{\\n      \\\"currency\\\":\\\"USD\\\",\\n      \\\"value\\\":\\\"400\\\"\\n   },\\n   \\\"reference\\\":\\\"YOUR_REFUND_REFERENCE\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h2 id=\"test-and-go-live\">Test and go live<\/h2>\n<p>To receive your test credentials, contact Affirm. After reviewing your test transactions, Affirm will provide you with the credentials for processing live transactions.<\/p>\n<p><\/p>\n<p>You can check the status of the test payments in your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">test Customer Area<\/a> &gt; <strong>Transactions<\/strong> &gt; <strong>Payments<\/strong>.<\/p>\n<p><\/p>\n<p>Before you can accept live Affirm payments, you need to <a href=\"\/pt\/payment-methods\/add-payment-methods\">submit a request for Affirm<\/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>, and provide us with your Affirm live credentials.<\/p>\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:\/\/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\/affirm\/api-only","articleFields":{"description":"Add Affirm to an existing API-only integration.","parameters":{"integration":"API-only","platform":"Web","integration_guide_url":"build-your-integration\/advanced-flow?platform=Web&integration=API%20only","payment_method":"Affirm","country_code":"US","currency":"USD","payment_method_type":"affirm"},"feedback_component":true},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/affirm\/api-only","title":"Affirm for API only","content":"Accept Affirm payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.\nWhen making an Affirm payment, you also need to:\n\nProvide details about the items being purchased when making a payment request.\nCapture the payment after the transaction has been fulfilled. When the payment has been captured, Affirm starts the repayment period for the shopper.\n\nRequirements\n\n\n\nRequirement\nDescription\n\n\n\n\nIntegration type\nMake sure that you have built an API-only integration. \n\n\nSetup steps\nBefore you begin, add Affirm in your test Customer Area.\n\n\n\nBuild your payment form for Affirm\nTo make an Affirm payment, you need to collect the following shopper details:\n\n\n\nName\nDescription\n\n\n\n\nfirstName\nShopper's first name.\n\n\nlastName\nShopper's last name.\n\n\ntelephoneNumber\nShopper's phone number.\n\n\nshopperEmail\nShopper's email address.\n\n\nbillingAddress\nThe address where to send the invoice.\n\n\ndeliveryAddress\nThe address where the purchased goods should be delivered.\n\n\n\n\nWe provide an Affirm logo which you can use in your payment form. For more information, refer to Downloading logos.\n\nMake a payment\nFrom your server, make a  \/payments request, specifying:\n\n\n\nParameter name\nRequired\nDescription\n\n\n\n\npaymentMethod.type\n\nSet to affirm.\n\n\n shopperName\n\nShopper's first name and last name.\n\n\n telephoneNumber\n\nThe shopper's phone number.\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 in two-letter ISO 3166-1 alpha-2 format. Required when transacting in Canada or the United Kingdom, because the default US is used if you omit this parameter.\n\n\n billingAddress\n\nThe address where to send the invoice. The stateOrProvince address field is required for Canada and the US, and optional for the UK.\n\n\n deliveryAddress\n\nThe address where the purchased goods should be delivered. The stateOrProvince address field is required for Canada and the US, and optional for the UK.  If blank or missing, billingAddress is used by default.\n\n\n lineItems\n\nPrice and product information about the purchased items. This is optional, but we recommend to include this data to improve approval rates.\n\n\n\n\n    \n\nIn the  \/payments response, check the action object for the information that you must use to redirect the shopper.\n\n    \n\nHandle the redirect\n\n\nTo complete the payment, redirect the shopper to the action.url returned in the  \/payments response, taking into account the following recommendations:\n\n\nWhen using the HTTP GET method:\nFor security reasons, when showing the redirect in the app, we recommend that you use SFSafariViewController for iOS or Chrome Custom Tabs for Android, instead of WebView objects. Also refer to the security best practices for WebView.\n\n\nRedirection for mobile integrations:\nFor mobile integrations, we strongly recommended that you redirect the shopper to the default browser of their device. Redirecting to the default browser ensures the best compatibility, handling of multi-factor authentication, app-to-app redirection, and error handling.\n\n\n\n\nAfter the shopper is redirected back to your website, check the payment result by making a POST  \/payments\/details request, specifying:\n\ndetails: object that contains the URL-decoded redirectResult returned when the shopper was redirected back to your site.\n\n\n\n\n\n\nIn the response note the following:\n\nresultCode: use this to present the result to your shopper.\npspReference: our unique identifier for the transaction.\n\n\n\n\n\n\nPresent the payment result\nUse the\u00a0 resultCode that you received in the  \/payments\/details response to present the payment result to your shopper.\nThe resultCode values you can receive for Affirm are:\n\n\n\nresultCode\nDescription\nAction to take\n\n\n\n\nAuthorised\nThe payment was successfully authorised.\nInform the shopper that the payment was successful.  After the goods have been sent, you also need to capture the payment.\n\n\nCancelled\nThe shopper cancelled the payment.\nAsk the shopper whether they want to continue with the order, or ask them to select a different payment method.\n\n\nPending\nThe shopper has completed the payment but the final result is not yet known.\nInform the shopper that you have received their order, and are waiting for the payment to be completed.  To know the final result of the payment, wait for the AUTHORISATION webhook.\n\n\nRefused\nThe payment was refused by Affirm.\nAsk the shopper to try the payment again using a different payment method.\n\n\n\nCapture the payment\nAfter the goods have been sent, you also need to capture the payment. All Affirm payments have to be captured within 28 days. Capturing the payment is what triggers the installment payment schedule for the shopper. If you do not capture the payment within 28 days, the authorization will expire.\nIf for any reason you need to capture a lesser amount than what was authorised, you need to issue a refund for the difference after the capture. For example, a customer purchases two items of USD&nbsp;500 each, totaling USD&nbsp;1,000, but only one is fulfilled. After capturing USD&nbsp;1,000, you should issue a subsequent refund for the unfulfilled item of USD&nbsp;500.\nRefunds and cancellations\nIf an Affirm payment hasn't been captured yet, you can cancel it. If the Affirm payment has already been captured and you want to return the funds to the shopper, you need to refund it.\nPartial refunds\nTo partially refund an Affirm payment, specify in your  \/payments\/{paymentPspReference}\/refunds request:\n\nmodificationAmount: The amount to be refunded to the shopper.\nadditionalData.acquirerReference: The acquirerReference of the capture. This is needed if there are multiple partial captures available for the payment. When refunding in your Customer Area, you can add the acquirerReference manually as well.\n\nThe following example shows how to make a partial refund request if the shopper returned the shoes included in the original payment request.\n\n    \n\nTest and go live\nTo receive your test credentials, contact Affirm. After reviewing your test transactions, Affirm will provide you with the credentials for processing live transactions.\n\nYou can check the status of the test payments in your test Customer Area &gt; Transactions &gt; Payments.\n\nBefore you can accept live Affirm payments, you need to submit a request for Affirm in your live Customer Area, and provide us with your Affirm live credentials.\nSee also\n\n\n                    API only integration guide \n                \n                    API Explorer\n                \n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Payment methods","lvl2":"Affirm","lvl3":"Affirm 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\/affirm","lvl3":"\/pt\/payment-methods\/affirm\/api-only"},"levels":4,"category":"Payment method","category_color":"green","tags":["Affirm"]},"articleFiles":{"affirm-api-payments.js":"<p alt=\"\">affirm-api-payments.js<\/p>"}}
