> ## Documentation Index
> Fetch the complete documentation index at: https://gr4vy.radial-commerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Adyen - Cash App Afterpay

> Configure Cash App Afterpay via Adyen as a payment method in Gr4vy.

**Adyen**

Adyen is a global payment technology company founded in 2006 in Amsterdam, Netherlands. The company provides a single platform for accepting payments across online, mobile, and in-store channels for major enterprises worldwide including Uber, Spotify, and Microsoft.

Cash App Afterpay is a buy now, pay later (BNPL) payment method offered by Block in the United States, where Afterpay is now part of Cash App. The buyer approves the purchase with Afterpay and pays for it in installments. Cash App Afterpay is known as Afterpay Touch in some regions, and Adyen processes it as the `afterpaytouch_US` payment method.

## Setup

Please follow the [common Adyen instructions](https://gr4vy.radial-commerce.com/connections/payments/adyen.md) to get set up with Cash App Afterpay.

Next, make sure to enable Cash App Afterpay as a payment method on your configured account.

## Supported countries

## Supported currencies

## Capabilities

This list is for guidance only. It doesn't guarantee availability or
create any rights, and the provider may need to enable some features for
your account.

## Required fields

Cash App Afterpay requires the buyer's billing details and the cart items on every transaction. Include the following buyer fields when creating a transaction:

* `buyer.billing_details.first_name`
* `buyer.billing_details.last_name`
* `buyer.billing_details.email_address`
* `buyer.billing_details.address.line1`
* `buyer.billing_details.address.city`
* `buyer.billing_details.address.state`
* `buyer.billing_details.address.postal_code`
* `buyer.billing_details.address.country`

Also send `cart_items` with the transaction. Afterpay uses the cart to present the installment plan to the buyer, and the transaction fails when the cart is missing.

## Integration

For Cash App Afterpay, the default integration for Adyen is through a redirect to a hosted payments page.

### Redirect integration

Start by creating a new transaction with the payment method set to `cashappafterpay`, along with the buyer billing details and cart items listed in [Required fields](#required-fields).

```csharp C# theme={"system"}
var transaction = await client.Transactions.CreateAsync(
  transactionCreate: new TransactionCreate()
  {
    Amount = 1299,
    Currency = "USD",
    Country = "US",
    Intent = "capture",
    PaymentMethod =
      TransactionCreatePaymentMethod.CreateRedirectPaymentMethodCreate(
        new RedirectPaymentMethodCreate()
        {
          Method = "cashappafterpay",
          Country = "US",
          Currency = "USD",
          RedirectUrl = "https://example.com/callback",
        }
      ),
    Buyer = new GuestBuyer()
    {
      BillingDetails = new BillingDetails()
      {
        FirstName = "John",
        LastName = "Doe",
        EmailAddress = "john.doe@example.com",
        Address = new Address()
        {
          Line1 = "1 Market Street",
          City = "San Francisco",
          State = "CA",
          PostalCode = "94105",
          Country = "US",
        },
      },
    },
    CartItems = new List<CartItem>()
    {
      new CartItem()
      {
        Name = "Example Product",
        Quantity = 1,
        UnitAmount = 1299,
      },
    },
  }
);
```

```go Go theme={"system"}
amount := int64(1299)
currency := "USD"
country := "US"
method := components.RedirectPaymentMethodCreateMethodCashappafterpay
redirectUrl := "https://example.com/callback"

redirectPaymentMethodCreate := components.RedirectPaymentMethodCreate{
  Method: method,
  Country: country,
  Currency: currency,
  RedirectURL: redirectUrl,
}
paymentMethod := components.CreateTransactionCreatePaymentMethodRedirectPaymentMethodCreate(redirectPaymentMethodCreate)

buyer := components.GuestBuyer{
  BillingDetails: &components.BillingDetails{
    FirstName:    gr4vy.String("John"),
    LastName:     gr4vy.String("Doe"),
    EmailAddress: gr4vy.String("john.doe@example.com"),
    Address: &components.Address{
      Line1:      gr4vy.String("1 Market Street"),
      City:       gr4vy.String("San Francisco"),
      State:      gr4vy.String("CA"),
      PostalCode: gr4vy.String("94105"),
      Country:    gr4vy.String("US"),
    },
  },
}

transactionCreate := components.TransactionCreate{
  Amount:        amount,
  Currency:      currency,
  Country:       &country,
  Intent:       gr4vy.Pointer(components.TransactionIntentCapture),
  PaymentMethod: &paymentMethod,
  Buyer:         &buyer,
  CartItems: []components.CartItem{
    {
      Name:       "Example Product",
      Quantity:   1,
      UnitAmount: 1299,
    },
  },
}

transaction, err := client.Transactions.Create(ctx, transactionCreate, nil, nil, nil)
```

```java Java theme={"system"}
CreateTransactionResponse transactionResponse = gr4vyClient.transactions().create()
  .transactionCreate(TransactionCreate.builder()
    .amount(1299L)
    .currency("USD")
    .country("US")
    .intent(TransactionIntent.CAPTURE)
    .paymentMethod(TransactionCreatePaymentMethod.of(RedirectPaymentMethodCreate.builder()
      .method(RedirectPaymentMethodCreateMethod.CASHAPPAFTERPAY)
      .country("US")
      .currency("USD")
      .redirectUrl("https://example.com/callback")
      .build()))
    .buyer(GuestBuyer.builder()
      .billingDetails(BillingDetails.builder()
        .firstName("John")
        .lastName("Doe")
        .emailAddress("john.doe@example.com")
        .address(Address.builder()
          .line1("1 Market Street")
          .city("San Francisco")
          .state("CA")
          .postalCode("94105")
          .country("US")
          .build())
        .build())
      .build())
    .cartItems(List.of(CartItem.builder()
      .name("Example Product")
      .quantity(1L)
      .unitAmount(1299L)
      .build()))
    .build())
  .call();

Transaction transaction = transactionResponse.transaction().orElse(null);
```

```php PHP theme={"system"}
$transactionCreate = new TransactionCreate(
  amount: 1299,
  currency: 'USD',
  country: 'US',
  intent: 'capture',
  paymentMethod: new RedirectPaymentMethodCreate(
    method: 'cashappafterpay',
    country: 'US',
    currency: 'USD',
    redirectUrl: 'https://example.com/callback'
  ),
  buyer: new GuestBuyer(
    billingDetails: new BillingDetails(
      firstName: 'John',
      lastName: 'Doe',
      emailAddress: 'john.doe@example.com',
      address: new Address(
        line1: '1 Market Street',
        city: 'San Francisco',
        state: 'CA',
        postalCode: '94105',
        country: 'US'
      )
    )
  ),
  cartItems: [
    new CartItem(
      name: 'Example Product',
      quantity: 1,
      unitAmount: 1299
    ),
  ]
);
$response = self::$sdk->transactions->create($transactionCreate);
$transaction = $response->transaction;
```

```python Python theme={"system"}
transaction: models.Transaction = client.transactions.create(
  amount=1299,
  currency="USD",
  country="US",
  intent="capture",
  payment_method={
    "method": "cashappafterpay",
    "country": "US",
    "currency": "USD",
    "redirect_url": "https://example.com/callback",
  },
  buyer={
    "billing_details": {
      "first_name": "John",
      "last_name": "Doe",
      "email_address": "john.doe@example.com",
      "address": {
        "line1": "1 Market Street",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94105",
        "country": "US",
      },
    }
  },
  cart_items=[
    {
      "name": "Example Product",
      "quantity": 1,
      "unit_amount": 1299,
    }
  ]
)
```

```ts TypeScript theme={"system"}
const transaction = await gr4vy.transactions.create({
  amount: 1299,
  currency: "USD",
  country: "US",
  intent: "capture",
  paymentMethod: {
    method: "cashappafterpay",
    country: "US",
    currency: "USD",
    redirectUrl: "https://example.com/callback"
  },
  buyer: {
    billingDetails: {
      firstName: "John",
      lastName: "Doe",
      emailAddress: "john.doe@example.com",
      address: {
        line1: "1 Market Street",
        city: "San Francisco",
        state: "CA",
        postalCode: "94105",
        country: "US"
      }
    }
  },
  cartItems: [
    {
      name: "Example Product",
      quantity: 1,
      unitAmount: 1299
    }
  ]
})
```

After the transaction is created, the API response includes `payment_method.approval_url` and the `buyer_approval_pending` status.

```json theme={"system"}
{
  "type": "transaction",
  "id": "ea1efdd0-20f9-44d9-9b0b-0a3d71e9b625",
  "payment_method": {
    "type": "payment-method",
    "approval_url": "https://cdn.sandbox.spider.gr4vy.app/connectors/adyen/apm.html?token=..."
  },
  "method": "cashappafterpay"
}
```

Redirect the buyer to the `approval_url` so they can approve the installment plan with Afterpay. After approval the buyer is redirected to the `redirect_url` you provided when creating the transaction. Do not rely solely on the redirect - either poll the transaction or (recommended) rely on webhooks to detect the final status (for example `capture_succeeded` or failure states).

### Direct integration

Adyen provides [web](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Components\&version=6.23.0), [Android](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components\&version=5.15.0) and [iOS](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components\&version=5.21.1) SDKs for a direct integration. For these flows you should indicate the platform by setting an appropriate `integration_client` when creating the transaction, and then build a client-side integration that uses the [`POST /transactions/:transaction_id/session`](https://gr4vy.radial-commerce.com/reference/transactions/get-transaction-session) API to initialize the Adyen SDK.

For mobile, set `integration_client` to `ios` or `android` and use your app deep link for `redirect_url` (for example, `yourapp://`).

After the transaction is created, the API response includes a `session_token` which can be used to get the [session data](https://gr4vy.radial-commerce.com/reference/transactions/get-transaction-session.md) for that transaction.

```sh theme={"system"}
POST /transactions/:transaction_id/session?token=:session_token
```

This session data provides the `sessionId` and `sessionData` required to load the Adyen SDK. Refer to the [Cash App Pay direct integration](https://gr4vy.radial-commerce.com/connections/payments/adyen-cashapp.md#direct-integration) for a worked example of initializing the Adyen SDK with this session data.

## Testing

Adyen has [instructions](https://docs.adyen.com/payment-methods/cash-app-afterpay/web-component/#test-and-go-live) on how to test Cash App Afterpay.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.