-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(connector): Added a new CaptureMethod SequentialAutomatic to Support CIT Mandates for Paybox #6587
base: main
Are you sure you want to change the base?
Conversation
886e20b
to
259c776
Compare
new_router_data.status, | ||
) { | ||
// Convert Authorize RouterData into Capture RouterData | ||
let mut capture_router_data = convert_auth_to_capture(&new_router_data)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use router_data_type_conversion
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented the suggested change.
&post_capture_resp, | ||
)); | ||
} | ||
(_, _, _) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log the error here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logged the errors
} | ||
} | ||
} | ||
Err(_) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too, log the error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented the suggested change.
} | ||
} | ||
|
||
/// Function to check if the Capture API should be called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provide better description as to why / who / when this function can be called. A detailed description as to why we are matching over the params.
*connector_name == router_types::Connector::Paybox | ||
&& (off_session == Some(true) || setup_future_usage == Some(enums::FutureUsage::OffSession)) | ||
&& customer_acceptance.is_some() | ||
&& capture_method == Some(enums::CaptureMethod::SequentialAutomatic) | ||
&& status == common_enums::AttemptStatus::Authorized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not add all the conditions in a single condition, you can first check for the status, then the capture method. After that match on the connector, then the other conditions. Using this it will be extensible to add other connectors as well
&& status == common_enums::AttemptStatus::Authorized | ||
} | ||
|
||
pub fn merge_transaction_responses( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you provide this as a impl on the PaymentsResponseData
? Please check if that is possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
) => { | ||
new_router_data.status = common_enums::AttemptStatus::Charged; | ||
new_router_data.response = | ||
Ok(helpers::merge_transaction_responses( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to consider the auth response as well here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we get the connector_metadata in the auth response
connector_meta: helpers::get_connector_metadata(item.response), | ||
browser_info: None, | ||
metadata: None, | ||
capture_method: Some(common_enums::CaptureMethod::Manual), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we changing the capture method here?
Ok(Self { | ||
amount_to_capture: item.request.amount, | ||
currency: item.request.currency, | ||
connector_transaction_id: helpers::get_connector_transaction_id(item.response.clone())?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not use helpers, impl these functions on the type i.e PaymentsResponseData
in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
connector_transaction_id: helpers::get_connector_transaction_id(item.response.clone())?, | ||
payment_amount: item.request.amount, | ||
multiple_capture_data: None, | ||
connector_meta: helpers::get_connector_metadata(item.response), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, do not use helpers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the function from the helpers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try as much as possible to not define any hanging functions in this file. Impl the functions on the type itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
}, | ||
) | ||
// Determine the match criteria based on the connector | ||
let match_criteria = if connector.as_deref() == Some("paybox") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not convert to string and equate, use the connector enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not allowing sequential_automatic for other connectors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed that check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a detailed design which includes the problem statemtent and the solution?
0c53a66
to
c9bc150
Compare
Type of Change
Description
For Paybox:
Auth
)Capture
)SequentialAutomatic
will function the same asAutomatic
.For other connectors:
SequentialAutomatic
will behave the same asAutomatic
.Additional Changes
Motivation and Context
For Customer-Initiated Transactions (CIT) with Paybox, authorization and capture must be performed as two separate operations. Paybox does not support a combined authorization and capture in a single request. To avoid requiring the merchant to handle this process, we introduced a new capture method: SequentialAutomatic, which ensures that two API calls are made automatically.
How did you test it?
curl --location 'http://localhost:8080/payments'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU'
--data '{
"amount": 501,
"currency": "EUR",
"confirm": true,
"capture_method": "sequential_automatic",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at":"1963-05-03T04:07:52.723Z",
"online": {
"ip_address":"127.0.0.1",
"user_agent": "amet irure esse"
}
},
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "5200000000000007",
"card_exp_month": "01",
"card_exp_year": "26",
"card_holder_name": "John T",
"card_cvc": "123"
}
},
"customer_id":"test_mit",
"authentication_type": "three_ds",
"return_url": "https://google.com",
"setup_future_usage": "off_session"
}'
{
"payment_id": "pay_Q75JaLo7wPiCAh8nrkZc",
"merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196",
"status": "requires_customer_action",
"amount": 501,
"net_amount": 501,
"shipping_cost": null,
"amount_capturable": 501,
"amount_received": null,
"connector": "paybox",
"client_secret": "pay_Q75JaLo7wPiCAh8nrkZc_secret_Qa4XYmBSyuDUbaqKtJ7r",
"created": "2024-11-19T03:58:16.513Z",
"currency": "EUR",
"customer_id": "test_mit",
"customer": {
"id": "test_mit",
"name": "Joseph Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "sequential_automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0007",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "520000",
"card_extended_bin": null,
"card_exp_month": "01",
"card_exp_year": "26",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_9qL6FgoOzIVLvviNRNwL",
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "[email protected]",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"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_Q75JaLo7wPiCAh8nrkZc/postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196/pay_Q75JaLo7wPiCAh8nrkZc_1"
},
"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": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "test_mit",
"created_at": 1731988696,
"expires": 1731992296,
"secret": "epk_e83b819668e84eb99ab249e855471ed8"
},
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_hl5seUYAuPOk5MN8bSGO",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-11-19T04:13:16.513Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_vdP2g5rwDJBoKDubJPvQ",
"payment_method_status": "inactive",
"updated": "2024-11-19T03:58:17.469Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
1.1. Payment Sync
curl --location 'http://localhost:8080/payments/pay_DMkbjecVspKCAf7Sjl2o'
--header 'Accept: application/json'
--header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU'
{
"payment_id": "pay_Q75JaLo7wPiCAh8nrkZc",
"merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196",
"status": "succeeded",
"amount": 501,
"net_amount": 501,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 501,
"connector": "paybox",
"client_secret": "pay_Q75JaLo7wPiCAh8nrkZc_secret_Qa4XYmBSyuDUbaqKtJ7r",
"created": "2024-11-19T03:58:16.513Z",
"currency": "EUR",
"customer_id": "test_mit",
"customer": {
"id": "test_mit",
"name": "Joseph Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "sequential_automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0007",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "520000",
"card_extended_bin": null,
"card_exp_month": "01",
"card_exp_year": "26",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_9qL6FgoOzIVLvviNRNwL",
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "[email protected]",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"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": null,
"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": "0080164085",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_hl5seUYAuPOk5MN8bSGO",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-11-19T04:13:16.513Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_vdP2g5rwDJBoKDubJPvQ",
"payment_method_status": "active",
"updated": "2024-11-19T03:59:47.678Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null
}
1.3. MIT payment
curl --location 'http://localhost:8080/payments'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU'
--data-raw '{
"amount": 7100,
"currency": "EUR",
"confirm": true,
"customer_id": "test_mit",
"email": "[email protected]",
"off_session": true,
"recurring_details": {
"type": "payment_method_id",
"data": "pm_vdP2g5rwDJBoKDubJPvQ"
},
"payment_method": "card",
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "[email protected]"
}
}'
-Response
{
"payment_id": "pay_DMkbjecVspKCAf7Sjl2o",
"merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196",
"status": "succeeded",
"amount": 7100,
"net_amount": 7100,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 7100,
"connector": "paybox",
"client_secret": "pay_DMkbjecVspKCAf7Sjl2o_secret_Ub8XUCMAUqgIdWYgDN2N",
"created": "2024-11-19T04:01:26.747Z",
"currency": "EUR",
"customer_id": "test_mit",
"customer": {
"id": "test_mit",
"name": "Joseph Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": true,
"capture_on": null,
"capture_method": null,
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0007",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "520000",
"card_extended_bin": null,
"card_exp_month": "01",
"card_exp_year": "26",
"card_holder_name": "John T",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "[email protected]"
},
"order_details": null,
"email": "[email protected]",
"name": "Joseph Doe",
"phone": "999999999",
"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": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "test_mit",
"created_at": 1731988886,
"expires": 1731992486,
"secret": "epk_d193d4bab05147aea937bdd6c5c84568"
},
"manual_retry_allowed": false,
"connector_transaction_id": "0080164087",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_hl5seUYAuPOk5MN8bSGO",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-11-19T04:16:26.747Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_vdP2g5rwDJBoKDubJPvQ",
"payment_method_status": "active",
"updated": "2024-11-19T04:01:28.480Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "SM@LpCp@L@C"
}
2.1 -Request
curl --location 'http://localhost:8080/payments'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU'
--data '{
"amount": 501,
"currency": "EUR",
"confirm": true,
"capture_method": "sequential_automatic",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at":"1963-05-03T04:07:52.723Z",
"online": {
"ip_address":"127.0.0.1",
"user_agent": "amet irure esse"
}
},
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "5200000000000007",
"card_exp_month": "01",
"card_exp_year": "26",
"card_holder_name": "John T",
"card_cvc": "123"
}
},
"customer_id":"test_mit",
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"setup_future_usage": "off_session"
}'
-Response
{
"payment_id": "pay_Adusyo4wM4lvxsG9G8Og",
"merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196",
"status": "succeeded",
"amount": 501,
"net_amount": 501,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 501,
"connector": "paybox",
"client_secret": "pay_Adusyo4wM4lvxsG9G8Og_secret_zxcn25iSAsbZ8HKAIokb",
"created": "2024-11-19T04:08:34.637Z",
"currency": "EUR",
"customer_id": "test_mit",
"customer": {
"id": "test_mit",
"name": "Joseph Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "sequential_automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0007",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "520000",
"card_extended_bin": null,
"card_exp_month": "01",
"card_exp_year": "26",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_R1rt2mhmfi7yN57PFJuO",
"shipping": null,
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": null
},
"order_details": null,
"email": "[email protected]",
"name": "Joseph Doe",
"phone": "999999999",
"return_url": "https://google.com/",
"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": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "test_mit",
"created_at": 1731989314,
"expires": 1731992914,
"secret": "epk_6727367741724d5fbf3e027fe31653a2"
},
"manual_retry_allowed": false,
"connector_transaction_id": "0080164102",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_hl5seUYAuPOk5MN8bSGO",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-11-19T04:23:34.637Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_fjGE1FjOztrWm26w5gfS",
"payment_method_status": "active",
"updated": "2024-11-19T04:08:37.521Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "SM@LpCp@L@C"
}
2.2MIT payment
-Request
curl --location 'http://localhost:8080/payments'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU'
--data-raw '{
"amount": 7100,
"currency": "EUR",
"confirm": true,
"customer_id": "test_mit",
"email": "[email protected]",
"off_session": true,
"recurring_details": {
"type": "payment_method_id",
"data": "pm_fjGE1FjOztrWm26w5gfS"
},
"payment_method": "card",
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "[email protected]"
}
}'
-Response
{
"payment_id": "pay_ozT3qe38r1krdHLhyfDS",
"merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196",
"status": "succeeded",
"amount": 7100,
"net_amount": 7100,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 7100,
"connector": "paybox",
"client_secret": "pay_ozT3qe38r1krdHLhyfDS_secret_RRTrzdf41k8C5J8CXFc4",
"created": "2024-11-19T04:09:39.712Z",
"currency": "EUR",
"customer_id": "test_mit",
"customer": {
"id": "test_mit",
"name": "Joseph Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": true,
"capture_on": null,
"capture_method": null,
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "0007",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "520000",
"card_extended_bin": null,
"card_exp_month": "01",
"card_exp_year": "26",
"card_holder_name": "John T",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": null,
"billing": {
"address": {
"city": "test",
"country": "US",
"line1": "here",
"line2": "there",
"line3": "anywhere",
"zip": "560095",
"state": "Washington",
"first_name": "One",
"last_name": "Two"
},
"phone": {
"number": "1234567890",
"country_code": "+1"
},
"email": "[email protected]"
},
"order_details": null,
"email": "[email protected]",
"name": "Joseph Doe",
"phone": "999999999",
"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": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "test_mit",
"created_at": 1731989379,
"expires": 1731992979,
"secret": "epk_ad52b99e9b23445f8f7688e4941b84c2"
},
"manual_retry_allowed": false,
"connector_transaction_id": "0080164108",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_hl5seUYAuPOk5MN8bSGO",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2024-11-19T04:24:39.712Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_fjGE1FjOztrWm26w5gfS",
"payment_method_status": "active",
"updated": "2024-11-19T04:09:41.363Z",
"charges": null,
"frm_metadata": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "SM@LpCp@L@C"
}
Checklist
cargo +nightly fmt --all
cargo clippy