--- title: "Afterpay Redirect Component" description: "Use the Redirect Component to handle the redirect to Afterpay." url: "https://docs.adyen.com/payment-methods/cash-app-afterpay/ios-component" source_url: "https://docs.adyen.com/payment-methods/cash-app-afterpay/ios-component.md" canonical: "https://docs.adyen.com/payment-methods/cash-app-afterpay/ios-component" last_modified: "2026-05-24T12:54:31+02:00" language: "en" --- # Afterpay Redirect Component Use the Redirect Component to handle the redirect to Afterpay. [View source](/payment-methods/cash-app-afterpay/ios-component.md) This page explains how to add Cash App Afterpay to your existing iOS Components integration. ## Requirements Select the [server-side flow](/online-payments/build-your-integration) that your integration uses: ### Tab: Sessions flow | Requirement | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built a Sessions flow [iOS Components integration](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components). | | **Setup steps** | Before you begin, [add Cash App Afterpay in your Customer Area](/payment-methods/add-payment-methods). | ### Tab: Advanced flow | Requirement | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Integration type** | Make sure that you have built an Advanced flow [iOS Components integration](/online-payments/build-your-integration/advanced-flow?platform=iOS\&integration=Components). | | **Setup steps** | Before you begin, [add Cash App Afterpay in your Customer Area](/payment-methods/add-payment-methods). | ## API reference Select which endpoint you are using: ### Tab: `/sessions` This is the default with [Components v5.0.0](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components) or later. | Parameter name | Required | Description | | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's full name. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperEmail) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's email address. | | [shopperReference](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/sessions__reqParam_shopperReference) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | A unique reference to identify the shopper. Minimum length: three characters. | | [countryCode](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/sessions__reqParam_countryCode) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's country/region. | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-billingAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address to be included on the invoice. | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-deliveryAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address where the goods will be shipped. | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-lineItems) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Price and product information about the purchased items.   | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-telephoneNumber) | | The shopper's telephone number, if provided. | #### curl ```bash curl https://checkout-test.adyen.com/v69/sessions \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount":{ "value":1000, "currency":"USD" }, "shopperName":{ "firstName":"", "lastName":"" }, "shopperEmail":"s.hopper@example.com", "shopperReference":"", "reference":"YOUR_ORDER_REFERENCE", "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "returnUrl":"my-app://adyen", "countryCode":"US", "telephoneNumber":"+16123456789", "billingAddress":{ "city":"San Francisco", "country":"US", "houseNumberOrName":"274", "postalCode":"94107", "stateOrProvince":"CA", "street":"Brennan St." }, "deliveryAddress":{ "city":"San Francisco", "country":"US", "houseNumberOrName":"274", "postalCode":"94107", "stateOrProvince":"CA", "street":"Brennan St." }, "lineItems":[ { "description":"Shoes", "quantity":"1", "amountIncludingTax":"400", "amountExcludingTax": "331", "taxAmount": "69", "id":"Item #1" }, { "description":"Socks", "quantity":"2", "amountIncludingTax":"300", "amountExcludingTax": "248", "taxAmount": "52", "id":"Item #2" } ] }' ``` #### Java ```java // Adyen Java API Library v39.3.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) LineItem lineItem1 = new LineItem() .quantity(1L) .amountExcludingTax(331L) .description("Shoes") .id("Item #1") .amountIncludingTax(400L) .taxAmount(69L); LineItem lineItem2 = new LineItem() .quantity(2L) .amountExcludingTax(248L) .description("Socks") .id("Item #2") .amountIncludingTax(300L) .taxAmount(52L); Amount amount = new Amount() .currency("USD") .value(1000L); Name name = new Name() .firstName("") .lastName(""); DeliveryAddress deliveryAddress = new DeliveryAddress() .country("US") .stateOrProvince("CA") .city("San Francisco") .houseNumberOrName("274") .street("Brennan St.") .postalCode("94107"); BillingAddress billingAddress = new BillingAddress() .country("US") .stateOrProvince("CA") .city("San Francisco") .houseNumberOrName("274") .street("Brennan St.") .postalCode("94107"); CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest() .reference("YOUR_ORDER_REFERENCE") .lineItems(Arrays.asList(lineItem1, lineItem2)) .amount(amount) .shopperName(name) .telephoneNumber("+16123456789") .merchantAccount("YOUR_MERCHANT_ACCOUNT") .deliveryAddress(deliveryAddress) .countryCode("US") .shopperEmail("s.hopper@example.com") .billingAddress(billingAddress) .returnUrl("my-app://adyen") .shopperReference(""); // Send the request PaymentsApi service = new PaymentsApi(client); CreateCheckoutSessionResponse response = service.sessions(createCheckoutSessionRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setAmountExcludingTax(331) ->setDescription("Shoes") ->setId("Item #1") ->setAmountIncludingTax(400) ->setTaxAmount(69); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(2) ->setAmountExcludingTax(248) ->setDescription("Socks") ->setId("Item #2") ->setAmountIncludingTax(300) ->setTaxAmount(52); $amount = new Amount(); $amount ->setCurrency("USD") ->setValue(1000); $name = new Name(); $name ->setFirstName("") ->setLastName(""); $deliveryAddress = new DeliveryAddress(); $deliveryAddress ->setCountry("US") ->setStateOrProvince("CA") ->setCity("San Francisco") ->setHouseNumberOrName("274") ->setStreet("Brennan St.") ->setPostalCode("94107"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("US") ->setStateOrProvince("CA") ->setCity("San Francisco") ->setHouseNumberOrName("274") ->setStreet("Brennan St.") ->setPostalCode("94107"); $createCheckoutSessionRequest = new CreateCheckoutSessionRequest(); $createCheckoutSessionRequest ->setReference("YOUR_ORDER_REFERENCE") ->setLineItems(array($lineItem1, $lineItem2)) ->setAmount($amount) ->setShopperName($name) ->setTelephoneNumber("+16123456789") ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setDeliveryAddress($deliveryAddress) ->setCountryCode("US") ->setShopperEmail("s.hopper@example.com") ->setBillingAddress($billingAddress) ->setReturnUrl("my-app://adyen") ->setShopperReference(""); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->sessions($createCheckoutSessionRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v32.1.1 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) LineItem lineItem1 = new LineItem { Quantity = 1, AmountExcludingTax = 331, Description = "Shoes", Id = "Item #1", AmountIncludingTax = 400, TaxAmount = 69 }; LineItem lineItem2 = new LineItem { Quantity = 2, AmountExcludingTax = 248, Description = "Socks", Id = "Item #2", AmountIncludingTax = 300, TaxAmount = 52 }; Amount amount = new Amount { Currency = "USD", Value = 1000 }; Name name = new Name { FirstName = "", LastName = "" }; DeliveryAddress deliveryAddress = new DeliveryAddress { Country = "US", StateOrProvince = "CA", City = "San Francisco", HouseNumberOrName = "274", Street = "Brennan St.", PostalCode = "94107" }; BillingAddress billingAddress = new BillingAddress { Country = "US", StateOrProvince = "CA", City = "San Francisco", HouseNumberOrName = "274", Street = "Brennan St.", PostalCode = "94107" }; CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest { Reference = "YOUR_ORDER_REFERENCE", LineItems = new List{ lineItem1, lineItem2 }, Amount = amount, ShopperName = name, TelephoneNumber = "+16123456789", MerchantAccount = "YOUR_MERCHANT_ACCOUNT", DeliveryAddress = deliveryAddress, CountryCode = "US", ShopperEmail = "s.hopper@example.com", BillingAddress = billingAddress, ReturnUrl = "my-app://adyen", ShopperReference = "" }; // Send the request var service = new PaymentsService(client); var response = service.Sessions(createCheckoutSessionRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v29.0.0 const { Client, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const createCheckoutSessionRequest = { amount: { value: 1000, currency: "USD" }, shopperName: { firstName: "", lastName: "" }, shopperEmail: "s.hopper@example.com", shopperReference: "", reference: "YOUR_ORDER_REFERENCE", merchantAccount: "YOUR_MERCHANT_ACCOUNT", returnUrl: "my-app://adyen", countryCode: "US", telephoneNumber: "+16123456789", billingAddress: { city: "San Francisco", country: "US", houseNumberOrName: "274", postalCode: "94107", stateOrProvince: "CA", street: "Brennan St." }, deliveryAddress: { city: "San Francisco", country: "US", houseNumberOrName: "274", postalCode: "94107", stateOrProvince: "CA", street: "Brennan St." }, lineItems: [ { description: "Shoes", quantity: "1", amountIncludingTax: "400", amountExcludingTax: "331", taxAmount: "69", id: "Item #1" }, { description: "Socks", quantity: "2", amountIncludingTax: "300", amountExcludingTax: "248", taxAmount: "52", id: "Item #2" } ] } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.0.0 import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), AmountExcludingTax: common.PtrInt64(331), Description: common.PtrString("Shoes"), Id: common.PtrString("Item #1"), AmountIncludingTax: common.PtrInt64(400), TaxAmount: common.PtrInt64(69), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(2), AmountExcludingTax: common.PtrInt64(248), Description: common.PtrString("Socks"), Id: common.PtrString("Item #2"), AmountIncludingTax: common.PtrInt64(300), TaxAmount: common.PtrInt64(52), } amount := checkout.Amount{ Currency: "USD", Value: 1000, } name := checkout.Name{ FirstName: "", LastName: "", } deliveryAddress := checkout.DeliveryAddress{ Country: "US", StateOrProvince: common.PtrString("CA"), City: "San Francisco", HouseNumberOrName: "274", Street: "Brennan St.", PostalCode: "94107", } billingAddress := checkout.BillingAddress{ Country: "US", StateOrProvince: common.PtrString("CA"), City: "San Francisco", HouseNumberOrName: "274", Street: "Brennan St.", PostalCode: "94107", } createCheckoutSessionRequest := checkout.CreateCheckoutSessionRequest{ Reference: "YOUR_ORDER_REFERENCE", LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, Amount: amount, ShopperName: &name, TelephoneNumber: common.PtrString("+16123456789"), MerchantAccount: "YOUR_MERCHANT_ACCOUNT", DeliveryAddress: &deliveryAddress, CountryCode: common.PtrString("US"), ShopperEmail: common.PtrString("s.hopper@example.com"), BillingAddress: &billingAddress, ReturnUrl: "my-app://adyen", ShopperReference: common.PtrString(""), } // Send the request service := client.Checkout() req := service.PaymentsApi.SessionsInput().IdempotencyKey("UUID").CreateCheckoutSessionRequest(createCheckoutSessionRequest) res, httpRes, err := service.PaymentsApi.Sessions(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v13.6.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "amount": { "value": 1000, "currency": "USD" }, "shopperName": { "firstName": "", "lastName": "" }, "shopperEmail": "s.hopper@example.com", "shopperReference": "", "reference": "YOUR_ORDER_REFERENCE", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "returnUrl": "my-app://adyen", "countryCode": "US", "telephoneNumber": "+16123456789", "billingAddress": { "city": "San Francisco", "country": "US", "houseNumberOrName": "274", "postalCode": "94107", "stateOrProvince": "CA", "street": "Brennan St." }, "deliveryAddress": { "city": "San Francisco", "country": "US", "houseNumberOrName": "274", "postalCode": "94107", "stateOrProvince": "CA", "street": "Brennan St." }, "lineItems": [ { "description": "Shoes", "quantity": "1", "amountIncludingTax": "400", "amountExcludingTax": "331", "taxAmount": "69", "id": "Item #1" }, { "description": "Socks", "quantity": "2", "amountIncludingTax": "300", "amountExcludingTax": "248", "taxAmount": "52", "id": "Item #2" } ] } # Send the request result = adyen.checkout.payments_api.sessions(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.4.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :amount => { :value => 1000, :currency => 'USD' }, :shopperName => { :firstName => '', :lastName => '' }, :shopperEmail => 's.hopper@example.com', :shopperReference => '', :reference => 'YOUR_ORDER_REFERENCE', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :returnUrl => 'my-app://adyen', :countryCode => 'US', :telephoneNumber => '+16123456789', :billingAddress => { :city => 'San Francisco', :country => 'US', :houseNumberOrName => '274', :postalCode => '94107', :stateOrProvince => 'CA', :street => 'Brennan St.' }, :deliveryAddress => { :city => 'San Francisco', :country => 'US', :houseNumberOrName => '274', :postalCode => '94107', :stateOrProvince => 'CA', :street => 'Brennan St.' }, :lineItems => [ { :description => 'Shoes', :quantity => '1', :amountIncludingTax => '400', :amountExcludingTax => '331', :taxAmount => '69', :id => 'Item #1' }, { :description => 'Socks', :quantity => '2', :amountIncludingTax => '300', :amountExcludingTax => '248', :taxAmount => '52', :id => 'Item #2' } ] } # Send the request result = adyen.checkout.payments_api.sessions(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v29.0.0 import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const lineItem1: Types.checkout.LineItem = { quantity: 1, amountExcludingTax: 331, description: "Shoes", id: "Item #1", amountIncludingTax: 400, taxAmount: 69 }; const lineItem2: Types.checkout.LineItem = { quantity: 2, amountExcludingTax: 248, description: "Socks", id: "Item #2", amountIncludingTax: 300, taxAmount: 52 }; const amount: Types.checkout.Amount = { currency: "USD", value: 1000 }; const name: Types.checkout.Name = { firstName: "", lastName: "" }; const deliveryAddress: Types.checkout.DeliveryAddress = { country: "US", stateOrProvince: "CA", city: "San Francisco", houseNumberOrName: "274", street: "Brennan St.", postalCode: "94107" }; const billingAddress: Types.checkout.BillingAddress = { country: "US", stateOrProvince: "CA", city: "San Francisco", houseNumberOrName: "274", street: "Brennan St.", postalCode: "94107" }; const createCheckoutSessionRequest: Types.checkout.CreateCheckoutSessionRequest = { reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], amount: amount, shopperName: name, telephoneNumber: "+16123456789", merchantAccount: "YOUR_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "US", shopperEmail: "s.hopper@example.com", billingAddress: billingAddress, returnUrl: "my-app://adyen", shopperReference: "" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` ### Tab: `/payments` If you implemented an [additional use case](/online-payments/build-your-integration). | Parameter name | Required | Description | | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's full name. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperEmail) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's email address. | | [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | A unique reference to identify the shopper. Minimum length: three characters. | | [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-countryCode) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's country/region. | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-billingAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address to be included on the invoice. | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-deliveryAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address where the goods will be shipped. | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Price and product information about the purchased items.  | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-telephoneNumber) | | The shopper's telephone number, if provided. | #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "paymentMethod":{ "type":"afterpaytouch_US" }, "amount":{ "value":1000, "currency":"USD" }, "shopperName":{ "firstName":"", "lastName":"" }, "shopperEmail":"s.hopper@example.com", "shopperReference":"", "reference":"YOUR_ORDER_REFERENCE", "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "returnUrl":"my-app://adyen", "countryCode":"US", "telephoneNumber":"+16123456789", "billingAddress":{ "city":"San Francisco", "country":"US", "houseNumberOrName":"274", "postalCode":"94107", "stateOrProvince":"CA", "street":"Brennan St." }, "deliveryAddress":{ "city":"San Francisco", "country":"US", "houseNumberOrName":"274", "postalCode":"94107", "stateOrProvince":"CA", "street":"Brennan St." }, "lineItems":[ { "description":"Shoes", "quantity":"1", "amountIncludingTax":"400", "amountExcludingTax": "331", "taxAmount": "69", "id":"Item #1" }, { "description":"Socks", "quantity":"2", "amountIncludingTax":"300", "amountExcludingTax": "248", "taxAmount": "52", "id":"Item #2" } ] }' ``` #### Java ```java // Set ADYEN_API_KEY with the API key from the Customer Area. // Change to Environment.LIVE and add the Live URL prefix when you are ready to accept live payments. Client client = new Client("ADYEN_API_KEY", Environment.TEST); Checkout checkout = new Checkout(client); PaymentsRequest paymentsRequest = new PaymentsRequest(); String merchantAccount = "YOUR_MERCHANT_ACCOUNT"; paymentsRequest.setMerchantAccount(merchantAccount); Amount amount = new Amount(); amount.setCurrency("USD"); amount.setValue(1000L); paymentsRequest.setAmount(amount); DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); paymentMethodDetails.setType("afterpaytouch_US"); paymentsRequest.setPaymentMethod(paymentMethodDetails); paymentsRequest.setReference("YOUR_ORDER_NUMBER"); paymentsRequest.setReturnUrl("my-app://adyen"); Name shopperDetails = new Name(); shopperDetails.setFirstName(""); shopperDetails.setLastName(""); paymentsRequest.setShopperName(shopperDetails); paymentsRequest.setShopperReference(""); paymentsRequest.setCountryCode("US"); paymentsRequest.setTelephoneNumber("+16123456789"); paymentsRequest.setShopperEmail("s.hopper@example.com"); BillingAddress billingAddress = new BillingAddress(); billingAddress.setCountry("US"); billingAddress.setCity("San Francisco"); billingAddress.setHouseNumberOrName("274"); billingAddress.setStreet("Brennan St."); billingAddress.setPostalCode("94107"); billingAddress.setStateOrProvince("CA"); paymentsRequest.setBillingAddress(billingAddress); DeliveryAddress deliveryAddress = new DeliveryAddress(); deliveryAddress.setCountry("US"); deliveryAddress.setCity("San Francisco"); deliveryAddress.setHouseNumberOrName("274"); deliveryAddress.setStreet("Brennan St."); deliveryAddress.setPostalCode("94107"); deliveryAddress.setStateOrProvince("CA"); paymentsRequest.setDeliveryAddress(deliveryAddress); List lineItems = new ArrayList<>(); lineItems.add( new LineItem() .quantity(1L) .description("Shoes") .id("Item #1") .amountIncludingTax(400L) .amountExcludingTax(331L) .taxAmount(69L) ); lineItems.add( new LineItem() .quantity(2L) .description("Socks") .id("Item #2") .amountIncludingTax(300L) .amountExcludingTax(248L) .taxAmount(52L) ); paymentsRequest.setLineItems(lineItems); PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest); ``` #### PHP ```php // Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("ADYEN_API_KEY"); $service = new \Adyen\Service\Checkout($client); $params = [ "merchantAccount" => "YOUR_MERCHANT_ACCOUNT", "reference" => "YOUR_ORDER_NUMBER", "amount" => [ "currency" => "USD", "value" => 1000 ], "paymentMethod" => [ "type" => "afterpaytouch_US" ], "returnUrl" => "my-app://adyen", "countryCode" => "US", "shopperName" => [ "firstName" => "", "lastName" => "" ], "shopperEmail" => "s.hopper@example.com", "shopperReference" => "", "telephoneNumber" => "+16123456789", "billingAddress" => [ "city" => "San Francisco", "country" => "US", "houseNumberOrName" => "274", "postalCode" => "94107", "stateOrProvince" => "CA", "street" => "Brennan St." ], "deliveryAddress" => [ "city" => "San Francisco", "country" => "US", "houseNumberOrName" => "274", "postalCode" => "94107", "stateOrProvince" => "CA", "street" => "Brennan St." ], "lineItems" => [ [ "description" => "Shoes", "quantity" => "1", "amountIncludingTax" => "400", "amountExcludingTax" => "331", "taxAmount" => "69", "id" => "Item #1" ], [ "description" => "Socks", "quantity" => "2", "amountIncludingTax" => "300", "amountExcludingTax" => "248", "taxAmount" => "52", "id" => "Item #2" ] ] ]; $result = $service->payments($params); ``` #### C\# ```cs // Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("ADYEN_API_KEY", Environment.Test); var checkout = new Checkout(client); var paymentsRequest = new Adyen.Model.Checkout.PaymentRequest { MerchantAccount = "YOUR_MERCHANT_ACCOUNT", Reference = "YOUR_ORDER_REFERENCE", PaymentMethod = new DefaultPaymentMethodDetails { Type = "afterpaytouch_US" }, Amount = new Adyen.Model.Checkout.Amount(currency: "USD", value: 1000), CountryCode = "US", TelephoneNumber = "+16123456789", ShopperEmail = "s.hopper@example.com", ShopperName = new Adyen.Model.Checkout.Name { FirstName = "", LastName = "" }, ShopperReference = "", BillingAddress = new Adyen.Model.Checkout.Address { City = "San Francisco", Country = "US", HouseNumberOrName = "274", PostalCode = "94107", StateOrProvince = "CA", Street = "Brennan St." }, DeliveryAddress = new Adyen.Model.Checkout.Address { City = "San Francisco", Country = "US", HouseNumberOrName = "274", PostalCode = "94107", StateOrProvince = "CA", Street = "Brennan St." }, ReturnUrl = "my-app://adyen", LineItems = new List { new LineItem(quantity:1, description: "Shoes", id: "Item #1", amountIncludingTax: 400, amountExcludingTax: 331, taxAmount: 69), new LineItem(quantity:2, description: "Socks", id: "Item #2", amountIncludingTax: 300, amountExcludingTax: 248, taxAmount: 52) } }; ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.1.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "YOUR_X_API_KEY", environment: "TEST"}); // Create the request object const paymentRequest = { paymentMethod: { type: "afterpaytouch_US" }, amount: { value: 1000, currency: "USD" }, shopperName: { firstName: "", lastName: "" }, shopperEmail: "s.hopper@example.com", shopperReference: "", reference: "YOUR_ORDER_REFERENCE", merchantAccount: "YOUR_MERCHANT_ACCOUNT", returnUrl: "my-app://adyen", countryCode: "US", telephoneNumber: "+16123456789", billingAddress: { city: "San Francisco", country: "US", houseNumberOrName: "274", postalCode: "94107", stateOrProvince: "CA", street: "Brennan St." }, deliveryAddress: { city: "San Francisco", country: "US", houseNumberOrName: "274", postalCode: "94107", stateOrProvince: "CA", street: "Brennan St." }, lineItems: [ { description: "Shoes", quantity: "1", amountIncludingTax: "400", amountExcludingTax: "331", taxAmount: "69", id: "Item #1" }, { description: "Socks", quantity: "2", amountIncludingTax: "300", amountExcludingTax: "248", taxAmount: "52", id: "Item #2" } ] } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Python ```py # Adyen Python API Library v12.0.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "YOUR_X_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "paymentMethod": { "type": "afterpaytouch_US" }, "amount": { "value": 1000, "currency": "USD" }, "shopperName": { "firstName": "", "lastName": "" }, "shopperEmail": "s.hopper@example.com", "shopperReference": "", "reference": "YOUR_ORDER_REFERENCE", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "returnUrl": "my-app://adyen", "countryCode": "US", "telephoneNumber": "+16123456789", "billingAddress": { "city": "San Francisco", "country": "US", "houseNumberOrName": "274", "postalCode": "94107", "stateOrProvince": "CA", "street": "Brennan St." }, "deliveryAddress": { "city": "San Francisco", "country": "US", "houseNumberOrName": "274", "postalCode": "94107", "stateOrProvince": "CA", "street": "Brennan St." }, "lineItems": [ { "description": "Shoes", "quantity": "1", "amountIncludingTax": "400", "amountExcludingTax": "331", "taxAmount": "69", "id": "Item #1" }, { "description": "Socks", "quantity": "2", "amountIncludingTax": "300", "amountExcludingTax": "248", "taxAmount": "52", "id": "Item #2" } ] } result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.1.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'YOUR_X_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :paymentMethod => { :type => 'afterpaytouch_US' }, :amount => { :value => 1000, :currency => 'USD' }, :shopperName => { :firstName => '', :lastName => '' }, :shopperEmail => 's.hopper@example.com', :shopperReference => '', :reference => 'YOUR_ORDER_REFERENCE', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :returnUrl => 'my-app://adyen', :countryCode => 'US', :telephoneNumber => '+16123456789', :billingAddress => { :city => 'San Francisco', :country => 'US', :houseNumberOrName => '274', :postalCode => '94107', :stateOrProvince => 'CA', :street => 'Brennan St.' }, :deliveryAddress => { :city => 'San Francisco', :country => 'US', :houseNumberOrName => '274', :postalCode => '94107', :stateOrProvince => 'CA', :street => 'Brennan St.' }, :lineItems => [ { :description => 'Shoes', :quantity => '1', :amountIncludingTax => '400', :amountExcludingTax => '331', :taxAmount => '69', :id => 'Item #1' }, { :description => 'Socks', :quantity => '2', :amountIncludingTax => '300', :amountExcludingTax => '248', :taxAmount => '52', :id => 'Item #2' } ] } result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` ## Component configuration ### v5.0.0 or later If your integration uses iOS Components v5.0.0 or later, configure and create an instance of the Cash App Afterpay Component: ### Tab: /sessions **Component configuration** ```swift let paymentMethods = session.sessionContext.paymentMethods // Check that the payment method is supported before showing the Component. guard let paymentMethod = paymentMethods.paymentMethod(ofType: .other("afterpaytouch_US")) else { return } let component = InstantPaymentComponent(paymentMethod: paymentMethod, context: context, order: nil) self.currentComponent = component // Set the session as the delegate. component.delegate = session component.initiatePayment() ``` ### Tab: Advanced flow **Component configuration** ```swift // Check that the payment method is supported before showing the Component. guard let paymentMethod = paymentMethods.paymentMethod(ofType: .other("afterpaytouch_US")) else { return } let component = InstantPaymentComponent(paymentMethod: paymentMethod, context: context, order: nil) self.currentComponent = component // Set the component as the delegate. component.delegate = self component.initiatePayment() ``` ### v4.x.x If your integration uses an earlier version of iOS Components: **Component configuration** ```swift // Check that the payment method is supported before showing the Component. guard let paymentMethod = paymentMethods.paymentMethod(ofType: AfterpayPaymentMethod.self) else { return } let style = FormComponentStyle() let component = AfterpayComponent(paymentMethod: paymentMethod, apiContext: context, style: style) present(component) ``` There are no configuration steps specific to Cash App Afterpay required for Components. ## Capture the payment Depending on your merchant account configuration, Cash App 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](/online-payments/capture#delayed-automatic-capture) or use [manual capture](/online-payments/capture#capture-a-payment). To partially capture a payment, you also need to use manual capture. Cash App Afterpay payments have to be captured within 13 days after authorisation. During authorisation, the shopper is charged for the first installment. If the payment is not captured within 13 days, before the second installment, Cash App Afterpay cancels the payment and refunds the first installment to the shopper. For testing purposes, Cash App Afterpay authorisations expire in one day. When you use manual capture, you need to capture test Cash App Afterpay payments within one day after authorisation. ### Full or partial manual captures When you use manual capture, in your [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request specify: * [amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures#request-amount-value): the full or partial amount that the shopper should pay. * [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures#request-lineItems): (optional) price and product information for the items that the shopper should pay for. Any 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. To set up multiple partial captures, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other). Multiple partial captures will create a new invoice for each capture. ## Refunds and cancellations If a payment has not yet been captured, you can [cancel](/online-payments/cancel) it. If a payment has already been captured and you want to return the funds to the shopper, you need to [refund](/online-payments/refund) the payment. ### Full or partial refunds To fully or partially refund a payment, in your [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) request specify: * [amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-amount-value): the full or partial amount to be refunded to the shopper. * [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-lineItems): (optional) price and product information about the refunded items. ## Discounts 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 USD on Item #2: ```json { "amount":{ "value":800, "currency":"USD" }, ... "lineItems":[ { "description":"Test Cash App Afterpay 1", "quantity":"1", "amountIncludingTax":"400", "id":"Item #1" }, { "description":"Test Cash App Afterpay 2", "quantity":"2", "amountIncludingTax":"300", "id":"Item #2" } { "description":"Discount", "quantity":"2", "amountIncludingTax":"-100", "id":"Item #2 Discount" } ] } ``` ## Test and go live To test Cash App Afterpay payments, you need a test shopper account in the Afterpay sandbox environment. To create a test account: 1. Go to . 2. Enter a real email address and select **Continue**. You will get confirmations of payments and refunds like any other shopper on this email address. 3. From the drop-down menu, select the country/region for which you want to create a test shopper account: **US**. 4. Enter any mobile telephone number that is formatted correctly, and select **Continue**. Check the input box for hints on the format. The phone number will not be used. 5. When you are prompted to enter your SMS verification code, enter **111111**. 6. Follow the instructions on your screen to complete your profile, accept the terms and conditions, and select **Continue**. To test payments, add a test card to your Afterpay test shopper account.\ You can use the card details provided in the Afterpay [developer documentation](https://developers.afterpay.com/afterpay-online/docs/customer-accounts), or use one of the Adyen [test cards](/development-resources/test-cards-and-credentials/test-card-numbers). Use CVV 000 to simulate authorised payments, or CVV 051 to simulate refused payments. You can check the status of test payments in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**. Before you can accept live Cash App Afterpay payments, you need to [submit a request for Cash App Afterpay](/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/). ## See also * [iOS Components integration guide](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components) * [Webhooks](/development-resources/webhooks) * [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)