- Get Started
- Guides
- Integrations
- References
- API Reference
- Basic Payment
- Forex
- Authentication
- Card Account
- Apple Pay
- Virtual Account
- Bank Account
- Token Account
- Customer
- Billing Address
- Merchant Billing Address
- Shipping Address
- Merchant Shipping Address
- Merchant
- Corporate
- Recipient
- Marketplace & Cart
- Airline
- Lodging
- Passenger
- Tokenization
- Recurring Migration
- 3D Secure
- Custom Parameters
- Async Payments
- Job
- Risk
- Response Parameters
- Card On File
- Chargeback
- Result Codes
- Payment Methods
- Transaction Flows
- Regression Testing
- Data Retention Policy
- API Reference
- Support
Cash App Pay
Follow this guide to add CASH_APP_PAY to your checkout.
Brand constants to be used:
- CASH_APP_PAY - Cash App Pay
Payment methods availability:
- CASH_APP_PAY since mSDK version 6.15.0
iOS
Android
Configuration
Open the build.gradle file in the app module and add the following to the dependencies block
implementation "com.afterpay:afterpay-android:4.4.0"
implementation "app.cash.paykit:core:2.3.0"
To integrate CASH_APP_PAY you need to add the Afterpay Pacific and Cash App Pay dependencies in your project. Please download the XCFrameforks and add the dependencies following steps below:
- Download and unzip Afterpay framework from Github.
- Download and unzip PayKit framework from Github.
- Drag and drop
Afterpay.xcframework
to the "Frameworks" folder of your project.
Make sure "Copy items if needed" is checked. - Drag and drop
PayKit.xcframework
to the "Frameworks" folder of your project.
Make sure "Copy items if needed" is checked. - Check "Frameworks, Libraries, and Embedded Content" section under the general settings tab of your application's target. Ensure the Embed dropdown has Embed and Sign selected for the framework.
Cash App Pay SDK(PayKit)
- Cash App Pay SDK is called as PayKit.
To use PayKit iOS, CASH_APP_PAY must be able to call a URL that will redirect back to your app. The simplest way to accomplish this is via Custom URL Schemes, but if your app supports Universal Links you may use those URLs as well.
Choose a unique scheme for your application and register it in Xcode from the Info tab of your application’s Target.
When your app is called back by Cash App, simply post the CashAppPay.RedirectNotification from your AppDelegate or SceneDelegate. PayKit SDK use this notification to observe the SDK state changes.
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
[[NSNotificationCenter defaultCenter] postNotificationName:CAPCashAppPay.RedirectNotification object:nil userInfo:@{UIApplicationLaunchOptionsURLKey: url}];
return YES;
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set) {
if let url = URLContexts.first?.url {
NotificationCenter.default.post(name: CashAppPay.RedirectNotification, object: nil, userInfo: [UIApplication.LaunchOptionsKey.url: url])
}
}
Ready-to-Use UI
When you use our ready-to-use UI, everything works out-of-box. Just set CASH_APP_PAY payment brands and shopper result url in the Checkout Settings class and you are done. Proceed with the presenting checkout as for standard transaction.
You have to configure Afterpay first to use Cash App Pay.
Please contact Afterpay for configuration details.
OPPCheckoutSettings *checkoutSettings = [[OPPCheckoutSettings alloc] init];
// Set Cash App Pay payment methods
checkoutSettings.paymentBrands = @"CASH_APP_PAY";
// Create CashAppPayBrandConfig object
OPPCashAppPayBrandConfig *cashAppPayConfig = [[OPPCashAppPayBrandConfig alloc] initWithMinimumAmount:minimumAmount
maximumAmount:maximumAmount
currencyCode:currencyCode
locale:locale
consumerLocale:consumerLocale];
// Set Cash App Pay brand configuration
[checkoutSettings setBrandConfig:cashAppPayConfig];
let checkoutSettings = OPPCheckoutSettings()
// Set Cash App Pay payment methods
checkoutSettings.paymentBrands = "CASH_APP_PAY"
// Create CashAppPayBrandConfig object
let cashAppPayConfig = OPPCashAppPayBrandConfig(minimumAmount: minimumAmount,
maximumAmount: maximumAmount,
currencyCode: currencyCode,
locale: locale,
consumerLocale: consumerLocale)
// Set Cash App Pay brand configuration
checkoutSettings.setBrandConfig(cashAppPayConfig)
1. Create CASH_APP_PAY Config
Create CASH_APP_PAY config and set it to brand configuration using CheckoutPaymentBrandConfig.Builder
CashAppPayConfig cashAppPayConfig = new CashAppPayConfig(minimumAmount,
maximumAmount,
Locale locale,
consumerLocale,
currencyCode);
CheckoutPaymentBrandConfig brandConfig = new CheckoutPaymentBrandConfig.Builder()
.setCashAppPayConfig(cashAppPayConfig)
.build();
val cashAppPayConfig = CashAppPayConfig(
minimumAmount,
maximumAmount,
locale,
consumerLocale,
currencyCode
)
val brandConfig = CheckoutPaymentBrandConfig.Builder()
.setCashAppPayConfig(cashAppPayConfig)
.build()
2. Create CheckoutSettings
Create CheckoutSettings and set brand config
Set<String> paymentBrands = new LinkedHashSet<String>();
paymentBrands.add("CASH_APP_PAY");
CheckoutSettings checkoutSettings = new CheckoutSettings(checkoutId, paymentBrands, Connect.ProviderMode.TEST);
checkoutSettings.setBrandConfig(brandConfig);
val paymentBrands = hashSetOf("CASH_APP_PAY")
val checkoutSettings = CheckoutSettings(checkoutId, paymentBrands, Connect.ProviderMode.TEST)
checkoutSettings.setBrandConfig(brandConfig)
SDK & Your Own UI
In this guide we assume that you have already implemented all steps for performing standard mSDK transaction.
There are several steps that you have to perform to integrate CASH_APP_PAY pay kit, which are as follows:
1. Create CashAppPay brand configuration
Create CashAppPay brand configuration with minimum amount, maximum amount, currency code, locale and consumer locale.
OPPCashAppPayBrandConfig *cashAppPayConfig = [[OPPCashAppPayBrandConfig alloc] initWithMinimumAmount:minimumAmount
maximumAmount:maximumAmount
currencyCode:currencyCode
locale:locale
consumerLocale:consumerLocale];
let cashAppPayConfig = OPPCashAppPayBrandConfig(minimumAmount: minimumAmount,
maximumAmount: maximumAmount,
currencyCode: currencyCode,
locale: locale,
consumerLocale: consumerLocale)
2. Create CashAppPay payment param
Use checkoutId and brandConfiguration object created earlier to create CashAppPay Payment params.
NSError *error;
OPPCashAppPayPaymentParams *paymentParams = [OPPCashAppPayPaymentParams cashAppPayPaymentParamsWithCheckoutID:checkoutID
configuration:cashAppPayConfig
error:&error];
var params: OPPCashAppPayPaymentParams
do {
params = try OPPCashAppPayPaymentParams(checkoutID: checkoutID, configuration: cashAppPayConfig)
params.shopperResultURL = shopperResultURL
} catch let error as NSError {
// Handle the error
}
3. Submit transaction
Create a payment provider object and call submit transaction.
OPPPaymentProvider *provider = [OPPPaymentProvider paymentProviderWithMode:providerMode];
[provider submitTransaction:transaction completionHandler:^(OPPTransaction * _Nonnull transaction, NSError * _Nullable error) {
// Process transaction here using cash app pay processor
}];
let provider = OPPPaymentProvider(mode: providerMode)
self.provider.submitTransaction(transaction, completionHandler: {(transaction, error) in
// Process transaction here using cash app pay processor
})
4. Create CashAppPay processor object to process transaction
To complete cash app pay transaction you have to create CashAppPayProcessor object and you have to call 'process' method on it to process the transaction.
OPPCashAppPayProcessor *cashAppPayProcessor = [[OPPCashAppPayProcessor alloc] initWithTransaction:transaction error:&error];
if (error) {
// Handle error
} else {
[cashAppPayProcessor process:^(OPPTransaction * _Nonnull transaction, NSError * _Nullable error) {
if (error) {
// Handle error
} else {
// Get the payment status
}
}];
}
do {
let cashAppPayProcessor = try OPPCashAppPayProcessor(transaction: transaction)
cashAppPayProcessor?.process { transaction, error in
if let error = error {
// Handle error
} else {
// Get the payment status
}
}
} catch {
// Handle error
}
5. Get the payment status
Finally your app should request the payment status from your server.
For more details you can refer to this document.
1. Create CashAppPay brand configuration
Create CashAppPay brand configuration with minimum amount, maximum amount, currency code, locale and consumer locale.
CashAppPayConfig config = new CashAppPayConfig(minimumAmount,
maximumAmount,
Locale locale,
consumerLocale,
currencyCode);
val cashAppPayConfig = CashAppPayConfig(minimumAmount,
maximumAmount,
Locale locale,
consumerLocale,
currencyCode)
2. Create CashAppPay payment param
Use checkoutId and brandConfiguration(CashAppPayConfig) object created earlier to create CashAppPay Payment params.
CashAppPayPaymentParams paymentParams = new CashAppPayPaymentParams(checkoutId, cashAppPayConfig);
// no need to set ShopperResultUrl for cashAppPay
val paymentParams = CashAppPayPaymentParams(checkoutId, cashAppPayConfig)
// no need to set ShopperResultUrl for CASH_APP_PAY
3. Submit transaction
Create Transaction object by passing CashAppPayPaymentParams, then create payment provider object and call submit transaction.
Transaction transaction = new Transaction(paymentParams);
OppPaymentProvider paymentProvider = new OppPaymentProvider(this, Connect.ProviderMode.TEST);
paymentProvider.submitTransaction(transaction, this);
val transaction = Transaction(paymentParams)
val paymentProvider = OppPaymentProvider(this, Connect.ProviderMode.TEST)
paymentProvider.submitTransaction(transaction, this)
4. Register ActivityResultLauncher object to launch CASH_APP_PAY Processor to process the transaction
To complete CASH_APP_PAY transaction after you receive a transaction object in the callback of step 3, you have to create ActivityResultLaucher object of CashAppPayProcessorActivityResultContract and launch with that transaction.
5. Get the payment status
Finally your app should request the payment status from your server.
For more details you can refer to this document.