hyperswitch
hyperswitch copied to clipboard
feat(connector): [DataTrans] ADD 3DS and Incremental Auth
Type of Change
- [ ] Bugfix
- [x] New feature
- [] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Added 3DS and IncrementalAuth
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [x] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
Three 3ds
**Request**
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_iClV9gEjhQBYt3sTzwjloL1IGSd6VpSC2JR0BBJ9gbrFEo6eHkfD5SSJudjoHlzq' \
--data-raw '{
"amount": 1500,
"currency": "USD",
"amount_to_capture": 1500,
"confirm": true,
"capture_method": "automatic",
"authentication_type": "three_ds",
"payment_method": "card",
"payment_method_type": "credit",
"email": "[email protected]",
"payment_method_data": {
"card": {
"card_number": "4111111111111111",
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "Zurich",
"state": "asd",
"zip": "8008",
"country": "CH",
"first_name": "joseph",
"last_name": "Doe"
}
}
}'
**Response:**
{
"payment_id": "pay_vHjy5fKzjHZxKtxI098X",
"merchant_id": "postman_merchant_GHAction_89a6aa6f-012b-407e-9a8c-34ca16816f21",
"status": "requires_customer_action",
"amount": 1500,
"net_amount": 1500,
"amount_capturable": 1500,
"amount_received": null,
"connector": "datatrans",
"client_secret": "pay_vHjy5fKzjHZxKtxI098X_secret_u75qIY4GA4cpgHEVxe9J",
"created": "2024-09-25T11:27:14.567Z",
"currency": "USD",
"customer_id": null,
"customer": {
"id": null,
"name": null,
"email": "[email protected]",
"phone": null,
"phone_country_code": null
},
"description": null,
"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": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "Zurich",
"country": "CH",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "8008",
"state": "asd",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_vHjy5fKzjHZxKtxI098X/postman_merchant_GHAction_89a6aa6f-012b-407e-9a8c-34ca16816f21/pay_vHjy5fKzjHZxKtxI098X_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": "240925132715468655",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_42yrBwduYyd6qykBOXCS",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_KFw9ms4pVBoP3ovswSEu",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-09-25T11:42:14.567Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2024-09-25T11:27:15.520Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
**Redirect Response :**
{
"payment_id": "pay_vHjy5fKzjHZxKtxI098X",
"merchant_id": "postman_merchant_GHAction_89a6aa6f-012b-407e-9a8c-34ca16816f21",
"status": "succeeded",
"amount": 1500,
"net_amount": 1500,
"amount_capturable": 0,
"amount_received": 1500,
"connector": "datatrans",
"client_secret": "pay_vHjy5fKzjHZxKtxI098X_secret_u75qIY4GA4cpgHEVxe9J",
"created": "2024-09-25T11:27:14.567Z",
"currency": "USD",
"customer_id": null,
"customer": {
"id": null,
"name": null,
"email": "[email protected]",
"phone": null,
"phone_country_code": null
},
"description": null,
"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": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "Zurich",
"country": "CH",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "8008",
"state": "asd",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "240925132715468655",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_42yrBwduYyd6qykBOXCS",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_KFw9ms4pVBoP3ovswSEu",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-09-25T11:42:14.567Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2024-09-25T11:28:51.196Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
Incremental Auth Request
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data-raw '{
"amount": 1000,
"currency": "GBP",
"amount_to_capture": 1000,
"confirm": true,
"capture_method": "manual",
"authentication_type": "no_three_ds",
"payment_method": "card",
"payment_method_type": "credit",
"request_incremental_authorization":true,
"email": "[email protected]",
"payment_method_data": {
"card": {
"card_number": "5404000000000001",
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "Zurich",
"state": "asd",
"zip": "8008",
"country": "CH",
"first_name": "joseph",
"last_name": "Doe"
}
}
}'
Response
{
"payment_id": "pay_CRIGcbIdUUt63W9T6AdC",
"merchant_id": "postman_merchant_GHAction_ab586365-cac8-4411-8f4d-f77887759796",
"status": "requires_capture",
"amount": 1000,
"net_amount": 1000,
"amount_capturable": 1000,
"amount_received": null,
"connector": "datatrans",
"client_secret": "pay_CRIGcbIdUUt63W9T6AdC_secret_GJpKc6Em0hGSTo4i3xsR",
"created": "2024-09-26T07:32:55.251Z",
"currency": "GBP",
"customer_id": null,
"customer": {
"id": null,
"name": null,
"email": "[email protected]",
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0001",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "540400",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "Zurich",
"country": "CH",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "8008",
"state": "asd",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "240926093256362572",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_hgcQW2ws9zUMChF0M7cw",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_nk9d1HL70km9tbEBxAXE",
"incremental_authorization_allowed": true,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-09-26T07:47:55.251Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2024-09-26T07:32:58.937Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
IncrementalAuthCall Request
curl --location 'http://localhost:8080/payments/pay_CRIGcbIdUUt63W9T6AdC/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_h9yHL3KO9MaWY4SqnqPAWAXGCtaFrcAe8cqEvH8B1JDvSNHDui1pbD32OuvuwML1' \
--data '{"amount":1600}'
Response
{
"payment_id": "pay_CRIGcbIdUUt63W9T6AdC",
"merchant_id": "postman_merchant_GHAction_ab586365-cac8-4411-8f4d-f77887759796",
"status": "requires_capture",
"amount": 1600,
"net_amount": 1600,
"amount_capturable": 1600,
"amount_received": null,
"connector": "datatrans",
"client_secret": "pay_CRIGcbIdUUt63W9T6AdC_secret_GJpKc6Em0hGSTo4i3xsR",
"created": "2024-09-26T07:32:55.251Z",
"currency": "GBP",
"customer_id": null,
"customer": {
"id": null,
"name": null,
"email": "[email protected]",
"phone": null,
"phone_country_code": null
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": null,
"capture_on": null,
"capture_method": "manual",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0001",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "540400",
"card_extended_bin": null,
"card_exp_month": "06",
"card_exp_year": "25",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": null,
"order_details": null,
"email": null,
"name": null,
"phone": null,
"return_url": null,
"authentication_type": "no_three_ds",
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": false,
"connector_transaction_id": "240926093256362572",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_hgcQW2ws9zUMChF0M7cw",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_nk9d1HL70km9tbEBxAXE",
"incremental_authorization_allowed": true,
"authorization_count": 1,
"incremental_authorizations": [
{
"authorization_id": "auth_JxnZIsGYj0Lssip179y1_1",
"amount": 1600,
"status": "success",
"error_code": null,
"error_message": null,
"previously_authorized_amount": 1000
}
],
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-09-26T07:47:55.251Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2024-09-26T07:33:11.039Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
Checklist
- [x] I formatted the code
cargo +nightly fmt --all - [x] I addressed lints thrown by
cargo clippy - [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
Changed Files
| File | Status |
|---|---|
| Unsupported file format | |
| Unsupported file format | |
| Unsupported file format | |
| Unsupported file format | |
| Unsupported file format | |
| Unsupported file format | |
| Unsupported file format |