This page explains how to add Cash App Pay to your existing Android Components integration.
If you are using Android Components v5.0.0 or later:
This payment method requires no additional configuration.
Follow the Components integration guide and use the following module and Component names:
- To import the module: cashapppay
- To launch and show the Component: CashAppPayComponent
If you have an existing Android Components integration, you can use our Redirect Component to redirect the shopper to complete the payment. As with other redirect payment methods, you need to handle the redirect after the shopper returns to your app.
Requirements
| Requirement | Description | 
|---|---|
| Integration type | Make sure that you have built an Advanced flow Android Components integration. The minimum required version is 4.12.0. | 
| Webhooks | Enable the Recurring tokens life cycle events webhook. | 
| Setup steps | Before you begin: 
 | 
Set up the Cash App Pay Component
- 
Import the Cash App Pay Component to your build.gradlefile.implementation "com.adyen.checkout:cashapppay:<latest-version>"For the latest version, refer to our GitHub. 
- 
Build a client-side configuration of the Cash App Pay Component. val cashAppPayConfiguration = CashAppPayConfiguration.Builder(shopperLocale, environment, clientKey) // mandatory configuration .setReturnUrl(CashAppPayComponent.getReturnUrl(context)) .build
- 
Add the Component view to your layout. You will attach the initialized component to this view when collecting payment details. <com.adyen.checkout.cashapppay.CashAppPayView android:id="@+id/cashAppPayView" android:layout_width="match_parent" android:layout_height="wrap_content" />
- 
Add an IntentFilterto theActivitythat will handle thereturnUrlspecified in your configuration and your/paymentsrequest.<activity android:name=".YourActivity"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:host="${applicationId}" android:scheme="adyencheckout"/> </intent-filter> </activity>The ${applicationId}will be replaced withyour.package.nameat build time.
Optional configuration
You can add the following optional configuration:
| Parameter name | Description | Default | 
|---|---|---|
| setShowStorePaymentField | Set to false if you do not want to show a toggle that lets the shopper choose whether to save their payment details. | true | 
| setStorePaymentMethod | Set to true to save the shopper's payment details without showing a toggle. For example, use this for a page where the shopper enters their details for a subscription service that charges the shopper on a recurring basis. Set setShowStorePaymentFieldto false if you use this. | false | 
Collect payment details
In this step, we use the client-side Component to send the shopper to the Cash App Pay app to authorize the payment.
- 
Deserialize the /paymentMethodsresponse with theSERIALIZERobject.val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize(paymentMethodsResponse)
- 
From the result, get the object containing paymentMethods.type: cashapp.
- 
Initialize an instance of the Component. To do this, you need to call PROVIDER.getfrom the Cash App Pay Component and pass the following:- The context (for example, FRAGMENT_OR_ACTIVITY)
- The PaymentMethodobject (for example,paymentMethod)
- The cashappConfigurationobject
 val cashAppPayComponent = CashAppPayComponent.PROVIDER.get(FRAGMENT_OR_ACTIVITY, paymentMethod, cashAppPayConfiguration)
- The context (for example, 
- 
Attach the Component to the view to start getting your shopper's payment details. You need to call attachfrom the payment method's Component view and pass in:- the cashappComponent
- the context (for example, FRAGMENT_OR_ACTIVITY)
 cashAppPayView.attach(cashAppPayComponent, FRAGMENT_OR_ACTIVITY)
- the 
- 
Add the Cash App Pay button. When the shopper clicks the button, call cashAppPayComponent.submit(). The Cash App Pay app will launch for the shopper to approve the payment.
- 
You start receiving updates when the shopper completes an action in their Cash App Pay app. Check if isValidis true, and if the shopper proceeds to pay, pass thepaymentComponentState.data.paymentMethodto your server.cashappComponent.observe(this@FRAGMENT_OR_ACTIVITY) { state -> if (state?.isValid == true) { //serialize data val paymentComponentData = PaymentComponentData.SERIALIZER.serialize(state.data) // When the shopper proceeds to pay, pass the serialized `state.data` to your server to send a /payments request } }
Make a payment
When the shopper proceeds to pay:
- 
From your server, make a POST /payments request, specifying: - paymentMethod.type: Set this to cashapp.
- returnUrl: URL to where the shopper should be redirected back to after they complete the payment. Get this URL from the Component in the- CashAppPayComponent.getReturnUrl(context).
 
- 
In the /payments response, note the following: - pspReference: Our unique identifier for the transaction.
- resultCode: Use this to show the payment result to your shopper.
- merchantReference: The- referencefrom the /payments request.
 
Show the payment result
Use the resultCode from the /payments/details response to show the payment result to your shopper. You will also receive the outcome of the payment asynchronously in a webhook.
For Cash App Pay payments, you can receive the following resultCode values:
| resultCode | Description | Action to take | 
|---|---|---|
| Received | The shopper has completed the payment but the final result is not yet known. | Inform the shopper that you have received their order, and are waiting for the payment to be completed. You will receive an AUTHORISATION webhook when the status of the payment is updated. | 
| Authorised | The payment was successful. | Inform the shopper that the payment has been successful. If you are using manual capture, you also need to capture the payment. | 
| Cancelled | The shopper cancelled the payment. | Ask the shopper whether they want to continue with the order, or ask them to select a different payment method. | 
| Error | There was an error when the payment was being processed. For more information, check the refusalReasonfield. | Inform the shopper that there was an error processing their payment. | 
| Refused | The payment was refused.  For more information, check the refusalReasonfield. | Ask the shopper to try the payment again using a different payment method. | 
Recurring and card-on-file payments
Cash App Pay supports tokenization of the shopper's payment details for future recurring and card-on-file payments. Card-on-file payments are ad-hoc payments where you use the shopper's token. By getting the shopper's permission to save their payment details when you create the token, you can bypass the shopper approval step for those future payments.
We strongly recommend that you ask explicit permission from the shopper if you intend to make future recurring or card-on-file payments. In the case of recurring payments, being transparent about the payment schedule and the amount of recurring payments reduces the risk of chargebacks.
Create a token
To store a shopper's Cash App Pay details, set setShowStorePaymentField to true when adding the Cash App Pay Component. This shows a toggle that lets the shopper choose whether to save their payment details. You can also store the details automatically by setting setstorePaymentMethod to true and setShowStorePaymentField to false in the Component configuration.
If the shopper chooses to save their details when making a payment, the observe method from the Component includes a state.data.storePaymentMethod. Pass this to your server.
To create a token, include in your /payments request:
- storePaymentMethod: The- paymentComponentState.data.storePaymentMethodfrom your client app.
- shopperReference: Your unique identifier for the shopper.
Get the shopper's $cashtag
We recommend making sure that your recurring payments include the shopper's $cashtag. The $cashtag makes it easier for the shopper to recognize the recurring payment as a legitimate one. This helps to avoid chargebacks.
- Make sure that you have enabled receiving the shopper's $cashtag:
 In your Customer Area, go to Developers > Additional Data and select Token information for digital wallets.
- Make a POST /payments/details request. For instructions, see Send additional payment details.
- 
From the /payments/detailsresponse, save the followingadditionalDatadetails:Parameter Description additionalData.cashapp.cashtagThe shopper's $cashtag. additionalData.tokenization.shopperReferenceThe shopper reference you specified in the payment request. additionalData.tokenization.storedPaymentMethodIdThe token that was generated through the payment request. Note that the recurring.token.created also includes the shopper reference and the recurring detail reference, but not the $cashtag. 
Make a payment with a token
When the shopper selects to pay, the Component calls the onSubmit event, which contains a state.data.
- 
Pass the state.datato your server.
- 
From your server, make a /payments request, specifying: - The parameters required for one-off or recurring tokenized payments. For instructions, see Tokenization.
- paymentMethod: The- state.data.paymentMethodfrom the- onSubmitevent.
 To make it easier for the shopper to recognize the recurring payment as a legitimate one, optionally include: - paymentMethod.cashtag: the shoppers $cashtag.
 
- 
In the /payments response, note the following: - resultCode: Use this to show the payment result to your shopper.
 
Receive a notification when a shopper deletes stored Cash App Pay details
When a shopper deletes their stored payment details in Cash App Pay, Adyen sends a recurring.token.disabled webhook.
You can prevent future failed payments by removing the stored token for Cash App pay and asking the shopper to use another payment method.
Test and go live
Test your Cash App Pay integration using the test environment. You can simulate various payment scenarios using Cash App Pay magic values. You can check the status of Cash App Pay test payments in your Customer Area, under Transactions > Payments.
When you are ready to go live, add Cash App Pay in your live Customer Area.