Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(Connector): [Stripe] Implement Cashapp Wallet (#1103)

AkshayaFoigerdadd13e38190
diff --git a/config/config.example.toml b/config/config.example.toml
index c137bd270a..843b78efe9 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -350,6 +350,9 @@ credit = { currency = "USD" }
debit = { currency = "USD" }
ach = { currency = "USD" }
+[pm_filters.stripe]
+cashapp = {country = "US", currency = "USD"}
+
[connector_customer]
connector_list = "stax"
diff --git a/config/development.toml b/config/development.toml
index 65b5946630..3ac236e81a 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -224,6 +224,7 @@ giropay = { country = "DE", currency = "EUR" }
eps = { country = "AT", currency = "EUR" }
sofort = { country = "AT,BE,DE,IT,NL,ES", currency = "EUR" }
ideal = { country = "NL", currency = "EUR" }
+cashapp = { country = "US", currency = "USD" }
[pm_filters.adyen]
google_pay = { country = "AU,NZ,JP,HK,SG,MY,TH,VN,BH,AE,KW,BR,ES,UK,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,RO,HR,LI,MT,SI,GR,PT,IE,CZ,EE,LT,LV,IT,PL,TR,IS,CA,US", currency = "AED,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HTG,HUF,IDR,ILS,INR,IQD,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LYD,MAD,MDL,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLE,SOS,SRD,STN,SVC,SZL,THB,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VEF,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW"}
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 730ac852b8..1bf53f2c4a 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -227,6 +227,9 @@ pix = { country = "BR", currency = "BRL" }
red_compra = { country = "CL", currency = "CLP" }
red_pagos = { country = "UY", currency = "UYU" }
+[pm_filters.stripe]
+cashapp = {country = "US", currency = "USD"}
+
[pm_filters.stax]
credit = { currency = "USD" }
debit = { currency = "USD" }
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 102354151d..892590e58a 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1031,6 +1031,8 @@ pub enum WalletData {
WeChatPayRedirect(Box<WeChatPayRedirection>),
/// The wallet data for WeChat Pay Display QrCode
WeChatPayQr(Box<WeChatPayQr>),
+ /// The wallet data for Cashapp Qr
+ CashappQr(Box<CashappQr>),
// The wallet data for Swish
SwishQr(SwishQrData),
}
@@ -1078,6 +1080,9 @@ pub struct WeChatPay {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct WeChatPayQr {}
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct CashappQr {}
+
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PaypalRedirection {}
@@ -1371,6 +1376,7 @@ pub enum NextActionData {
QrCodeInformation {
#[schema(value_type = String)]
image_data_url: Url,
+ display_to_timestamp: Option<i64>,
},
/// Contains the download url and the reference number for transaction
DisplayVoucherInformation {
@@ -1404,6 +1410,7 @@ pub struct VoucherNextStepData {
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct QrCodeNextStepsInstruction {
pub image_data_url: Url,
+ pub display_to_timestamp: Option<i64>,
}
#[derive(Clone, Debug, serde::Deserialize)]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 97f48da103..cb599d105b 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -881,6 +881,7 @@ pub enum PaymentMethodType {
ClassicReward,
Credit,
CryptoCurrency,
+ Cashapp,
Dana,
Debit,
Efecty,
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index 510e68963f..38902586a7 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -1594,6 +1594,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::PagoEfectivo => Self::Voucher,
PaymentMethodType::RedCompra => Self::Voucher,
PaymentMethodType::RedPagos => Self::Voucher,
+ PaymentMethodType::Cashapp => Self::Wallet,
}
}
}
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index 24050d09f1..170e5bea59 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -769,6 +769,7 @@ pub enum StripeNextAction {
},
QrCodeInformation {
image_data_url: url::Url,
+ display_to_timestamp: Option<i64>,
},
DisplayVoucherInformation {
voucher_details: payments::VoucherNextStepData,
@@ -800,9 +801,13 @@ pub(crate) fn into_stripe_next_action(
payments::NextActionData::ThirdPartySdkSessionToken { session_token } => {
StripeNextAction::ThirdPartySdkSessionToken { session_token }
}
- payments::NextActionData::QrCodeInformation { image_data_url } => {
- StripeNextAction::QrCodeInformation { image_data_url }
- }
+ payments::NextActionData::QrCodeInformation {
+ image_data_url,
+ display_to_timestamp,
+ } => StripeNextAction::QrCodeInformation {
+ image_data_url,
+ display_to_timestamp,
+ },
payments::NextActionData::DisplayVoucherInformation { voucher_details } => {
StripeNextAction::DisplayVoucherInformation { voucher_details }
}
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 4d49b3bc76..a7699323a4 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -370,6 +370,7 @@ pub enum StripeNextAction {
},
QrCodeInformation {
image_data_url: url::Url,
+ display_to_timestamp: Option<i64>,
},
DisplayVoucherInformation {
voucher_details: payments::VoucherNextStepData,
@@ -401,9 +402,13 @@ pub(crate) fn into_stripe_next_action(
payments::NextActionData::ThirdPartySdkSessionToken { session_token } => {
StripeNextAction::ThirdPartySdkSessionToken { session_token }
}
- payments::NextActionData::QrCodeInformation { image_data_url } => {
- StripeNextAction::QrCodeInformation { image_data_url }
- }
+ payments::NextActionData::QrCodeInformation {
+ image_data_url,
+ display_to_timestamp,
+ } => StripeNextAction::QrCodeInformation {
+ image_data_url,
+ display_to_timestamp,
+ },
payments::NextActionData::DisplayVoucherInformation { voucher_details } => {
StripeNextAction::DisplayVoucherInformation { voucher_details }
}
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 449bbb0f35..9bac031444 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2391,7 +2391,10 @@ pub fn get_qr_metadata(
.and_then(|image_data| Url::parse(image_data.data.as_str()).ok())
.ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
- let qr_code_instructions = payments::QrCodeNextStepsInstruction { image_data_url };
+ let qr_code_instructions = payments::QrCodeNextStepsInstruction {
+ image_data_url,
+ display_to_timestamp: None,
+ };
Some(common_utils::ext_traits::Encode::<
payments::QrCodeNextStepsInstruction,
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index b6c0910646..d999b9823d 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -433,6 +433,7 @@ pub enum StripeWallet {
ApplepayPayment(ApplepayPayment),
WechatpayPayment(WechatpayPayment),
AlipayPayment(AlipayPayment),
+ Cashapp(CashappPayment),
}
#[derive(Debug, Eq, PartialEq, Serialize)]
@@ -465,6 +466,12 @@ pub struct AlipayPayment {
pub payment_method_data_type: StripePaymentMethodType,
}
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct CashappPayment {
+ #[serde(rename = "payment_method_data[type]")]
+ pub payment_method_data_type: StripePaymentMethodType,
+}
+
#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct WechatpayPayment {
#[serde(rename = "payment_method_data[type]")]
@@ -517,6 +524,8 @@ pub enum StripePaymentMethodType {
Ach,
#[serde(rename = "wechat_pay")]
Wechatpay,
+ #[serde(rename = "cashapp")]
+ Cashapp,
}
#[derive(Debug, Eq, PartialEq, Serialize)]
@@ -1143,6 +1152,13 @@ fn create_stripe_payment_method(
Some(StripePaymentMethodType::Alipay),
StripeBillingAddress::default(),
)),
+ payments::WalletData::CashappQr(_) => Ok((
+ StripePaymentMethodData::Wallet(StripeWallet::Cashapp(CashappPayment {
+ payment_method_data_type: StripePaymentMethodType::Cashapp,
+ })),
+ Some(StripePaymentMethodType::Cashapp),
+ StripeBillingAddress::default(),
+ )),
payments::WalletData::GooglePay(gpay_data) => Ok((
StripePaymentMethodData::try_from(gpay_data)?,
Some(StripePaymentMethodType::Card),
@@ -1666,8 +1682,9 @@ pub struct SepaAndBacsBankTransferInstructions {
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
-pub struct WechatPayNextInstructions {
+pub struct QrCodeNextInstructions {
pub image_data_url: Url,
+ pub display_to_timestamp: Option<i64>,
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
@@ -1851,7 +1868,8 @@ impl ForeignFrom<(Option<StripePaymentMethodOptions>, String)> for types::Mandat
| StripePaymentMethodOptions::Przelewy24 {}
| StripePaymentMethodOptions::CustomerBalance {}
| StripePaymentMethodOptions::Blik {}
- | StripePaymentMethodOptions::Multibanco {} => None,
+ | StripePaymentMethodOptions::Multibanco {}
+ | StripePaymentMethodOptions::Cashapp {} => None,
}),
payment_method_id: Some(payment_method_id),
}
@@ -1936,16 +1954,28 @@ pub fn get_connector_metadata(
))
}
StripeNextActionResponse::WechatPayDisplayQrCode(response) => {
- let wechat_pay_instructions = WechatPayNextInstructions {
+ let wechat_pay_instructions = QrCodeNextInstructions {
image_data_url: response.image_data_url.to_owned(),
+ display_to_timestamp: None,
};
Some(
- common_utils::ext_traits::Encode::<WechatPayNextInstructions>::encode_to_value(
+ common_utils::ext_traits::Encode::<QrCodeNextInstructions>::encode_to_value(
&wechat_pay_instructions,
),
)
}
+ StripeNextActionResponse::CashappHandleRedirectOrDisplayQrCode(response) => {
+ let cashapp_qr_instructions: QrCodeNextInstructions = QrCodeNextInstructions {
+ image_data_url: response.qr_code.image_url_png.to_owned(),
+ display_to_timestamp: response.qr_code.expires_at.to_owned(),
+ };
+ Some(
+ common_utils::ext_traits::Encode::<QrCodeNextInstructions>::encode_to_value(
+ &cashapp_qr_instructions,
+ ),
+ )
+ }
_ => None,
})
.transpose()
@@ -2082,10 +2112,11 @@ impl ForeignFrom<Option<LatestAttempt>> for Option<String> {
#[derive(Clone, Debug, Eq, PartialEq, Deserialize)]
#[serde(rename_all = "snake_case", remote = "Self")]
pub enum StripeNextActionResponse {
+ CashappHandleRedirectOrDisplayQrCode(StripeCashappQrResponse),
RedirectToUrl(StripeRedirectToUrlResponse),
AlipayHandleRedirect(StripeRedirectToUrlResponse),
VerifyWithMicrodeposits(StripeVerifyWithMicroDepositsResponse),
- WechatPayDisplayQrCode(StripeRedirectToQr),
+ WechatPayDisplayQrCode(WechatPayRedirectToQr),
DisplayBankTransferInstructions(StripeBankTransferDetails),
NoNextActionBody,
}
@@ -2100,6 +2131,7 @@ impl StripeNextActionResponse {
Self::VerifyWithMicrodeposits(verify_with_microdeposits) => {
Some(verify_with_microdeposits.hosted_verification_url.to_owned())
}
+ Self::CashappHandleRedirectOrDisplayQrCode(_) => None,
Self::DisplayBankTransferInstructions(_) => None,
Self::NoNextActionBody => None,
}
@@ -2143,7 +2175,7 @@ pub struct StripeRedirectToUrlResponse {
}
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
-pub struct StripeRedirectToQr {
+pub struct WechatPayRedirectToQr {
// This data contains url, it should be converted to QR code.
// Note: The url in this data is not redirection url
data: Url,
@@ -2167,6 +2199,20 @@ pub struct StripeBankTransferDetails {
pub bank_transfer_type: Option<String>,
}
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
+pub struct StripeCashappQrResponse {
+ pub mobile_auth_url: Url,
+ pub qr_code: QrCodeResponse,
+ pub hosted_instructions_url: Url,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
+pub struct QrCodeResponse {
+ pub expires_at: Option<i64>,
+ pub image_url_png: Url,
+ pub image_url_svg: Url,
+}
+
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct StripeFinanicalInformation {
pub iban: Option<SepaFinancialDetails>,
@@ -2398,6 +2444,7 @@ pub enum StripePaymentMethodOptions {
CustomerBalance {},
Multibanco {},
Blik {},
+ Cashapp {},
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 37d77db575..1e6b23a056 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -401,6 +401,7 @@ where
.or(next_action_containing_qr_code_url.map(|qr_code_data| {
api_models::payments::NextActionData::QrCodeInformation {
image_data_url: qr_code_data.image_data_url,
+ display_to_timestamp: qr_code_data.display_to_timestamp,
}
}))
.or(next_action_containing_wait_screen.map(|wait_screen_data| {
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index b37914ba7e..e2498c1f20 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -264,6 +264,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsCancelRequest,
api_models::payments::PaymentListConstraints,
api_models::payments::PaymentListResponse,
+ api_models::payments::CashappQr,
api_models::payments::BankTransferData,
api_models::payments::BankTransferNextStepsData,
api_models::payments::SepaAndBacsBillingDetails,
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 5d9d9a73d9..5cdee7e443 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -183,6 +183,7 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
| api_enums::PaymentMethodType::GoPay
| api_enums::PaymentMethodType::Gcash
| api_enums::PaymentMethodType::Momo
+ | api_enums::PaymentMethodType::Cashapp
| api_enums::PaymentMethodType::KakaoPay => Self::Wallet,
api_enums::PaymentMethodType::Affirm
| api_enums::PaymentMethodType::Alma
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index ac8c594e9c..be30387845 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -3419,6 +3419,9 @@
"Maestro"
]
},
+ "CashappQr": {
+ "type": "object"
+ },
"Connector": {
"type": "string",
"enum": [
@@ -6369,6 +6372,11 @@
"image_data_url": {
"type": "string"
},
+ "display_to_timestamp": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ },
"type": {
"type": "string",
"enum": [
@@ -7391,6 +7399,7 @@
"classic",
"credit",
"crypto_currency",
+ "cashapp",
"dana",
"debit",
"efecty",
@@ -10309,6 +10318,17 @@
}
}
},
+ {
+ "type": "object",
+ "required": [
+ "cashapp_qr"
+ ],
+ "properties": {
+ "cashapp_qr": {
+ "$ref": "#/components/schemas/CashappQr"
+ }
+ }
+ },
{
"type": "object",
"required": [