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

fix(connector): [STRIPE] Throwing Missing Required Field Error if connector_customer is not present (#8309)

Sayak Bhattacharyac3a7f5c43db4
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index bb4db42255..d43ddadc54 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -9482,6 +9482,7 @@
"customer_id",
"payment_method_type",
"payment_method_subtype",
+ "recurring_enabled",
"created",
"requires_cvv",
"last_used_at",
@@ -9513,9 +9514,8 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method supports recurring payments. Optional.",
- "example": true,
- "nullable": true
+ "description": "Indicates whether the payment method is eligible for recurring payments",
+ "example": true
},
"payment_method_data": {
"allOf": [
@@ -17142,7 +17142,6 @@
"customer_id",
"payment_method_type",
"payment_method_subtype",
- "recurring_enabled",
"created",
"requires_cvv",
"is_default",
@@ -17169,8 +17168,9 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for recurring payments",
- "example": true
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
+ "example": true,
+ "nullable": true
},
"payment_method_data": {
"allOf": [
diff --git a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
index 0436715efb..ba18f61063 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
@@ -1971,12 +1971,6 @@ impl TryFrom<(&PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntentRequest
(None, None) => None,
};
- let customer_id = item.connector_customer.clone().ok_or_else(|| {
- ConnectorError::MissingRequiredField {
- field_name: "connector_customer",
- }
- })?;
-
Ok(Self {
amount, //hopefully we don't loose some cents here
currency: item.request.currency.to_string(), //we need to copy the value and not transfer ownership
@@ -1996,7 +1990,7 @@ impl TryFrom<(&PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntentRequest
payment_data,
payment_method_options,
payment_method: pm,
- customer: Some(Secret::new(customer_id)),
+ customer: item.connector_customer.clone().map(Secret::new),
setup_mandate_details,
off_session: item.request.off_session,
setup_future_usage: match (