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(Generic): Upgrading Capture Method handling to auto-fallback (#14452)

Ritam Kabiraj6bc257a8b098
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index c0eb784eb4..0ffe766050 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -36504,6 +36504,14 @@
],
"nullable": true
},
+ "capture_method_applied": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CaptureMethod"
+ }
+ ],
+ "nullable": true
+ },
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
},
@@ -38373,6 +38381,14 @@
],
"nullable": true
},
+ "capture_method_applied": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CaptureMethod"
+ }
+ ],
+ "nullable": true
+ },
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
},
@@ -43184,6 +43200,12 @@
"description": "Indicates if manual retry for payment is enabled or not",
"nullable": true
},
+ "auto_fallback_capture_method": {
+ "type": "boolean",
+ "description": "When `true`, a payment whose requested `capture_method` is not supported by the\nconnector chosen for it is processed with `automatic` capture instead of being rejected,\nand the payment method list does not hide payment methods based on `capture_method`.",
+ "example": true,
+ "nullable": true
+ },
"always_enable_overcapture": {
"type": "boolean",
"description": "Bool indicating if overcapture must be requested for all payments",
@@ -43583,6 +43605,12 @@
"description": "Indicates if manual retry for payment is enabled or not",
"nullable": true
},
+ "auto_fallback_capture_method": {
+ "type": "boolean",
+ "description": "When `true`, a payment whose requested `capture_method` is not supported by the\nconnector chosen for it is processed with `automatic` capture instead of being rejected,\nand the payment method list does not hide payment methods based on `capture_method`.",
+ "example": true,
+ "nullable": true
+ },
"always_enable_overcapture": {
"type": "boolean",
"description": "Bool indicating if overcapture must be requested for all payments",
diff --git a/config/config.example.toml b/config/config.example.toml
index d5984833d9..0241f83ca9 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1066,7 +1066,7 @@ sepa = {country = "FR, IT, GR, BE, BG, FI, EE, HR, IE, DE, DK, LT, LV, MT, LU, A
sepa_guarenteed_debit = {country = "AT, CH, DE", currency="EUR"}
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
+mifinity = { not_available_flows = { capture_method = "manual" }, country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.nordea]
sepa = { country = "DK,FI,NO,SE", currency = "DKK,EUR,NOK,SEK" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 2b42330930..8cb162efc1 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -568,7 +568,7 @@ klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,C
flexiti = { country = "CA", currency = "CAD"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B,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.payu]
debit = { country = "AE, AF, AL, AM, CW, AO, AR, AU, AW, AZ, BA, BB, BG, BH, BI, BM, BN, BO, BR, BS, BW, BY, BZ, CA, CD, LI, CL, CN, CO, CR, CV, CZ, DJ, DK, DO, DZ, EG, ET, AD, FJ, FK, GG, GE, GH, GI, GM, GN, GT, GY, HK, HN, HR, HT, HU, ID, IL, IQ, IS, JM, JO, JP, KG, KH, KM, KR, KW, KY, KZ, LA, LB, LR, LS, MA, MD, MG, MK, MN, MO, MR, MV, MW, MX, MY, MZ, NA, NG, NI, BV, CK, OM, PA, PE, PG, PL, PY, QA, RO, RS, RW, SA, SB, SC, SE, SG, SH, SO, SR, SV, SZ, TH, TJ, TM, TN, TO, TR, TT, TW, TZ, UG, AS, UY, UZ, VE, VN, VU, WS, CM, AI, BJ, PF, YE, ZA, ZM, ZW", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IQD, ISK, JMD, JOD, JPY, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LRD, LSL, MAD, MDL, MGA, MKD, MNT, MOP, MRU, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NZD, OMR, PAB, PEN, PGK, PLN, PYG, QAR, RON, RSD, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SOS, SRD, SVC, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index e91fd07cf4..a3fba64d0a 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -663,7 +663,7 @@ klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,C
flexiti = { country = "CA", currency = "CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,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S,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.payu]
debit = { country = "AE, AF, AL, AM, CW, AO, AR, AU, AW, AZ, BA, BB, BG, BH, BI, BM, BN, BO, BR, BS, BW, BY, BZ, CA, CD, LI, CL, CN, CO, CR, CV, CZ, DJ, DK, DO, DZ, EG, ET, AD, FJ, FK, GG, GE, GH, GI, GM, GN, GT, GY, HK, HN, HR, HT, HU, ID, IL, IQ, IS, JM, JO, JP, KG, KH, KM, KR, KW, KY, KZ, LA, LB, LR, LS, MA, MD, MG, MK, MN, MO, MR, MV, MW, MX, MY, MZ, NA, NG, NI, BV, CK, OM, PA, PE, PG, PL, PY, QA, RO, RS, RW, SA, SB, SC, SE, SG, SH, SO, SR, SV, SZ, TH, TJ, TM, TN, TO, TR, TT, TW, TZ, UG, AS, UY, UZ, VE, VN, VU, WS, CM, AI, BJ, PF, YE, ZA, ZM, ZW", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IQD, ISK, JMD, JOD, JPY, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LRD, LSL, MAD, MDL, MGA, MKD, MNT, MOP, MRU, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NZD, OMR, PAB, PEN, PGK, PLN, PYG, QAR, RON, RSD, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SOS, SRD, SVC, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index bc1f7b3178..a53d491239 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -671,7 +671,7 @@ klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,C
flexiti = { country = "CA", currency = "CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,R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EK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.payu]
debit = { country = "AE, AF, AL, AM, CW, AO, AR, AU, AW, AZ, BA, BB, BG, BH, BI, BM, BN, BO, BR, BS, BW, BY, BZ, CA, CD, LI, CL, CN, CO, CR, CV, CZ, DJ, DK, DO, DZ, EG, ET, AD, FJ, FK, GG, GE, GH, GI, GM, GN, GT, GY, HK, HN, HR, HT, HU, ID, IL, IQ, IS, JM, JO, JP, KG, KH, KM, KR, KW, KY, KZ, LA, LB, LR, LS, MA, MD, MG, MK, MN, MO, MR, MV, MW, MX, MY, MZ, NA, NG, NI, BV, CK, OM, PA, PE, PG, PL, PY, QA, RO, RS, RW, SA, SB, SC, SE, SG, SH, SO, SR, SV, SZ, TH, TJ, TM, TN, TO, TR, TT, TW, TZ, UG, AS, UY, UZ, VE, VN, VU, WS, CM, AI, BJ, PF, YE, ZA, ZM, ZW", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IQD, ISK, JMD, JOD, JPY, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LRD, LSL, MAD, MDL, MGA, MKD, MNT, MOP, MRU, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NZD, OMR, PAB, PEN, PGK, PLN, PYG, QAR, RON, RSD, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SOS, SRD, SVC, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL" }
diff --git a/config/development.toml b/config/development.toml
index ce54dfe624..0096159ae3 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -985,7 +985,7 @@ klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,C
flexiti = { country = "CA", currency = "CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
+mifinity = { not_available_flows = { capture_method = "manual" }, country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.zen]
credit = { not_available_flows = { capture_method = "manual" } }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 3aa5144332..56e340f3b7 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -983,7 +983,7 @@ klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,C
flexiti = { country = "CA", currency = "CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,G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CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.stax]
credit = { country = "US", currency = "USD" }
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 4f0f61cbea..64515dfbf1 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2485,6 +2485,12 @@ pub struct ProfileCreate {
/// Indicates if manual retry for payment is enabled or not
pub is_manual_retry_enabled: Option<bool>,
+ /// When `true`, a payment whose requested `capture_method` is not supported by the
+ /// connector chosen for it is processed with `automatic` capture instead of being rejected,
+ /// and the payment method list does not hide payment methods based on `capture_method`.
+ #[schema(example = true)]
+ pub auto_fallback_capture_method: Option<bool>,
+
/// Bool indicating if overcapture must be requested for all payments
#[schema(value_type = Option<bool>)]
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
@@ -2875,6 +2881,12 @@ pub struct ProfileResponse {
/// Indicates if manual retry for payment is enabled or not
pub is_manual_retry_enabled: Option<bool>,
+ /// When `true`, a payment whose requested `capture_method` is not supported by the
+ /// connector chosen for it is processed with `automatic` capture instead of being rejected,
+ /// and the payment method list does not hide payment methods based on `capture_method`.
+ #[schema(example = true)]
+ pub auto_fallback_capture_method: Option<bool>,
+
/// Bool indicating if overcapture must be requested for all payments
#[schema(value_type = Option<bool>)]
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
@@ -3264,6 +3276,12 @@ pub struct ProfileUpdate {
/// Indicates if manual retry for payment is enabled or not
pub is_manual_retry_enabled: Option<bool>,
+ /// When `true`, a payment whose requested `capture_method` is not supported by the
+ /// connector chosen for it is processed with `automatic` capture instead of being rejected,
+ /// and the payment method list does not hide payment methods based on `capture_method`.
+ #[schema(example = true)]
+ pub auto_fallback_capture_method: Option<bool>,
+
/// Bool indicating if overcapture must be requested for all payments
#[schema(value_type = Option<bool>)]
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 26f15fc680..e5cac4ee73 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -7665,6 +7665,14 @@ pub struct PaymentsResponse {
#[smithy(value_type = "Option<CaptureMethod>")]
pub capture_method: Option<api_enums::CaptureMethod>,
+ /// The capture method the payment was sent to the connector with. Same as `capture_method`,
+ /// except when the profile's `auto_fallback_capture_method` is enabled and the connector did
+ /// not support the requested `capture_method`, in which case it is `automatic`. `null` until
+ /// the payment has been confirmed with a connector.
+ #[schema(value_type = Option<CaptureMethod>, example = "automatic")]
+ #[smithy(value_type = "Option<CaptureMethod>")]
+ pub capture_method_applied: Option<api_enums::CaptureMethod>,
+
/// The payment method that is to be used
#[schema(value_type = PaymentMethod, example = "bank_transfer")]
#[smithy(value_type = "Option<PaymentMethod>")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index c8220643e9..65a5cda33b 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -4137,6 +4137,57 @@ pub enum SplitTxnsEnabled {
Skip,
}
+/// Whether a payment whose requested capture method is not supported by the connector chosen
+/// for it falls back to automatic capture instead of being rejected.
+#[derive(
+ Clone,
+ Debug,
+ Copy,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+)]
+#[router_derive::diesel_enum(storage_type = "text")]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum AutoFallbackCaptureMethod {
+ /// Fall back to automatic capture when the requested capture method is unsupported
+ Enabled,
+ /// Reject the payment when the requested capture method is unsupported
+ Disabled,
+}
+
+impl AutoFallbackCaptureMethod {
+ /// Capture method a payment falls back to when the requested one is not supported.
+ pub const FALLBACK: CaptureMethod = CaptureMethod::Automatic;
+
+ pub fn is_enabled(self) -> bool {
+ matches!(self, Self::Enabled)
+ }
+
+ /// Whether a payment requesting `requested` may fall back to [`Self::FALLBACK`].
+ ///
+ /// The fallback is one-directional: a payment that already requests automatic capture has
+ /// nothing to fall back to, and moving it to manual capture would leave it uncaptured.
+ pub fn can_fall_back_from(self, requested: CaptureMethod) -> bool {
+ self.is_enabled() && requested != Self::FALLBACK
+ }
+}
+
+impl From<bool> for AutoFallbackCaptureMethod {
+ fn from(enabled: bool) -> Self {
+ if enabled {
+ Self::Enabled
+ } else {
+ Self::Disabled
+ }
+ }
+}
+
#[derive(
Clone,
Debug,
diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rs
index f65016f481..1f7a97fecb 100644
--- a/crates/common_types/src/payments.rs
+++ b/crates/common_types/src/payments.rs
@@ -1800,3 +1800,15 @@ pub struct AppliedOfferDetailsV1 {
}
impl_to_sql_from_sql_json!(AppliedOfferDetails);
+
+/// Values the router applied to a payment attempt in place of what was requested (stored as JSONB)
+#[derive(
+ Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, diesel::AsExpression,
+)]
+#[diesel(sql_type = Jsonb)]
+pub struct AppliedOverrides {
+ /// Capture method actually sent to the connector for this attempt
+ pub capture_method_applied: Option<enums::CaptureMethod>,
+}
+
+impl_to_sql_from_sql_json!(AppliedOverrides);
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index c41b7faff4..a94f3e2945 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -100,6 +100,7 @@ pub struct Profile {
pub order_fulfillment_time: Option<i64>,
pub apple_pay_certificates: Option<serde_json::Value>,
pub apple_pay_certificates_encrypted: Option<Encryption>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
}
#[cfg(feature = "v1")]
@@ -168,6 +169,7 @@ pub struct ProfileNew {
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
pub surcharge_connector_details: Option<SurchargeConnectorDetails>,
pub order_fulfillment_time: Option<i64>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
}
#[cfg(feature = "v1")]
@@ -240,6 +242,7 @@ pub struct ProfileUpdateInternal {
pub order_fulfillment_time: Option<i64>,
pub apple_pay_certificates: Option<serde_json::Value>,
pub apple_pay_certificates_encrypted: Option<Encryption>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
}
/// Note: The order of fields in the struct is important.
@@ -324,6 +327,7 @@ pub struct Profile {
pub order_fulfillment_time: Option<i64>,
pub apple_pay_certificates: Option<serde_json::Value>,
pub apple_pay_certificates_encrypted: Option<Encryption>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
pub frm_routing_algorithm_id: Option<String>,
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index e9155a8b0d..6a9d27aa22 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -177,6 +177,7 @@ pub struct PaymentAttempt {
/// Payment Account Reference (PAR) returned by the connector for the underlying payment method
pub payment_account_reference: Option<String>,
pub active_frm_id: Option<String>,
+ pub applied_overrides: Option<common_types::payments::AppliedOverrides>,
#[diesel(deserialize_as = RequiredFromNullable<storage_enums::PaymentMethod>)]
pub payment_method_type_v2: storage_enums::PaymentMethod,
pub connector_payment_id: Option<ConnectorTransactionId>,
@@ -320,6 +321,7 @@ pub struct PaymentAttempt {
/// Payment Account Reference (PAR) returned by the connector for the underlying card
pub payment_account_reference: Option<String>,
pub active_frm_id: Option<String>,
+ pub applied_overrides: Option<common_types::payments::AppliedOverrides>,
}
#[cfg(feature = "v1")]
@@ -579,6 +581,7 @@ pub struct PaymentAttemptNew {
pub sender_payment_instrument_id: Option<String>,
pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,
pub applied_offer_details: Option<common_types::payments::AppliedOfferDetails>,
+ pub applied_overrides: Option<common_types::payments::AppliedOverrides>,
pub payment_account_reference: Option<String>,
pub active_frm_id: Option<String>,
}
@@ -672,6 +675,7 @@ pub enum PaymentAttemptUpdate {
request_extended_authorization: Option<RequestExtendedAuthorizationBool>,
external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
applied_offer_details: Option<common_types::payments::AppliedOfferDetails>,
+ applied_overrides: Option<common_types::payments::AppliedOverrides>,
active_frm_id: Option<String>,
},
VoidUpdate {
@@ -1168,6 +1172,7 @@ pub struct PaymentAttemptUpdateInternal {
pub sender_payment_instrument_id: Option<String>,
pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
pub applied_offer_details: Option<common_types::payments::AppliedOfferDetails>,
+ pub applied_overrides: Option<common_types::payments::AppliedOverrides>,
pub payment_account_reference: Option<String>,
pub active_frm_id: Option<String>,
}
@@ -2593,6 +2598,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
error_details: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -2676,6 +2682,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -2725,6 +2732,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
request_extended_authorization,
external_surcharge_details,
applied_offer_details,
+ applied_overrides,
active_frm_id,
} => Self {
amount: Some(amount),
@@ -2803,6 +2811,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
error_details: None,
external_surcharge_details,
applied_offer_details,
+ applied_overrides,
payment_account_reference: None,
active_frm_id,
},
@@ -2887,6 +2896,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -2972,6 +2982,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -3057,6 +3068,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -3141,6 +3153,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -3224,6 +3237,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -3307,6 +3321,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -3429,6 +3444,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference,
active_frm_id: None,
}
@@ -3536,6 +3552,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
}
@@ -3617,6 +3634,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -3708,6 +3726,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
error_details: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -3806,6 +3825,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
}
@@ -3901,6 +3921,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
}
@@ -3986,6 +4007,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -4070,6 +4092,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -4163,6 +4186,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
}
@@ -4247,6 +4271,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -4334,6 +4359,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -4430,6 +4456,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
}
@@ -4514,6 +4541,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
@@ -4602,6 +4630,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
sender_payment_instrument_id: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id,
},
@@ -4685,6 +4714,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
external_surcharge_details: Some(external_surcharge_details),
external_threeds_authentication_type: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
active_frm_id: None,
},
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index d789ae4067..a6ccf7104d 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -344,6 +344,8 @@ diesel::table! {
order_fulfillment_time -> Nullable<Int8>,
apple_pay_certificates -> Nullable<Jsonb>,
apple_pay_certificates_encrypted -> Nullable<Bytea>,
+ #[max_length = 16]
+ auto_fallback_capture_method -> Nullable<Varchar>,
}
}
@@ -1248,6 +1250,7 @@ diesel::table! {
payment_account_reference -> Nullable<Varchar>,
#[max_length = 64]
active_frm_id -> Nullable<Varchar>,
+ applied_overrides -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 8b985e3a06..958980f4bf 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -318,6 +318,8 @@ diesel::table! {
order_fulfillment_time -> Nullable<Int8>,
apple_pay_certificates -> Nullable<Jsonb>,
apple_pay_certificates_encrypted -> Nullable<Bytea>,
+ #[max_length = 16]
+ auto_fallback_capture_method -> Nullable<Varchar>,
#[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time_origin -> Nullable<OrderFulfillmentTimeOrigin>,
@@ -1167,6 +1169,7 @@ diesel::table! {
payment_account_reference -> Nullable<Varchar>,
#[max_length = 64]
active_frm_id -> Nullable<Varchar>,
+ applied_overrides -> Nullable<Jsonb>,
payment_method_type_v2 -> Nullable<Varchar>,
#[max_length = 128]
connector_payment_id -> Nullable<Varchar>,
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index b38b6f471a..9f940f4fcd 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -329,6 +329,7 @@ impl PaymentAttemptBatchNew {
installment_data: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
payment_account_reference: None,
sender_payment_instrument_id: None,
external_threeds_authentication_type: None,
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index ecb21de84c..e7f276bf1c 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -85,6 +85,7 @@ pub struct Profile {
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
pub is_manual_retry_enabled: Option<bool>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub external_vault_details: ExternalVaultDetails,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
@@ -269,6 +270,7 @@ pub struct ProfileSetter {
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
pub is_manual_retry_enabled: Option<bool>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub external_vault_details: ExternalVaultDetails,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
@@ -341,6 +343,7 @@ impl From<ProfileSetter> for Profile {
merchant_country_code: value.merchant_country_code,
dispute_polling_interval: value.dispute_polling_interval,
is_manual_retry_enabled: value.is_manual_retry_enabled,
+ auto_fallback_capture_method: value.auto_fallback_capture_method,
always_enable_overcapture: value.always_enable_overcapture,
external_vault_details: value.external_vault_details,
billing_processor_id: value.billing_processor_id,
@@ -413,6 +416,7 @@ pub struct ProfileDbBuilder {
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
pub is_manual_retry_enabled: Option<bool>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub external_vault_details: ExternalVaultDetails,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
@@ -487,6 +491,7 @@ impl From<ProfileDbBuilder> for Profile {
merchant_country_code: value.merchant_country_code,
dispute_polling_interval: value.dispute_polling_interval,
is_manual_retry_enabled: value.is_manual_retry_enabled,
+ auto_fallback_capture_method: value.auto_fallback_capture_method,
always_enable_overcapture: value.always_enable_overcapture,
external_vault_details: value.external_vault_details,
billing_processor_id: value.billing_processor_id,
@@ -506,6 +511,20 @@ impl Profile {
&self.profile_id
}
+ #[cfg(feature = "v1")]
+ pub fn get_auto_fallback_capture_method(
+ &self,
+ ) -> Option<common_enums::AutoFallbackCaptureMethod> {
+ self.auto_fallback_capture_method
+ }
+
+ #[cfg(feature = "v2")]
+ pub fn get_auto_fallback_capture_method(
+ &self,
+ ) -> Option<common_enums::AutoFallbackCaptureMethod> {
+ None
+ }
+
#[cfg(feature = "v2")]
pub fn get_id(&self) -> &common_utils::id_type::ProfileId {
&self.id
@@ -563,6 +582,7 @@ pub struct ProfileGeneralUpdate {
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
pub is_manual_retry_enabled: Option<bool>,
+ pub auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub is_external_vault_enabled: Option<common_enums::ExternalVaultEnabled>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index bec3d15e68..cc3327dcb3 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -1452,6 +1452,8 @@ pub struct PaymentAttempt {
pub external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
/// Normalized applied-offer details from Offer Engine
pub applied_offer_details: Option<common_types::payments::AppliedOfferDetails>,
+ /// Values applied to this attempt in place of what was requested (e.g. capture method fallback)
+ pub applied_overrides: Option<common_types::payments::AppliedOverrides>,
/// Payment Account Reference (PAR) returned by the connector for the underlying card
pub payment_account_reference: Option<String>,
/// Sender payment instrument ID
@@ -1782,6 +1784,18 @@ impl PaymentAttempt {
#[cfg(feature = "v1")]
impl PaymentAttempt {
+ /// Capture method actually used with the connector for this attempt.
+ ///
+ /// `capture_method` keeps what the payment requested; when the profile's
+ /// `auto_fallback_capture_method` replaced it, the replacement is recorded in
+ /// `applied_overrides` and takes precedence here.
+ pub fn get_effective_capture_method(&self) -> Option<storage_enums::CaptureMethod> {
+ self.applied_overrides
+ .as_ref()
+ .and_then(|overrides| overrides.capture_method_applied)
+ .or(self.capture_method)
+ }
+
pub fn get_total_amount(&self) -> MinorUnit {
self.net_amount.get_total_amount()
}
@@ -2089,6 +2103,7 @@ pub enum PaymentAttemptUpdate {
request_extended_authorization: Option<RequestExtendedAuthorizationBool>,
external_surcharge_details: Option<common_types::payments::ExternalSurchargeDetails>,
applied_offer_details: Option<common_types::payments::AppliedOfferDetails>,
+ applied_overrides: Option<common_types::payments::AppliedOverrides>,
active_frm_id: Option<String>,
},
RejectUpdate {
@@ -2439,6 +2454,7 @@ impl PaymentAttemptUpdate {
request_extended_authorization,
external_surcharge_details,
applied_offer_details,
+ applied_overrides,
active_frm_id,
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
amount: net_amount.get_order_amount(),
@@ -2493,6 +2509,7 @@ impl PaymentAttemptUpdate {
request_extended_authorization,
external_surcharge_details,
applied_offer_details,
+ applied_overrides,
active_frm_id,
},
Self::VoidUpdate {
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index c3217a2a34..710397f47d 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3718,6 +3718,9 @@ impl ProfileCreateBridge for api::ProfileCreate {
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
is_manual_retry_enabled: self.is_manual_retry_enabled,
+ auto_fallback_capture_method: self
+ .auto_fallback_capture_method
+ .map(common_enums::AutoFallbackCaptureMethod::from),
always_enable_overcapture: self.always_enable_overcapture,
external_vault_details: domain::ExternalVaultDetails::try_from((
self.is_external_vault_enabled,
@@ -4305,6 +4308,9 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
is_manual_retry_enabled: self.is_manual_retry_enabled,
+ auto_fallback_capture_method: self
+ .auto_fallback_capture_method
+ .map(common_enums::AutoFallbackCaptureMethod::from),
always_enable_overcapture: self.always_enable_overcapture,
is_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self
diff --git a/crates/router/src/core/authentication.rs b/crates/router/src/core/authentication.rs
index 2b04f489d1..f088d0be88 100644
--- a/crates/router/src/core/authentication.rs
+++ b/crates/router/src/core/authentication.rs
@@ -642,7 +642,7 @@ pub async fn perform_pre_authentication_proxy<F: Clone>(
.get_amount_as_i64(),
minor_amount: payment_data.payment_attempt.get_total_amount(),
email: None,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
currency: payment_data.payment_intent.currency,
payment_method_type: payment_data.payment_attempt.payment_method_type,
router_return_url: payment_data.payment_intent.return_url.clone(),
@@ -886,7 +886,7 @@ async fn call_ucs_post_authenticate_proxy<F: Clone>(
minor_amount: Some(amount),
email: None,
currency: payment_data.payment_intent.currency,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
browser_info,
connector_transaction_id: authentication.threeds_server_transaction_id.clone(),
redirect_response: authentication
@@ -1342,7 +1342,7 @@ async fn call_ucs_authenticate_proxy(
complete_authorize_url: None,
browser_info: browser_info.clone(),
redirect_response: None,
- capture_method: payment_attempt.capture_method,
+ capture_method: payment_attempt.get_effective_capture_method(),
authentication_data: Some(ucs_authentication_data),
sdk_information: sdk_information.clone(),
device_channel: Some(device_channel.clone()),
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 9401e40fb7..a1e8e0a37b 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -4452,6 +4452,7 @@ pub async fn build_merchant_enabled_pms_context(
) -> errors::RouterResult<MerchantEnabledPmsContext> {
let db = &*state.store;
let pm_config_mapping = &state.conf.pm_filters;
+ let auto_fallback_capture_method = business_profile.auto_fallback_capture_method;
// --- Load all MCAs and filter by connector type ---
let profile_id = business_profile.get_id().clone();
@@ -4507,6 +4508,7 @@ pub async fn build_merchant_enabled_pms_context(
billing_address,
mca.connector_name.clone(),
&state.conf,
+ auto_fallback_capture_method,
)
.await?;
}
@@ -4560,6 +4562,7 @@ pub async fn build_merchant_enabled_pms_context(
billing_address,
mca.connector_name.clone(),
&state.conf,
+ auto_fallback_capture_method,
)
.await?;
}
@@ -5824,6 +5827,7 @@ pub async fn filter_payment_methods(
address: Option<&domain::Address>,
connector: String,
configs: &settings::Settings<RawSecret>,
+ auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
) -> errors::CustomResult<(), errors::ApiErrorResponse> {
for payment_method in payment_methods.iter() {
let parse_result = serde_json::from_value::<PaymentMethodsEnabled>(
@@ -5983,8 +5987,16 @@ pub async fn filter_payment_methods(
}
});
+ // With auto_fallback_capture_method enabled an unsupported capture method is
+ // replaced by automatic at confirm, so it must not hide payment methods here.
+ // A payment already requesting automatic capture has no fallback and is
+ // still filtered.
payment_attempt
.and_then(|inner| inner.capture_method)
+ .filter(|&capture_method| {
+ !auto_fallback_capture_method
+ .is_some_and(|setting| setting.can_fall_back_from(capture_method))
+ })
.map(|capture_method| {
context_values.push(dir::DirValue::CaptureMethod(capture_method));
});
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 8e33c990eb..f4edebde3e 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -744,6 +744,7 @@ async fn restore_pre_call_state<F, D>(
request_extended_authorization: attempt.request_extended_authorization,
external_surcharge_details: attempt.external_surcharge_details.clone(),
applied_offer_details: attempt.applied_offer_details.clone(),
+ applied_overrides: attempt.applied_overrides.clone(),
active_frm_id: attempt.active_frm_id.clone(),
};
@@ -1109,6 +1110,13 @@ where
)
.await?;
+ // Post-FRM keeps the payment authorised-only until the FRM decision, so the capture
+ // method must not fall back to automatic while this hold is in place.
+ #[cfg(feature = "frm")]
+ let post_frm_capture_hold = !should_continue_capture;
+ #[cfg(not(feature = "frm"))]
+ let post_frm_capture_hold = false;
+
if should_continue_transaction {
#[cfg(feature = "frm")]
match (
@@ -1181,6 +1189,7 @@ where
false,
None,
&feature_config,
+ post_frm_capture_hold,
))
.await?;
@@ -1386,6 +1395,7 @@ where
false,
routing_decision,
&feature_config,
+ post_frm_capture_hold,
))
.await?;
@@ -1491,6 +1501,7 @@ where
&business_profile,
&feature_config,
&dimensions,
+ post_frm_capture_hold,
)
.await?;
};
@@ -6314,6 +6325,96 @@ where
Ok((router_data, merchant_connector_account))
}
+#[cfg(feature = "v1")]
+/// Records the capture method this attempt is sent to the connector with, in
+/// `applied_overrides.capture_method_applied`.
+///
+/// That is the requested `capture_method`, except when the connector routing chose does not
+/// support it and the profile has `auto_fallback_capture_method` enabled: then `automatic` is
+/// used instead, provided the connector supports it. Support is decided by both the connector's
+/// capture validation and its declared `supported_capture_methods` for this payment method
+/// type. When it does not, the requested method is kept and connector validation rejects the
+/// payment as it does today. `capture_method` itself
+/// always keeps what the merchant requested, so a retry on another connector re-evaluates it.
+///
+/// No fallback while a post-FRM capture hold is in place (`post_frm_capture_hold`): the hold
+/// keeps the payment authorised-only until FRM decides whether to capture, so a connector that
+/// cannot hold must reject the payment rather than take the money first. The hold is passed in
+/// because `frm_message` is only populated after the connector call in the post-FRM flow.
+fn apply_auto_fallback_capture_method<F, D>(
+ payment_data: &mut D,
+ connector: &api::ConnectorData,
+ business_profile: &domain::Profile,
+ post_frm_capture_hold: bool,
+) where
+ F: Clone,
+ D: OperationSessionGetters<F> + OperationSessionSetters<F>,
+{
+ use crate::services::api::ConnectorValidation;
+
+ let is_enabled = business_profile
+ .auto_fallback_capture_method
+ .is_some_and(common_enums::AutoFallbackCaptureMethod::is_enabled);
+ let attempt = payment_data.get_payment_attempt();
+ let requested = attempt.capture_method.unwrap_or_default();
+ let fallback = common_enums::AutoFallbackCaptureMethod::FALLBACK;
+
+ let should_fall_back = is_enabled
+ && !post_frm_capture_hold
+ && requested != fallback
+ && attempt.payment_method.is_some_and(|payment_method| {
+ // Some connectors override `validate_connector_against_payment_request` with a check
+ // that ignores the payment method type, so their `supported_capture_methods`
+ // declaration is consulted too: a capture method counts as supported only when
+ // neither source rejects it.
+ let declared_capture_methods = connector
+ .connector
+ .get_supported_payment_methods()
+ .and_then(|supported| supported.get(&payment_method))
+ .zip(attempt.payment_method_type)
+ .and_then(|(by_type, payment_method_type)| by_type.get(&payment_method_type))
+ .map(|details| &details.supported_capture_methods);
+ let is_supported = |capture_method| {
+ declared_capture_methods.is_none_or(|declared| declared.contains(&capture_method))
+ && connector
+ .connector
+ .validate_connector_against_payment_request(
+ Some(capture_method),
+ payment_method,
+ attempt.payment_method_type,
+ )
+ .is_ok()
+ };
+ !is_supported(requested) && is_supported(fallback)
+ });
+
+ let applied = if should_fall_back {
+ logger::info!(
+ payment_id = ?attempt.payment_id,
+ connector = %connector.connector_name,
+ payment_method_type = ?attempt.payment_method_type,
+ %requested,
+ %fallback,
+ "capture method not supported by connector; falling back as auto_fallback_capture_method is enabled"
+ );
+ metrics::AUTO_FALLBACK_CAPTURE_METHOD_APPLIED.add(
+ 1,
+ router_env::metric_attributes!(
+ ("connector", connector.connector_name.to_string()),
+ ("requested", requested.to_string()),
+ ("applied", fallback.to_string()),
+ ),
+ );
+ fallback
+ } else {
+ requested
+ };
+
+ payment_data.set_applied_overrides_in_attempt(Some(common_types::payments::AppliedOverrides {
+ capture_method_applied: Some(applied),
+ }));
+}
+
#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
#[instrument(skip_all)]
@@ -6328,6 +6429,7 @@ pub async fn call_connector_service_prerequisites<F, RouterDReq, ApiRequest, D>(
should_retry_with_pan: bool,
routing_decision: Option<routing_helpers::RoutingDecisionData>,
feature_config: &core_utils::FeatureConfig,
+ post_frm_capture_hold: bool,
) -> RouterResult<(
helpers::MerchantConnectorAccountType,
RouterData<F, RouterDReq, router_types::PaymentsResponseData>,
@@ -6480,6 +6582,13 @@ where
)
.await?;
+ apply_auto_fallback_capture_method(
+ payment_data,
+ &connector,
+ business_profile,
+ post_frm_capture_hold,
+ );
+
let merchant_recipient_data = payment_data
.get_merchant_recipient_data(
state,
@@ -15445,6 +15554,11 @@ pub trait OperationSessionSetters<F> {
);
#[cfg(feature = "v1")]
fn set_capture_method_in_attempt(&mut self, capture_method: enums::CaptureMethod);
+ #[cfg(feature = "v1")]
+ fn set_applied_overrides_in_attempt(
+ &mut self,
+ applied_overrides: Option<common_types::payments::AppliedOverrides>,
+ );
fn set_frm_message(&mut self, frm_message: FraudCheck);
fn set_payment_intent_status(&mut self, status: storage_enums::IntentStatus);
fn set_authentication_type_in_attempt(
@@ -15651,7 +15765,7 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentData<F> {
#[cfg(feature = "v1")]
fn get_capture_method(&self) -> Option<enums::CaptureMethod> {
- self.payment_attempt.capture_method
+ self.payment_attempt.get_effective_capture_method()
}
#[cfg(feature = "v1")]
@@ -15798,6 +15912,14 @@ impl<F: Clone> OperationSessionSetters<F> for PaymentData<F> {
self.payment_attempt.capture_method = Some(capture_method);
}
+ #[cfg(feature = "v1")]
+ fn set_applied_overrides_in_attempt(
+ &mut self,
+ applied_overrides: Option<common_types::payments::AppliedOverrides>,
+ ) {
+ self.payment_attempt.applied_overrides = applied_overrides;
+ }
+
fn set_frm_message(&mut self, frm_message: FraudCheck) {
self.frm_message = Some(frm_message);
}
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index d9c18c4799..6d617ff23e 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -5858,6 +5858,7 @@ impl AttemptType {
installment_data: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
sender_payment_instrument_id: None,
payment_account_reference: None,
active_frm_id: None,
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index d4969907cd..f3a1692f31 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -93,7 +93,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
.update_value(request.amount_to_capture);
let capture_method = payment_attempt
- .capture_method
+ .get_effective_capture_method()
.get_required_value("capture_method")?;
helpers::validate_status_with_capture_method(payment_intent.status, capture_method)?;
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index ec92cdff32..7ba0b135dd 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -2984,6 +2984,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.payment_attempt
.applied_offer_details
.clone(),
+ applied_overrides: payment_data.payment_attempt.applied_overrides.clone(),
active_frm_id: m_active_frm_id,
},
storage_scheme,
diff --git a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
index 3e1cca0c9f..f3c27c579d 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
@@ -628,6 +628,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsRequest>
.payment_attempt
.applied_offer_details
.clone(),
+ applied_overrides: payment_data.payment_attempt.applied_overrides.clone(),
active_frm_id: payment_data
.frm_message
.as_ref()
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index f624544a49..539865fca6 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1725,6 +1725,7 @@ impl PaymentCreate {
installment_data: None,
external_surcharge_details: None,
applied_offer_details: None,
+ applied_overrides: None,
sender_payment_instrument_id: None,
payment_account_reference: None,
active_frm_id: None,
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index f571758e19..0dce1ecf47 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -60,6 +60,7 @@ pub async fn do_gsm_actions<'a, F, ApiRequest, FData, D>(
business_profile: &domain::Profile,
feature_config: &core_utils::FeatureConfig,
_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ post_frm_capture_hold: bool,
) -> RouterResult<(
types::RouterData<F, FData, types::PaymentsResponseData>,
Option<domain::Customer>,
@@ -137,6 +138,7 @@ where
None,
initial_gsm.clone(),
feature_config,
+ post_frm_capture_hold,
))
.await?;
@@ -247,6 +249,7 @@ where
routing_decision,
gsm.clone(),
feature_config,
+ post_frm_capture_hold,
))
.await?;
@@ -410,6 +413,7 @@ pub async fn do_retry<'a, F, ApiRequest, FData, D>(
routing_decision: Option<routing_helpers::RoutingDecisionData>,
initial_gsm: Option<hyperswitch_domain_models::gsm::GatewayStatusMap>,
feature_config: &core_utils::FeatureConfig,
+ post_frm_capture_hold: bool,
) -> RouterResult<(
types::RouterData<F, FData, types::PaymentsResponseData>,
Option<domain::Customer>,
@@ -457,6 +461,7 @@ where
should_retry_with_pan,
routing_decision,
feature_config,
+ post_frm_capture_hold,
))
.await?;
@@ -920,6 +925,8 @@ pub fn make_new_auto_retry_payment_attempt(
external_surcharge_details: Default::default(),
// Carry the offer forward so the auto-retry keeps the same offer-reduced amount.
applied_offer_details: old_payment_attempt.applied_offer_details,
+ // Recomputed for the connector this retry is routed to.
+ applied_overrides: None,
sender_payment_instrument_id: Default::default(),
payment_account_reference: Default::default(),
active_frm_id: old_payment_attempt.active_frm_id,
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index e016f8d6a0..b7d7244be2 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -1088,6 +1088,7 @@ impl RoutingStage for SessionRoutingStage {
profile_id,
input.transaction_type,
input.active_mca_ids,
+ input.business_profile.get_auto_fallback_capture_method(),
)
.await?;
@@ -1101,6 +1102,7 @@ impl RoutingStage for SessionRoutingStage {
profile_id,
input.transaction_type,
input.active_mca_ids,
+ input.business_profile.get_auto_fallback_capture_method(),
)
.await?
} else {
@@ -2468,7 +2470,21 @@ pub async fn perform_cgraph_filtering(
profile_id: &common_utils::id_type::ProfileId,
transaction_type: &api_enums::TransactionType,
active_mca_ids: &std::collections::HashSet<common_utils::id_type::MerchantConnectorAccountId>,
+ auto_fallback_capture_method: Option<common_enums::AutoFallbackCaptureMethod>,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
+ let mut backend_input = backend_input;
+ let can_fall_back = backend_input
+ .payment
+ .capture_method
+ .zip(auto_fallback_capture_method)
+ .is_some_and(|(capture_method, setting)| setting.can_fall_back_from(capture_method));
+ if can_fall_back {
+ // The profile falls back to automatic capture for connectors that cannot do the
+ // requested capture method, so `pm_filters` capture-method restrictions must not remove
+ // those connectors here; `apply_auto_fallback_capture_method` decides per connector.
+ // A payment already requesting automatic capture has no fallback and is still filtered.
+ backend_input.payment.capture_method = None;
+ }
let context = euclid_graph::AnalysisContext::from_dir_values(
backend_input
.into_context()
@@ -2614,8 +2630,8 @@ pub async fn perform_eligibility_analysis(
chosen: Vec<routing_types::RoutableConnectorChoice>,
transaction_data: &routing::TransactionData<'_>,
eligible_connectors: Option<&Vec<api_enums::RoutableConnectors>>,
- profile_id: &common_utils::id_type::ProfileId,
active_mca_ids: &std::collections::HashSet<common_utils::id_type::MerchantConnectorAccountId>,
+ business_profile: &domain::Profile,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
let backend_input = match transaction_data {
routing::TransactionData::Payment(payment_data) => make_dsl_input(payment_data)?,
@@ -2629,9 +2645,10 @@ pub async fn perform_eligibility_analysis(
chosen,
backend_input,
eligible_connectors,
- profile_id,
+ business_profile.get_id(),
&api_enums::TransactionType::from(transaction_data),
active_mca_ids,
+ business_profile.get_auto_fallback_capture_method(),
)
.await
}
@@ -2701,6 +2718,7 @@ pub async fn perform_fallback_routing(
business_profile.get_id(),
&api_enums::TransactionType::from(transaction_data),
active_mca_ids,
+ business_profile.get_auto_fallback_capture_method(),
)
.await
}
@@ -2754,8 +2772,8 @@ pub async fn perform_eligibility_analysis_with_fallback(
chosen,
transaction_data,
eligible_connectors.as_ref(),
- business_profile.get_id(),
&active_mca_ids,
+ business_profile,
)
.await?;
@@ -3254,6 +3272,7 @@ async fn perform_session_routing_for_pm_type(
session_pm_input.profile_id,
transaction_type,
active_mca_ids,
+ business_profile.get_auto_fallback_capture_method(),
)
.await?;
@@ -3275,6 +3294,7 @@ async fn perform_session_routing_for_pm_type(
session_pm_input.profile_id,
transaction_type,
active_mca_ids,
+ business_profile.get_auto_fallback_capture_method(),
)
.await?;
}
@@ -3354,6 +3374,7 @@ async fn perform_session_routing_for_pm_type<'a>(
session_pm_input.profile_id,
transaction_type,
active_mca_ids,
+ business_profile.get_auto_fallback_capture_method(),
)
.await?;
@@ -3371,6 +3392,7 @@ async fn perform_session_routing_for_pm_type<'a>(
session_pm_input.profile_id,
transaction_type,
active_mca_ids,
+ business_profile.get_auto_fallback_capture_method(),
)
.await?;
}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 5d90dadfdc..6f012922c6 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -893,7 +893,7 @@ pub async fn construct_external_vault_proxy_payment_router_data_v1<'a>(
confirm: true,
statement_descriptor_suffix: None,
statement_descriptor: None,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
amount: amount.get_amount_as_i64(),
minor_amount: amount,
order_tax_amount: payment_data
@@ -4402,6 +4402,10 @@ where
off_session: payment_intent.off_session,
capture_on: None,
capture_method: payment_attempt.capture_method,
+ capture_method_applied: payment_attempt
+ .applied_overrides
+ .as_ref()
+ .and_then(|overrides| overrides.capture_method_applied),
payment_method: payment_attempt.payment_method,
payment_method_data: payment_method_data_response,
payment_token: payment_attempt.payment_token,
@@ -4803,6 +4807,10 @@ fn applied_offer_response(
impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::PaymentsResponse {
fn foreign_from((pi, pa): (storage::PaymentIntent, storage::PaymentAttempt)) -> Self {
let connector_transaction_id = pa.get_connector_payment_id().map(ToString::to_string);
+ let capture_method_applied = pa
+ .applied_overrides
+ .as_ref()
+ .and_then(|overrides| overrides.capture_method_applied);
// Build `payment_method_data` by first parsing the stored column as
// `AdditionalPaymentData` and then converting via `PaymentMethodDataResponse::from`
let payment_method_data = pa
@@ -4884,6 +4892,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
business_sub_label: pa.business_sub_label,
setup_future_usage: pa.setup_future_usage_applied.or(pi.setup_future_usage),
capture_method: pa.capture_method,
+ capture_method_applied,
authentication_type: pa.authentication_type,
connector_transaction_id,
attempt_count: pi.attempt_count,
@@ -5618,7 +5627,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
off_session: is_off_session,
setup_mandate_details: payment_data.setup_mandate.clone(),
confirm: payment_data.payment_attempt.confirm,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
amount: amount.get_amount_as_i64(),
order_tax_amount: payment_data
.payment_attempt
@@ -6133,7 +6142,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsCancelDa
&attempt.processor_merchant_id,
merchant_connector_account_id,
));
- let capture_method = payment_data.payment_attempt.capture_method;
+ let capture_method = payment_data.payment_attempt.get_effective_capture_method();
Ok(Self {
amount: Some(amount.get_amount_as_i64()), // This should be removed once we start moving to connector module
minor_amount: Some(amount),
@@ -6364,7 +6373,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsPostSess
order_amount: payment_data.payment_intent.amount,
currency: payment_data.currency,
merchant_order_reference_id,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
shipping_cost: payment_data.payment_intent.shipping_cost,
setup_future_usage: payment_data
.payment_attempt
@@ -7066,7 +7075,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionD
payment_method: payment_data.payment_attempt.payment_method,
payment_method_type: payment_data.payment_attempt.payment_method_type,
split_payments: payment_data.payment_intent.split_payments,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
})
}
}
@@ -7303,7 +7312,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
shipping_cost: payment_data.payment_intent.shipping_cost,
webhook_url,
complete_authorize_url,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
connector_testing_data,
customer_id: payment_data.payment_intent.customer_id,
enable_partial_authorization: payment_data.payment_intent.enable_partial_authorization,
@@ -7525,7 +7534,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
setup_mandate_details: payment_data.setup_mandate.clone(),
confirm: payment_data.payment_attempt.confirm,
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
- capture_method: payment_data.payment_attempt.capture_method,
+ capture_method: payment_data.payment_attempt.get_effective_capture_method(),
amount: amount.get_amount_as_i64(), // need to change once we move to connector module
minor_amount: amount,
currency: payment_data.currency,
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index f825327ed4..4c3b2b7b1b 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -656,7 +656,7 @@ pub async fn construct_refund_router_data<'a, F>(
})?;
let connector_refund_id = refund.get_optional_connector_refund_id().cloned();
- let capture_method = payment_attempt.capture_method;
+ let capture_method = payment_attempt.get_effective_capture_method();
let braintree_metadata = payment_intent
.connector_metadata
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index 830ecb0f22..d7b370a95a 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -2088,6 +2088,7 @@ mod tests {
merchant_category_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
external_vault_details: domain::ExternalVaultDetails::Skip,
billing_processor_id: None,
@@ -2144,6 +2145,7 @@ mod tests {
off_session: None,
capture_on: None,
capture_method: None,
+ capture_method_applied: None,
payment_method: None,
payment_method_data: None,
payment_token: None,
diff --git a/crates/router/src/routes/metrics.rs b/crates/router/src/routes/metrics.rs
index 3348b380d7..7f9876be44 100644
--- a/crates/router/src/routes/metrics.rs
+++ b/crates/router/src/routes/metrics.rs
@@ -137,6 +137,9 @@ counter_metric!(PAYMENT_CANCEL_COUNT, GLOBAL_METER);
counter_metric!(SUCCESSFUL_CANCEL, GLOBAL_METER);
counter_metric!(PAYMENT_EXTEND_AUTHORIZATION_COUNT, GLOBAL_METER);
+// Number of attempts sent to the connector with automatic capture
+// because the requested capture method was unsupported.
+counter_metric!(AUTO_FALLBACK_CAPTURE_METHOD_APPLIED, GLOBAL_METER);
counter_metric!(SUCCESSFUL_EXTEND_AUTHORIZATION_COUNT, GLOBAL_METER);
counter_metric!(MANDATE_COUNT, GLOBAL_METER);
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index e271b63608..db702656e7 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -281,6 +281,9 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
merchant_country_code: item.merchant_country_code,
dispute_polling_interval: item.dispute_polling_interval,
is_manual_retry_enabled: item.is_manual_retry_enabled,
+ auto_fallback_capture_method: item
+ .auto_fallback_capture_method
+ .map(common_enums::AutoFallbackCaptureMethod::is_enabled),
always_enable_overcapture: item.always_enable_overcapture,
is_external_vault_enabled,
external_vault_connector_details: external_vault_connector_details
@@ -557,6 +560,9 @@ pub async fn create_profile_from_merchant_account(
merchant_country_code: request.merchant_country_code,
dispute_polling_interval: request.dispute_polling_interval,
is_manual_retry_enabled: request.is_manual_retry_enabled,
+ auto_fallback_capture_method: request
+ .auto_fallback_capture_method
+ .map(common_enums::AutoFallbackCaptureMethod::from),
always_enable_overcapture: request.always_enable_overcapture,
external_vault_details: domain::ExternalVaultDetails::try_from((
request.is_external_vault_enabled,
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 82e065099c..a290dc02c7 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -180,6 +180,7 @@ mod tests {
error_message: Default::default(),
offer_amount: Default::default(),
applied_offer_details: Default::default(),
+ applied_overrides: Default::default(),
payment_method_id: Default::default(),
payment_method: Default::default(),
capture_method: Default::default(),
@@ -308,6 +309,7 @@ mod tests {
error_message: Default::default(),
offer_amount: Default::default(),
applied_offer_details: Default::default(),
+ applied_overrides: Default::default(),
payment_method_id: Default::default(),
payment_method: Default::default(),
capture_method: Default::default(),
@@ -451,6 +453,7 @@ mod tests {
error_message: Default::default(),
offer_amount: Default::default(),
applied_offer_details: Default::default(),
+ applied_overrides: Default::default(),
payment_method_id: Default::default(),
payment_method: Default::default(),
capture_method: Default::default(),
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 56cc57e00c..bb98e9bb6a 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -406,6 +406,7 @@ async fn payments_create_core() {
off_session: None,
capture_on: None,
capture_method: None,
+ capture_method_applied: None,
payment_method: None,
payment_method_data: None,
payment_token: None,
@@ -723,6 +724,7 @@ async fn payments_create_core_adyen_no_redirect() {
off_session: None,
capture_on: None,
capture_method: None,
+ capture_method_applied: None,
payment_method: None,
payment_method_data: None,
payment_token: None,
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index d741d69aa4..4cd81059a7 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -166,6 +166,7 @@ async fn payments_create_core() {
off_session: None,
capture_on: None,
capture_method: None,
+ capture_method_applied: None,
payment_method: None,
payment_method_data: None,
payment_token: None,
@@ -492,6 +493,7 @@ async fn payments_create_core_adyen_no_redirect() {
off_session: None,
capture_on: None,
capture_method: None,
+ capture_method_applied: None,
payment_method: None,
payment_method_data: None,
payment_token: None,
diff --git a/crates/storage_impl/src/business_profile.rs b/crates/storage_impl/src/business_profile.rs
index 502b33e7b0..0d4545324a 100644
--- a/crates/storage_impl/src/business_profile.rs
+++ b/crates/storage_impl/src/business_profile.rs
@@ -649,6 +649,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
dispute_polling_interval,
always_request_extended_authorization,
is_manual_retry_enabled,
+ auto_fallback_capture_method,
always_enable_overcapture,
is_external_vault_enabled,
external_vault_connector_details,
@@ -720,6 +721,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code,
dispute_polling_interval,
is_manual_retry_enabled,
+ auto_fallback_capture_method,
always_enable_overcapture,
is_external_vault_enabled,
external_vault_connector_details,
@@ -789,6 +791,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -855,6 +858,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -921,6 +925,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -987,6 +992,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -1054,6 +1060,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -1121,6 +1128,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -1188,6 +1196,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -1254,6 +1263,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -1321,6 +1331,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {
merchant_country_code: None,
dispute_polling_interval: None,
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
always_enable_overcapture: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
@@ -1413,6 +1424,7 @@ impl Conversion for domain::Profile {
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
is_manual_retry_enabled: self.is_manual_retry_enabled,
+ auto_fallback_capture_method: self.auto_fallback_capture_method,
always_enable_overcapture: self.always_enable_overcapture,
is_external_vault_enabled,
external_vault_connector_details,
@@ -1588,6 +1600,7 @@ impl Conversion for domain::Profile {
merchant_country_code: item.merchant_country_code,
dispute_polling_interval: item.dispute_polling_interval,
is_manual_retry_enabled: item.is_manual_retry_enabled,
+ auto_fallback_capture_method: item.auto_fallback_capture_method,
always_enable_overcapture: item.always_enable_overcapture,
external_vault_details,
billing_processor_id: item.billing_processor_id,
@@ -1665,6 +1678,7 @@ impl Conversion for domain::Profile {
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: self.dispute_polling_interval,
is_manual_retry_enabled: self.is_manual_retry_enabled,
+ auto_fallback_capture_method: self.auto_fallback_capture_method,
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id: self.billing_processor_id,
@@ -2469,6 +2483,7 @@ impl Conversion for domain::Profile {
dispute_polling_interval: None,
split_txns_enabled: Some(self.split_txns_enabled),
is_manual_retry_enabled: None,
+ auto_fallback_capture_method: None,
is_l2_l3_enabled: None,
always_enable_overcapture: None,
billing_processor_id: self.billing_processor_id,
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index e6b960edc4..6c4797a9db 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -256,6 +256,7 @@ impl PaymentAttemptInterface for MockDb {
installment_data: payment_attempt.installment_data,
external_surcharge_details: payment_attempt.external_surcharge_details,
applied_offer_details: payment_attempt.applied_offer_details,
+ applied_overrides: payment_attempt.applied_overrides,
sender_payment_instrument_id: payment_attempt.sender_payment_instrument_id,
payment_account_reference: payment_attempt.payment_account_reference,
active_frm_id: payment_attempt.active_frm_id,
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index e163ad39fe..2d4c98a754 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -821,6 +821,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
installment_data: payment_attempt.installment_data.clone(),
external_surcharge_details: payment_attempt.external_surcharge_details.clone(),
applied_offer_details: payment_attempt.applied_offer_details.clone(),
+ applied_overrides: payment_attempt.applied_overrides.clone(),
sender_payment_instrument_id: payment_attempt
.sender_payment_instrument_id
.clone(),
@@ -2215,6 +2216,7 @@ impl Conversion for PaymentAttempt {
retry_type: self.retry_type,
external_surcharge_details: self.external_surcharge_details,
applied_offer_details: self.applied_offer_details,
+ applied_overrides: self.applied_overrides,
payment_account_reference: self.payment_account_reference,
sender_payment_instrument_id: self.sender_payment_instrument_id,
active_frm_id: self.active_frm_id,
@@ -2361,6 +2363,7 @@ impl Conversion for PaymentAttempt {
installment_data: storage_model.installment_data,
external_surcharge_details: storage_model.external_surcharge_details,
applied_offer_details: storage_model.applied_offer_details,
+ applied_overrides: storage_model.applied_overrides,
payment_account_reference: storage_model.payment_account_reference,
sender_payment_instrument_id: storage_model.sender_payment_instrument_id,
active_frm_id: storage_model.active_frm_id,
@@ -2463,6 +2466,7 @@ impl Conversion for PaymentAttempt {
installment_data: self.installment_data,
external_surcharge_details: self.external_surcharge_details,
applied_offer_details: self.applied_offer_details,
+ applied_overrides: self.applied_overrides,
payment_account_reference: self.payment_account_reference,
sender_payment_instrument_id: self.sender_payment_instrument_id,
active_frm_id: self.active_frm_id,
@@ -2652,6 +2656,7 @@ impl Conversion for PaymentAttempt {
installment_data: None,
external_surcharge_details: None,
applied_offer_details,
+ applied_overrides: None,
fingerprint_type: None,
sender_payment_instrument_id: None,
payment_account_reference,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 06364966d3..cf38f3d995 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -438,7 +438,7 @@ przelewy24 = { country = "PL", currency = "PLN,EUR" }
klarna = { country = "DE,AT,NL,BE,FR,GB,IT,ES,PT,SE,DK,FI,NO,CH,IR,CZ,PL,GR,SK", currency = "EUR,GBP,DKK,SEK,NOK,CHF,PLN,CZK" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,M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,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.globepay]
ali_pay = { country = "GB", currency = "GBP,CNY" }
diff --git a/migrations/2026-09-24-100000_add_auto_fallback_capture_method_to_business_profile/down.sql b/migrations/2026-09-24-100000_add_auto_fallback_capture_method_to_business_profile/down.sql
new file mode 100644
index 0000000000..184b4b5091
--- /dev/null
+++ b/migrations/2026-09-24-100000_add_auto_fallback_capture_method_to_business_profile/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile
+DROP COLUMN IF EXISTS auto_fallback_capture_method;
diff --git a/migrations/2026-09-24-100000_add_auto_fallback_capture_method_to_business_profile/up.sql b/migrations/2026-09-24-100000_add_auto_fallback_capture_method_to_business_profile/up.sql
new file mode 100644
index 0000000000..1f2e43252e
--- /dev/null
+++ b/migrations/2026-09-24-100000_add_auto_fallback_capture_method_to_business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS auto_fallback_capture_method VARCHAR(16);
diff --git a/migrations/2026-09-24-100001_add_applied_overrides_to_payment_attempt/down.sql b/migrations/2026-09-24-100001_add_applied_overrides_to_payment_attempt/down.sql
new file mode 100644
index 0000000000..ebb620a81a
--- /dev/null
+++ b/migrations/2026-09-24-100001_add_applied_overrides_to_payment_attempt/down.sql
@@ -0,0 +1,2 @@
+-- Remove applied_overrides from payment_attempt table
+ALTER TABLE payment_attempt DROP COLUMN IF EXISTS applied_overrides;
diff --git a/migrations/2026-09-24-100001_add_applied_overrides_to_payment_attempt/up.sql b/migrations/2026-09-24-100001_add_applied_overrides_to_payment_attempt/up.sql
new file mode 100644
index 0000000000..ab9b684843
--- /dev/null
+++ b/migrations/2026-09-24-100001_add_applied_overrides_to_payment_attempt/up.sql
@@ -0,0 +1,2 @@
+-- Add applied_overrides to payment_attempt table
+ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS applied_overrides JSONB;