This page explains how to add Cash App Pay to your existing iOS Components integration.
Cash App Pay is supported from Components version 5.2.0 and later. For more information, see release notes.
Before you begin
This page explains how to add Cash App Pay to your existing iOS Components integration.
Before starting your Cash App Pay integration:
- Make sure that you have set up your back end implementation for making API requests.
- Add Cash App Pay in your Customer Area. You will need your Cash App client ID to do this.
Install the Adyen iOS client-side library
Choose how you want to install the Adyen iOS client-side library:
To install iOS Drop-in using Swift Package Manager, follow the Apple guide and specify:
- The repository URL as
https://github.com/Adyen/adyen-ios
- The version to be at least v5.42.0
- Include
AdyenCashAppPay
API reference
You don't need to send additional fields for Cash App Pay. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:
- /sessions: This is the default with v5.0.0 or later.
- /payments: If you implemented an additional use case.
Component configuration
To add Cash App Pay to your Components integration, create a CashAppPayConfiguration
instance with the redirect URL for your app.
// Create a `CashAppPayConfiguration` instance with the redirect URL for your your app.
let configuration = CashAppPayConfiguration(redirectURL: URL(string: "yourAppURLOrScheme"))
// Create a `CashAppPayPaymentMethod` instance from your payment methods list.
let paymentMethod = paymentMethods.paymentMethod(ofType: CashAppPayPaymentMethod.self)
//Create the the `CashAppPayComponent` with the `paymentMethod` and the `configuration`.
let component = CashAppPayComponent(paymentMethod: paymentMethod, context: adyenContext, configuration: configuration)
Set your AdyenSession
instance as the delegate to let it handle the flow.
component.delegate = self.adyenSession
Present your component's view.
navigationController.present(component.viewController)
Optional configuration
You can add the following optional configuration:
Parameter name | Description | Default |
---|---|---|
showsStorePaymentField |
Set to false if you don't want to show a toggle that lets the shopper choose whether to save their payment details. | true |
storePaymentMethod |
Set to true to save the shopper's payment details without asking if they want to. Set showsStorePaymentField to false if you use this. |
false |
Show the payment result
Use the resultCode from the /sessions or /payments 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 |
---|---|---|
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
refusalReason
field. |
Inform the shopper that there was an error processing their payment. |
Refused | The payment was refused. For more information, check the
refusalReason
field. |
Ask the shopper to try the payment again using a different payment method. |
Recurring payments
Adyen's tokenization service allows you to securely store the shopper's payment details for recurring payments. To make recurring Cash App Pay payments, you first need to create a shopper token, and then use the token to make future payments for the shopper.
The CashAppPayComponent
supports recurring payments with its configuration
property in the CashAppPayConfiguration
class.
Create a token
Include the
storedPaymentMethodMode
parameter in your /sessions request. Possible values:
Value | Description |
---|---|
disabled (default) | Don't store payment details. |
askForConsent | If shopperReference is included in the request, show a toggle in the payment form that lets the shopper choose whether to save their payment details. |
enabled | If shopperReference is included in the request, store the shopper's payment details without asking them. |
The Cash App SDK requires you to specify whether to create a recurring request. If you set storedPaymentMethodMode
to enabled or disabled, you must also specify the following in your configuration:
storedPaymentMethod
: To store the payment method. This property is ignored ifshowsStorePaymentMethodField
is true.
If you or the shopper chooses to store payment details, your instance of AdyenSession
creates a token when the shopper pays.
Make a payment with a token
When the shopper pays, your instance of AdyenSession
includes the shopper's stored Cash App Pay details. You can also use tokens to make shopper-not-present payments for subscriptions or contracts.
Test and go live
Test your Cash App 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.
Add Cash App Pay in your live Customer Area when you are ready to accept live payments.