Bug: make customer details None in the `Psync` flow if the customer is deleted



If the customer is deleted after the payment is done the payments retrieve will fail as the customer details are redacted. But we should be able to retrieve a payment even is the customer details are redacted.
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index c2a14871a47..b9c89cd4387 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1372,6 +1372,18 @@ pub async fn get_customer_from_details<F: Clone>(
     todo!()
 }
 
+#[cfg(all(feature = "v2", feature = "customer_v2"))]
+pub async fn get_customer_details_even_for_redacted_customer<F: Clone>(
+    _state: &SessionState,
+    _customer_id: Option<id_type::CustomerId>,
+    _merchant_id: &id_type::MerchantId,
+    _payment_data: &mut PaymentData<F>,
+    _merchant_key_store: &domain::MerchantKeyStore,
+    _storage_scheme: enums::MerchantStorageScheme,
+) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
+    todo!()
+}
+
 #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
 pub async fn get_customer_from_details<F: Clone>(
     state: &SessionState,
@@ -1712,6 +1724,44 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
     ))
 }
 
+// This function is to retrieve customer details. If the customer is deleted, it returns
+// customer details that contains the fields as Redacted
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
+pub async fn get_customer_details_even_for_redacted_customer<F: Clone>(
+    state: &SessionState,
+    customer_id: Option<id_type::CustomerId>,
+    merchant_id: &id_type::MerchantId,
+    payment_data: &mut PaymentData<F>,
+    merchant_key_store: &domain::MerchantKeyStore,
+    storage_scheme: enums::MerchantStorageScheme,
+) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
+    match customer_id {
+        None => Ok(None),
+        Some(customer_id) => {
+            let db = &*state.store;
+            let customer_details = db
+                .find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
+                    &state.into(),
+                    &customer_id,
+                    merchant_id,
+                    merchant_key_store,
+                    storage_scheme,
+                )
+                .await?;
+
+            payment_data.email = payment_data.email.clone().or_else(|| {
+                customer_details.as_ref().and_then(|inner| {
+                    inner
+                        .email
+                        .clone()
+                        .map(|encrypted_value| encrypted_value.into())
+                })
+            });
+            Ok(customer_details)
+        }
+    }
+}
+
 pub async fn retrieve_payment_method_with_temporary_token(
     state: &SessionState,
     token: &str,
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index ebc00e42e5a..0eef08c104c 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -276,7 +276,7 @@ where
     > {
         Ok((
             Box::new(self),
-            helpers::get_customer_from_details(
+            helpers::get_customer_details_even_for_redacted_customer(
                 state,
                 payment_data.payment_intent.customer_id.clone(),
                 &merchant_key_store.merchant_id,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index cb4c0ce2898..b2070718892 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -601,36 +601,50 @@ where
     let customer_table_response: Option<CustomerDetailsResponse> =
         customer.as_ref().map(ForeignInto::foreign_into);
 
-    // If we have customer data in Payment Intent, We are populating the Retrieve response from the
-    // same
+    // If we have customer data in Payment Intent and if the customer is not deleted, We are populating the Retrieve response from the
+    // same. If the customer is deleted then we use the customer table to populate customer details
     let customer_details_response =
         if let Some(customer_details_raw) = payment_intent.customer_details.clone() {
             let customer_details_encrypted =
                 serde_json::from_value::<CustomerData>(customer_details_raw.into_inner().expose());
             if let Ok(customer_details_encrypted_data) = customer_details_encrypted {
                 Some(CustomerDetailsResponse {
-                    id: customer_table_response.and_then(|customer_data| customer_data.id),
-                    name: customer_details_encrypted_data
-                        .name
-                        .or(customer.as_ref().and_then(|customer| {
-                            customer.name.as_ref().map(|name| name.clone().into_inner())
-                        })),
-                    email: customer_details_encrypted_data.email.or(customer
+                    id: customer_table_response
                         .as_ref()
-                        .and_then(|customer| customer.email.clone().map(Email::from))),
-                    phone: customer_details_encrypted_data
-                        .phone
-                        .or(customer.as_ref().and_then(|customer| {
-                            customer
-                                .phone
-                                .as_ref()
-                                .map(|phone| phone.clone().into_inner())
-                        })),
-                    phone_country_code: customer_details_encrypted_data.phone_country_code.or(
-                        customer
+                        .and_then(|customer_data| customer_data.id.clone()),
+                    name: customer_table_response
+                        .as_ref()
+                        .and_then(|customer_data| customer_data.name.clone())
+                        .or(customer_details_encrypted_data
+                            .name
+                            .or(customer.as_ref().and_then(|customer| {
+                                customer.name.as_ref().map(|name| name.clone().into_inner())
+                            }))),
+                    email: customer_table_response
+                        .as_ref()
+                        .and_then(|customer_data| customer_data.email.clone())
+                        .or(customer_details_encrypted_data.email.or(customer
                             .as_ref()
-                            .and_then(|customer| customer.phone_country_code.clone()),
-                    ),
+                            .and_then(|customer| customer.email.clone().map(Email::from)))),
+                    phone: customer_table_response
+                        .as_ref()
+                        .and_then(|customer_data| customer_data.phone.clone())
+                        .or(customer_details_encrypted_data
+                            .phone
+                            .or(customer.as_ref().and_then(|customer| {
+                                customer
+                                    .phone
+                                    .as_ref()
+                                    .map(|phone| phone.clone().into_inner())
+                            }))),
+                    phone_country_code: customer_table_response
+                        .as_ref()
+                        .and_then(|customer_data| customer_data.phone_country_code.clone())
+                        .or(customer_details_encrypted_data
+                            .phone_country_code
+                            .or(customer
+                                .as_ref()
+                                .and_then(|customer| customer.phone_country_code.clone()))),
                 })
             } else {
                 customer_table_response
diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs
index b271a16d9d9..24402c343fa 100644
--- a/crates/router/src/db/customers.rs
+++ b/crates/router/src/db/customers.rs
@@ -55,6 +55,16 @@ where
         storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<Option<customer::Customer>, errors::StorageError>;
 
+    #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
+    async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
+        &self,
+        state: &KeyManagerState,
+        customer_id: &id_type::CustomerId,
+        merchant_id: &id_type::MerchantId,
+        key_store: &domain::MerchantKeyStore,
+        storage_scheme: MerchantStorageScheme,
+    ) -> CustomResult<Option<customer::Customer>, errors::StorageError>;
+
     #[cfg(all(feature = "v2", feature = "customer_v2"))]
     async fn find_optional_by_merchant_id_merchant_reference_id(
         &self,
@@ -242,6 +252,73 @@ mod storage {
             })
         }
 
+        #[instrument(skip_all)]
+        // check customer not found in kv and fallback to db
+        #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
+        async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
+            &self,
+            state: &KeyManagerState,
+            customer_id: &id_type::CustomerId,
+            merchant_id: &id_type::MerchantId,
+            key_store: &domain::MerchantKeyStore,
+            storage_scheme: MerchantStorageScheme,
+        ) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
+            let conn = connection::pg_connection_read(self).await?;
+            let database_call = || async {
+                storage_types::Customer::find_optional_by_customer_id_merchant_id(
+                    &conn,
+                    customer_id,
+                    merchant_id,
+                )
+                .await
+                .map_err(|err| report!(errors::StorageError::from(err)))
+            };
+            let storage_scheme =
+                decide_storage_scheme::<_, diesel_models::Customer>(self, storage_scheme, Op::Find)
+                    .await;
+            let maybe_customer = match storage_scheme {
+                MerchantStorageScheme::PostgresOnly => database_call().await,
+                MerchantStorageScheme::RedisKv => {
+                    let key = PartitionKey::MerchantIdCustomerId {
+                        merchant_id,
+                        customer_id: customer_id.get_string_repr(),
+                    };
+                    let field = format!("cust_{}", customer_id.get_string_repr());
+                    Box::pin(db_utils::try_redis_get_else_try_database_get(
+                        // check for ValueNotFound
+                        async {
+                            kv_wrapper(
+                                self,
+                                KvOperation::<diesel_models::Customer>::HGet(&field),
+                                key,
+                            )
+                            .await?
+                            .try_into_hget()
+                            .map(Some)
+                        },
+                        database_call,
+                    ))
+                    .await
+                }
+            }?;
+
+            let maybe_result = maybe_customer
+                .async_map(|customer| async {
+                    customer
+                        .convert(
+                            state,
+                            key_store.key.get_inner(),
+                            key_store.merchant_id.clone().into(),
+                        )
+                        .await
+                        .change_context(errors::StorageError::DecryptionError)
+                })
+                .await
+                .transpose()?;
+
+            Ok(maybe_result)
+        }
+
         #[cfg(all(feature = "v2", feature = "customer_v2"))]
         async fn find_optional_by_merchant_id_merchant_reference_id(
             &self,
@@ -938,6 +1015,35 @@ mod storage {
             })
         }
 
+        #[instrument(skip_all)]
+        #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
+        async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
+            &self,
+            state: &KeyManagerState,
+            customer_id: &id_type::CustomerId,
+            merchant_id: &id_type::MerchantId,
+            key_store: &domain::MerchantKeyStore,
+            _storage_scheme: MerchantStorageScheme,
+        ) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
+            let conn = connection::pg_connection_read(self).await?;
+            let maybe_customer: Option<customer::Customer> =
+                storage_types::Customer::find_optional_by_customer_id_merchant_id(
+                    &conn,
+                    customer_id,
+                    merchant_id,
+                )
+                .await
+                .map_err(|error| report!(errors::StorageError::from(error)))?
+                .async_map(|c| async {
+                    c.convert(state, key_store.key.get_inner(), merchant_id.clone().into())
+                        .await
+                        .change_context(errors::StorageError::DecryptionError)
+                })
+                .await
+                .transpose()?;
+            Ok(maybe_customer)
+        }
+
         #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
         #[instrument(skip_all)]
         #[cfg(all(feature = "v2", feature = "customer_v2"))]
@@ -1239,6 +1345,37 @@ impl CustomerInterface for MockDb {
             .transpose()
     }
 
+    #[allow(clippy::panic)]
+    #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
+    async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
+        &self,
+        state: &KeyManagerState,
+        customer_id: &id_type::CustomerId,
+        merchant_id: &id_type::MerchantId,
+        key_store: &domain::MerchantKeyStore,
+        _storage_scheme: MerchantStorageScheme,
+    ) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
+        let customers = self.customers.lock().await;
+        let customer = customers
+            .iter()
+            .find(|customer| {
+                customer.get_customer_id() == *customer_id && &customer.merchant_id == merchant_id
+            })
+            .cloned();
+        customer
+            .async_map(|c| async {
+                c.convert(
+                    state,
+                    key_store.key.get_inner(),
+                    key_store.merchant_id.clone().into(),
+                )
+                .await
+                .change_context(errors::StorageError::DecryptionError)
+            })
+            .await
+            .transpose()
+    }
+
     #[allow(clippy::panic)]
     #[cfg(all(feature = "v2", feature = "customer_v2"))]
     async fn find_optional_by_merchant_id_merchant_reference_id(
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index f7b15cdb3a3..d4e261792f7 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -375,6 +375,26 @@ impl CustomerInterface for KafkaStore {
             .await
     }
 
+    #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
+    async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
+        &self,
+        state: &KeyManagerState,
+        customer_id: &id_type::CustomerId,
+        merchant_id: &id_type::MerchantId,
+        key_store: &domain::MerchantKeyStore,
+        storage_scheme: MerchantStorageScheme,
+    ) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
+        self.diesel_store
+            .find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
+                state,
+                customer_id,
+                merchant_id,
+                key_store,
+                storage_scheme,
+            )
+            .await
+    }
+
     #[cfg(all(feature = "v2", feature = "customer_v2"))]
     async fn find_optional_by_merchant_id_merchant_reference_id(
         &self,

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
If the customer is deleted after the payment is done the payments retrieve will fail as the customer details are redacted. But we should be able to retrieve a payment even is the customer details are redacted.

This pr contains the changes that will set the customer details to `None` if the customer details are redacted during the `Psync`.

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->


## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
-> Make a card payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0' \
--data-raw '{
    "amount": 100,
    "amount_to_capture": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "customer_id": "cu_1725352557",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "http://127.0.0.1:4040",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000000119",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "838"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "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": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```
{
    "payment_id": "pay_5zhIYYmNTX8Tt5aBhh9L",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_5zhIYYmNTX8Tt5aBhh9L_secret_7ZVEnylnSEZT4hzpqmWS",
    "created": "2024-09-03T08:37:35.629Z",
    "currency": "USD",
    "customer_id": "cu_1725352656",
    "customer": {
        "id": "cu_1725352656",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_XPgomv4iZkbxp4PX9Jrt",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1725352656",
        "created_at": 1725352655,
        "expires": 1725356255,
        "secret": "epk_11de191943614d18b24ffda26474d9eb"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253526568986196003955",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_5zhIYYmNTX8Tt5aBhh9L_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T08:52:35.629Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-03T08:37:38.445Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> Delete the customer 
```
curl --location --request DELETE 'http://localhost:8080/customers/cu_1725352656' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "customer_id": "cu_1725352656",
    "customer_deleted": true,
    "address_deleted": true,
    "payment_methods_deleted": true
}
```
-> force sync
```
curl --location 'http://localhost:8080/payments/pay_5zhIYYmNTX8Tt5aBhh9L?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "payment_id": "pay_5zhIYYmNTX8Tt5aBhh9L",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_5zhIYYmNTX8Tt5aBhh9L_secret_7ZVEnylnSEZT4hzpqmWS",
    "created": "2024-09-03T08:37:35.629Z",
    "currency": "USD",
    "customer_id": "cu_1725352656",
    "customer": {
        "id": "cu_1725352656",
        "name": "Redacted",
        "email": "Redacted",
        "phone": "Redacted",
        "phone_country_code": "Redacted"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_XPgomv4iZkbxp4PX9Jrt",
    "shipping": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "billing": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "order_details": null,
    "email": "Redacted",
    "name": "Redacted",
    "phone": "Redacted",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253526568986196003955",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_5zhIYYmNTX8Tt5aBhh9L_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T08:52:35.629Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_2HS0C3hN1bhCisZRiHRB",
    "payment_method_status": null,
    "updated": "2024-09-03T08:37:38.445Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> sync
```
curl --location 'http://localhost:8080/payments/pay_5zhIYYmNTX8Tt5aBhh9L' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "payment_id": "pay_5zhIYYmNTX8Tt5aBhh9L",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_5zhIYYmNTX8Tt5aBhh9L_secret_7ZVEnylnSEZT4hzpqmWS",
    "created": "2024-09-03T08:37:35.629Z",
    "currency": "USD",
    "customer_id": "cu_1725352656",
    "customer": {
        "id": "cu_1725352656",
        "name": "Redacted",
        "email": "Redacted",
        "phone": "Redacted",
        "phone_country_code": "Redacted"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_XPgomv4iZkbxp4PX9Jrt",
    "shipping": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "billing": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "order_details": null,
    "email": "Redacted",
    "name": "Redacted",
    "phone": "Redacted",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253526568986196003955",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_5zhIYYmNTX8Tt5aBhh9L_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T08:52:35.629Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_2HS0C3hN1bhCisZRiHRB",
    "payment_method_status": null,
    "updated": "2024-09-03T08:37:38.445Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> Create a 3DS payment
```
{
    "amount": 100,
    "amount_to_capture": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "cu_{{$timestamp}}",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "setup_future_usage": "on_session",
    "return_url": "http://127.0.0.1:4040",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000000119",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "838"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "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": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
```
```
{
    "payment_id": "pay_41DjpxBAJQivxfQeKPv8",
    "merchant_id": "merchant_1725352456",
    "status": "requires_customer_action",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_41DjpxBAJQivxfQeKPv8_secret_3smf34QBXKWJtCauS4jm",
    "created": "2024-09-03T08:40:44.643Z",
    "currency": "USD",
    "customer_id": "cu_1725352845",
    "customer": {
        "id": "cu_1725352845",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_QQOmOKb72IHX9oc0V6pi",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "http://127.0.0.1:4040/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_41DjpxBAJQivxfQeKPv8/merchant_1725352456/pay_41DjpxBAJQivxfQeKPv8_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": "cu_1725352845",
        "created_at": 1725352844,
        "expires": 1725356444,
        "secret": "epk_1a74a81a985a417fbcea5ec3740c3945"
    },
    "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": "pay_41DjpxBAJQivxfQeKPv8_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T08:55:44.643Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-03T08:40:46.043Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> Perform the 3DS action
-> Delete the customer
-> Retrieve the payment
```
curl --location 'http://localhost:8080/payments/pay_41DjpxBAJQivxfQeKPv8' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "payment_id": "pay_41DjpxBAJQivxfQeKPv8",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_41DjpxBAJQivxfQeKPv8_secret_3smf34QBXKWJtCauS4jm",
    "created": "2024-09-03T08:40:44.643Z",
    "currency": "USD",
    "customer_id": "cu_1725352845",
    "customer": {
        "id": "cu_1725352845",
        "name": "Redacted",
        "email": "Redacted",
        "phone": "Redacted",
        "phone_country_code": "Redacted"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_QQOmOKb72IHX9oc0V6pi",
    "shipping": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "billing": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "order_details": null,
    "email": "Redacted",
    "name": "Redacted",
    "phone": "Redacted",
    "return_url": "http://127.0.0.1:4040/",
    "authentication_type": "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253528712066298603955",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_41DjpxBAJQivxfQeKPv8_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T08:55:44.643Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_wxeK1LrwVZaeHOYeMqYu",
    "payment_method_status": null,
    "updated": "2024-09-03T08:41:12.583Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
```
curl --location 'http://localhost:8080/payments/pay_41DjpxBAJQivxfQeKPv8?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "payment_id": "pay_41DjpxBAJQivxfQeKPv8",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_41DjpxBAJQivxfQeKPv8_secret_3smf34QBXKWJtCauS4jm",
    "created": "2024-09-03T08:40:44.643Z",
    "currency": "USD",
    "customer_id": "cu_1725352845",
    "customer": {
        "id": "cu_1725352845",
        "name": "Redacted",
        "email": "Redacted",
        "phone": "Redacted",
        "phone_country_code": "Redacted"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_QQOmOKb72IHX9oc0V6pi",
    "shipping": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "billing": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "order_details": null,
    "email": "Redacted",
    "name": "Redacted",
    "phone": "Redacted",
    "return_url": "http://127.0.0.1:4040/",
    "authentication_type": "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253528712066298603955",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_41DjpxBAJQivxfQeKPv8_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T08:55:44.643Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_wxeK1LrwVZaeHOYeMqYu",
    "payment_method_status": null,
    "updated": "2024-09-03T08:41:12.583Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> Create a payment with manual capture
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0GFABoDSJOBz6xazfsPttF4srDNXV6bFjsg9u5Uyt0z2hNGnyluDlVHf0GjU7qUm' \
--data-raw '{
    "amount": 100,
    "amount_to_capture": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "cu_1724853507",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "on_session",
    "return_url": "http://127.0.0.1:4040",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000000119",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "838"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "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": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```
{
    "payment_id": "pay_AwRQSrjv0N7tQEYzZnQ1",
    "merchant_id": "merchant_1725352456",
    "status": "requires_capture",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_AwRQSrjv0N7tQEYzZnQ1_secret_VGJkIXf0NncMLVeXfMcX",
    "created": "2024-09-03T08:45:14.448Z",
    "currency": "USD",
    "customer_id": "cu_1724853507",
    "customer": {
        "id": "cu_1724853507",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_rs2SpEaYBN0nGtwNEyGa",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1724853507",
        "created_at": 1725353114,
        "expires": 1725356714,
        "secret": "epk_a1e4edaf5d4d4db986de6299d40e2c1d"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253531155796565703954",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_AwRQSrjv0N7tQEYzZnQ1_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T09:00:14.448Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-03T08:45:16.897Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> Delete the customer
```
curl --location --request DELETE 'http://localhost:8080/customers/cu_1724853507' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "customer_id": "cu_1724853507",
    "customer_deleted": true,
    "address_deleted": true,
    "payment_methods_deleted": true
}
```
-> Retrieve payment
```
curl --location 'http://localhost:8080/payments/pay_AwRQSrjv0N7tQEYzZnQ1' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "payment_id": "pay_AwRQSrjv0N7tQEYzZnQ1",
    "merchant_id": "merchant_1725352456",
    "status": "requires_capture",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_AwRQSrjv0N7tQEYzZnQ1_secret_VGJkIXf0NncMLVeXfMcX",
    "created": "2024-09-03T08:45:14.448Z",
    "currency": "USD",
    "customer_id": "cu_1724853507",
    "customer": {
        "id": "cu_1724853507",
        "name": "Redacted",
        "email": "Redacted",
        "phone": "Redacted",
        "phone_country_code": "Redacted"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_rs2SpEaYBN0nGtwNEyGa",
    "shipping": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "billing": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "order_details": null,
    "email": "Redacted",
    "name": "Redacted",
    "phone": "Redacted",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253531155796565703954",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_AwRQSrjv0N7tQEYzZnQ1_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T09:00:14.448Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_ZLuJJO15IFfb9jvoHjIb",
    "payment_method_status": null,
    "updated": "2024-09-03T08:45:16.897Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
```
curl --location 'http://localhost:8080/payments/pay_AwRQSrjv0N7tQEYzZnQ1?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "payment_id": "pay_AwRQSrjv0N7tQEYzZnQ1",
    "merchant_id": "merchant_1725352456",
    "status": "requires_capture",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_AwRQSrjv0N7tQEYzZnQ1_secret_VGJkIXf0NncMLVeXfMcX",
    "created": "2024-09-03T08:45:14.448Z",
    "currency": "USD",
    "customer_id": "cu_1724853507",
    "customer": {
        "id": "cu_1724853507",
        "name": "Redacted",
        "email": "Redacted",
        "phone": "Redacted",
        "phone_country_code": "Redacted"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_rs2SpEaYBN0nGtwNEyGa",
    "shipping": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "billing": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "order_details": null,
    "email": "Redacted",
    "name": "Redacted",
    "phone": "Redacted",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253531155796565703954",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7253531155796565703954",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T09:00:14.448Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_ZLuJJO15IFfb9jvoHjIb",
    "payment_method_status": null,
    "updated": "2024-09-03T08:47:14.334Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```

-> Guest customer
Create a payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0' \
--data-raw '{
    "amount": 100,
    "amount_to_capture": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",

    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "http://127.0.0.1:4040",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000000119",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "838"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "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": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```
{
    "payment_id": "pay_v5429vfsJdjtaQqhhNMB",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_v5429vfsJdjtaQqhhNMB_secret_G7epyOKsACfNDr0Sgivo",
    "created": "2024-09-03T08:48:12.266Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_2LY32nDUPNvVLcg6hDiu",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253532925156616403954",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_v5429vfsJdjtaQqhhNMB_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T09:03:12.266Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-03T08:48:13.596Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
Payments retrieve
```
curl --location 'http://localhost:8080/payments/pay_v5429vfsJdjtaQqhhNMB?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0'
```
```
{
    "payment_id": "pay_v5429vfsJdjtaQqhhNMB",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_v5429vfsJdjtaQqhhNMB_secret_G7epyOKsACfNDr0Sgivo",
    "created": "2024-09-03T08:48:12.266Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_2LY32nDUPNvVLcg6hDiu",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253532925156616403954",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_v5429vfsJdjtaQqhhNMB_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T09:03:12.266Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-03T08:48:13.596Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> Customer details are sent in the customer object
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_RPC8caLJDX8s4AFPVxr0KCy6UOTSJNs7IjbfK9WmkDddIBTfibFPBuQxM4A1nKu0' \
--data-raw '{
    "amount": 100,
    "amount_to_capture": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
"customer": {
        "id": "cu_1725353517",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "http://127.0.0.1:4040",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000000119",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "838"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "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": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
```
{
    "payment_id": "pay_RJBqVC4xSMkv9YqojScT",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_RJBqVC4xSMkv9YqojScT_secret_OpoEIrC5SEX8D1lejuya",
    "created": "2024-09-03T08:51:51.753Z",
    "currency": "USD",
    "customer_id": "cu_1725353512",
    "customer": {
        "id": "cu_1725353512",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_UNh5IWViTJSnR6DmWnMi",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1725353512",
        "created_at": 1725353511,
        "expires": 1725357111,
        "secret": "epk_c5c3bbc2a43b4effb8b7af30f23c8119"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253535128366701403954",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_RJBqVC4xSMkv9YqojScT_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T09:06:51.753Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-03T08:51:53.907Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```
-> Delete a customer and retrieve a payment
```
{
    "payment_id": "pay_RJBqVC4xSMkv9YqojScT",
    "merchant_id": "merchant_1725352456",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_RJBqVC4xSMkv9YqojScT_secret_OpoEIrC5SEX8D1lejuya",
    "created": "2024-09-03T08:51:51.753Z",
    "currency": "USD",
    "customer_id": "cu_1725353512",
    "customer": {
        "id": "cu_1725353512",
        "name": "Redacted",
        "email": "Redacted",
        "phone": "Redacted",
        "phone_country_code": "Redacted"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_UNh5IWViTJSnR6DmWnMi",
    "shipping": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "billing": {
        "address": {
            "city": "Redacted",
            "country": "US",
            "line1": "Redacted",
            "line2": "Redacted",
            "line3": "Redacted",
            "zip": "Redacted",
            "state": "Redacted",
            "first_name": "Redacted",
            "last_name": "Redacted"
        },
        "phone": {
            "number": "Redacted",
            "country_code": "Redacted"
        },
        "email": "Redacted"
    },
    "order_details": null,
    "email": "Redacted",
    "name": "Redacted",
    "phone": "Redacted",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7253535128366701403954",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_RJBqVC4xSMkv9YqojScT_1",
    "payment_link": null,
    "profile_id": "pro_pCmVCFH8Jh9CRAOq71tG",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HLz5UXL0F35JM3QsRh6f",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-03T09:06:51.753Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "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,
        "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,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_jzj3gJnY1vfjSBWttyeg",
    "payment_method_status": null,
    "updated": "2024-09-03T08:51:53.907Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}
```


## Checklist
<!-- Put an `x` in the boxes that apply -->

- [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
