Skip to content

Conversation

@pixincreate
Copy link
Member

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

eci_indicator should be optional since transactions done from cards like mastercard do not send them.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

this is a bug fix. when transaction done from a mastercard, we do not get eci_indicator. since we treat it as a mandatory, it results in 5xx and hence this pr

How did you test it?

payment create
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_p4KwZyWhyuLslln1ZDZtsiCdaZZPGteBmDjti3ML09sRhl8w9RuJvw5m9fEZRVbl' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": false,
    "business_country": "US",
    "business_label": "default",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
{
	"payment_id": "pay_l9VGqZyhLBoDv5QIqUAh",
	"merchant_id": "postman_merchant_GHAction_1759125682",
	"status": "requires_payment_method",
	"amount": 1000,
	"net_amount": 1000,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": null,
	"connector": null,
	"client_secret": "pay_l9VGqZyhLBoDv5QIqUAh_secret_S7NICANrsyU1MMmPOwxw",
	"created": "2025-09-29T06:13:54.321Z",
	"currency": "USD",
	"customer_id": "StripeCustomer",
	"customer": {
		"id": "StripeCustomer",
		"name": "John Doe",
		"email": "[email protected]",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": null,
	"payment_method_data": null,
	"payment_token": null,
	"shipping": null,
	"billing": null,
	"order_details": null,
	"email": "[email protected]",
	"name": "John Doe",
	"phone": "999999999",
	"return_url": "https://duck.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "joseph",
	"statement_descriptor_suffix": "JS",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": null,
	"connector_label": null,
	"business_country": "US",
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "StripeCustomer",
		"created_at": 1759126434,
		"expires": 1759130034,
		"secret": "epk_0068b218153a4786bbbca8294cf9ca88"
	},
	"manual_retry_allowed": null,
	"connector_transaction_id": null,
	"frm_message": null,
	"metadata": {
		"udf1": "value1",
		"login_date": "2019-09-10T10:11:12Z",
		"new_customer": "true"
	},
	"connector_metadata": null,
	"feature_metadata": null,
	"reference_id": null,
	"payment_link": null,
	"profile_id": "pro_31U1aVcxPji356abB9Oz",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": null,
	"incremental_authorization_allowed": null,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-09-29T06:28:54.321Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": null,
	"network_transaction_id": null,
	"payment_method_status": null,
	"updated": "2025-09-29T06:13:54.336Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"request_extended_authorization": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": null,
	"card_discovery": null,
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null,
	"enable_overcapture": null,
	"is_overcapture_enabled": null,
	"network_details": null
}
session call
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_c93332bf30c64ad59e0af14f1f83c2e5' \
--data '{
    "payment_id": "pay_l9VGqZyhLBoDv5QIqUAh",
    "wallets": [],
    "client_secret": "pay_l9VGqZyhLBoDv5QIqUAh_secret_S7NICANrsyU1MMmPOwxw"
}'
{
	"payment_id": "pay_l9VGqZyhLBoDv5QIqUAh",
	"client_secret": "pay_l9VGqZyhLBoDv5QIqUAh_secret_S7NICANrsyU1MMmPOwxw",
	"session_token": [
		{
			"wallet_name": "apple_pay",
			"session_token_data": {
				"epoch_timestamp": 1759126436460,
				"expires_at": 1759130036460,
				"merchant_session_identifier": "SS..C3",
				"nonce": "e6c4ab10",
				"merchant_identifier": "8C..C4",
				"domain_name": "hyperswitch.app",
				"display_name": "apple pay",
				"signature": "30..00",
				"operational_analytics_identifier": "apple pay:8C..C4",
				"retries": 0,
				"psp_id": "8C..C4"
			},
			"payment_request_data": {
				"country_code": "US",
				"currency_code": "USD",
				"total": {
					"label": "applepay",
					"type": "final",
					"amount": "10.00"
				},
				"merchant_capabilities": [
					"supports3DS"
				],
				"supported_networks": [
					"visa",
					"masterCard",
					"amex",
					"discover"
				],
				"merchant_identifier": "merchant.lol"
			},
			"connector": "paysafe",
			"delayed_session_token": false,
			"sdk_next_action": {
				"next_action": "confirm"
			},
			"connector_reference_id": null,
			"connector_sdk_public_key": null,
			"connector_merchant_id": null
		}
	]
}
payment confirm
curl --location 'http://localhost:8080/payments/pay_l9VGqZyhLBoDv5QIqUAh/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_p4KwZyWhyuLslln1ZDZtsiCdaZZPGteBmDjti3ML09sRhl8w9RuJvw5m9fEZRVbl' \
--data '{
	"confirm": true,
	"payment_method": "wallet",
	"payment_method_type": "apple_pay",
	"payment_method_data": {
		"wallet": {
			"apple_pay": {
				"payment_data": {
					"application_primary_account_number": "5204245253050839",
					"application_expiration_month": "01",
					"application_expiration_year": "30",
					"payment_data": {
						"online_payment_cryptogram": "A..A=",
						"eci_indicator": "1"
					}
				},
			"payment_method": {
					"display_name": "Visa 4228",
					
					"network": "Mastercard",
					"type": "debit"
				},
				"transaction_identifier": "a0..4a"
			}
		},
		"billing": null
	},
	"browser_info": {
		"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"language": "nl-NL",
		"color_depth": 24,
		"screen_height": 723,
		"screen_width": 1536,
		"time_zone": 0,
		"java_enabled": true,
		"java_script_enabled": true,
		"ip_address": "127.0.0.1"
	},
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "John",
			"last_name": "Doe"
		}
	},
	"shipping": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "John",
			"last_name": "Doe"
		}
	}
}'
{
	"payment_id": "pay_l9VGqZyhLBoDv5QIqUAh",
	"merchant_id": "postman_merchant_GHAction_1759125682",
	"status": "succeeded",
	"amount": 1000,
	"net_amount": 1000,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 1000,
	"connector": "paysafe",
	"client_secret": "pay_l9VGqZyhLBoDv5QIqUAh_secret_S7NICANrsyU1MMmPOwxw",
	"created": "2025-09-29T06:13:54.321Z",
	"currency": "USD",
	"customer_id": "StripeCustomer",
	"customer": {
		"id": "StripeCustomer",
		"name": "John Doe",
		"email": "[email protected]",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "wallet",
	"payment_method_data": {
		"wallet": {
			"apple_pay": {
				"last4": "4228",
				"card_network": "Mastercard",
				"type": "debit"
			}
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "John",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "John",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"order_details": null,
	"email": "[email protected]",
	"name": "John Doe",
	"phone": "999999999",
	"return_url": "https://duck.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "joseph",
	"statement_descriptor_suffix": "JS",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "apple_pay",
	"connector_label": "paysafe_US_default",
	"business_country": "US",
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": null,
	"manual_retry_allowed": null,
	"connector_transaction_id": "84eab9d5-25bc-48a8-8672-c9775491787c",
	"frm_message": null,
	"metadata": {
		"udf1": "value1",
		"login_date": "2019-09-10T10:11:12Z",
		"new_customer": "true"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": null,
	"payment_link": null,
	"profile_id": "pro_31U1aVcxPji356abB9Oz",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_elKlZ2pGPWPAiySGe825",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-09-29T06:28:54.321Z",
	"fingerprint": null,
	"browser_info": {
		"os_type": null,
		"referer": null,
		"language": "nl-NL",
		"time_zone": 0,
		"ip_address": "127.0.0.1",
		"os_version": null,
		"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
		"color_depth": 24,
		"device_model": null,
		"java_enabled": true,
		"screen_width": 1536,
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"screen_height": 723,
		"accept_language": "en",
		"java_script_enabled": true
	},
	"payment_channel": null,
	"payment_method_id": null,
	"network_transaction_id": null,
	"payment_method_status": null,
	"updated": "2025-09-29T06:13:59.443Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"request_extended_authorization": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": null,
	"card_discovery": null,
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null,
	"enable_overcapture": null,
	"is_overcapture_enabled": null,
	"network_details": null
}
logs image image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by just clippy && just clippy_v2
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@pixincreate pixincreate added this to the July 2025 Release milestone Sep 29, 2025
@pixincreate pixincreate self-assigned this Sep 29, 2025
@pixincreate pixincreate requested a review from a team as a code owner September 29, 2025 06:20
@pixincreate pixincreate added A-connector-integration Area: Connector integration C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Sep 29, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Sep 29, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs  73% smaller

@likhinbopanna likhinbopanna added this pull request to the merge queue Sep 30, 2025
Merged via the queue into main with commit f6716f6 Sep 30, 2025
21 of 25 checks passed