Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(router): [Xendit] add support for split payments #7143

Merged
merged 91 commits into from
Feb 20, 2025

Conversation

AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented Jan 30, 2025

Type of Change

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

Description

Add support for split payments via xendit platform

Payment: Request for split

 "split_payments": {
        "xendit_split_payment": {
          "multiple_splits" : {
            "name": "20210908 Test",
            "for_user_id":"***************", //Include in case of partner to platform or platform to partner 
            "description": "Platform fee and Delivery Fee for Marketplace",
            "routes": [
                {
                    "flat_amount": 3000,
                    "currency": "IDR",
                    "destination_account_id": "***************",
                    "reference_id": "1234"
                },
                {
                    "percent_amount": 5,
                    "currency": "IDR",
                    "destination_account_id": "***************",
                    "reference_id": "1235"
                }
            ]
          }
        }
    }

Payment: Request to collect 100% money to sub-merchant

 "split_payments": {
        "xendit_split_payment": {
         "single_split" : {
            "for_user_id":"***************",
        }
      }
    }

Request for Refund (incase of platform to partner or parner to platform)

   "split_refunds": {
        "xendit_split_refund": {
            "for_user_id": "*****************"
        }
    }

Additional Changes

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

How did you test it?

0. Xendit Connector create
curl --location 'http://localhost:8080/account/postman_merchant_GHAction_93c5b6a1-6cef-4c5d-a3e1-8af3d2e9ffcc/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "xendit",
    "business_country": "US",
    "business_label": "default",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "******************"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "google_pay": {
            "allowed_payment_methods": [
                {
                    "type": "CARD",
                    "parameters": {
                        "allowed_auth_methods": [
                            "PAN_ONLY",
                            "CRYPTOGRAM_3DS"
                        ],
                        "allowed_card_networks": [
                            "AMEX",
                            "DISCOVER",
                            "INTERAC",
                            "JCB",
                            "MASTERCARD",
                            "VISA"
                        ]
                    },
                    "tokenization_specification": {
                        "type": "PAYMENT_GATEWAY",
                        "parameters": {
                            "gateway": "example",
                            "gateway_merchant_id": ""
                        }
                    }
                }
            ],
            "merchant_info": {
                "merchant_name": "Naraat"
            }
        }    
    }
}'

Response

{
    "connector_type": "payment_processor",
    "connector_name": "xendit",
    "merchant_connector_id": "mca_z4B5KU0SEVErGg0tILxm",
    "profile_id": "pro_WlOOrlmdJGP9hwjDxXaC",
     "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "******************"
    },
    "payment_methods_enabled": [
      {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
    ],
    "connector_webhook_details": {
        "merchant_secret": "dce1d767-7c28-429c-b0fe-9e0b9e91f962",
        "additional_secret": null
    },
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "test_mode": false,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "food",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null
}
1. Create a payment with Xendit for split payments.
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_P7h3XhxNefWKFy*********' \
--data-raw '{
    "amount": 651200,
    "currency": "IDR",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "First_Customer",
    "name": "John Doe",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "12",
            "card_exp_year": "27",
            "card_holder_name": "joseph Doe",
            "card_cvc": "124"
        }
    },
    "billing": {
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "split_payments": {
        "xendit_split_payment": {
            "multiple_splits": {
            "name": "20210908 Test",
           "for_user_id": "************",
            "description": "Platform fee and Delivery Fee for Marketplace",
            "routes": [
                {
                    "flat_amount": 3000,
                    "currency": "IDR",
                    "destination_account_id": "************",
                    "reference_id": "1234"
                },
                {
                    "percent_amount": 5,
                    "currency": "IDR",
                    "destination_account_id": "*********",
                    "reference_id": "1235"
                }
            ]
         }
        }
    }
}'

Response

{
    "payment_id": "pay_dnEIldnxQ8vWeuIiLW9C",
    "merchant_id": "postman_merchant_GHAction_961c0f56-fb6c-41c2-99ca-fd1afb129ade",
    "status": "processing",
    "amount": 651200,
    "net_amount": 651200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "xendit",
    "client_secret": "pay_dnEIldnxQ8vWeuIiLW9C_secret_HEvaKI904Jjq7SuawBXA",
    "created": "2025-02-04T07:37:37.711Z",
    "currency": "IDR",
    "customer_id": "First_Customer",
    "customer": {
        "id": "First_Customer",
        "name": "John Doe",
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "27",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": null,
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "First_Customer",
        "created_at": 1738654657,
        "expires": 1738658257,
        "secret": "epk_575497a6d58543eeac7d9c6d0f973efc"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-a00691fb-fe32-44e2-814a-c98b40781549",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "57b25bcb-e12e-4fe8-8b80-1467d5395602",
    "payment_link": null,
    "profile_id": "pro_aursQAXlQyPzu0T6cEK8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_O0rfcjvhxpV2hxAJkLlv",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-04T07:52:37.711Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-02-04T07:37:39.298Z",
    "split_payments": {
        "xendit_split_payment": {
            "multiple_splits": {
            "split_rule_id": "splitru_26fc58d7-ba11-4f66-92f6-7f525bccbf5a",
            "for_user_id": "************",
            "name": "20210908 Test",
            "description": "Platform fee and Delivery Fee for Marketplace",
            "routes": [
                {
                    "flat_amount": 3000,
                    "percent_amount": null,
                    "currency": "IDR",
                    "destination_account_id": "**********",
                    "reference_id": "1234"
                },
                {
                    "flat_amount": null,
                    "percent_amount": 5,
                    "currency": "IDR",
                    "destination_account_id": "************",
                    "reference_id": "1235"
                }
            ]
          }
        }
    },
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Psync

curl --location 'http://localhost:8080/payments/pay_dnEIldnxQ8vWeuIiLW9C?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_P7h3XhxNefWKF************************9'

Response

{
    "payment_id": "pay_dnEIldnxQ8vWeuIiLW9C",
    "merchant_id": "postman_merchant_GHAction_961c0f56-fb6c-41c2-99ca-fd1afb129ade",
    "status": "succeeded",
    "amount": 651200,
    "net_amount": 651200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 651200,
    "connector": "xendit",
    "client_secret": "pay_dnEIldnxQ8vWeuIiLW9C_secret_HEvaKI904Jjq7SuawBXA",
    "created": "2025-02-04T07:37:37.711Z",
    "currency": "IDR",
    "customer_id": "First_Customer",
    "customer": {
        "id": "First_Customer",
        "name": "John Doe",
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "27",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": null,
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-a00691fb-fe32-44e2-814a-c98b40781549",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "57b25bcb-e12e-4fe8-8b80-1467d5395602",
    "payment_link": null,
    "profile_id": "pro_aursQAXlQyPzu0T6cEK8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_O0rfcjvhxpV2hxAJkLlv",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-04T07:52:37.711Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-02-04T07:39:07.974Z",
    "split_payments": {
        "xendit_split_payment": {
            "multiple_splits": {
            "split_rule_id": "splitru_26fc58d7-ba11-4f66-92f6-7f525bccbf5a",
            "for_user_id": "************",
            "name": "20210908 Test",
            "description": "Platform fee and Delivery Fee for Marketplace",
            "routes": [
                {
                    "flat_amount": 3000,
                    "percent_amount": null,
                    "currency": "IDR",
                    "destination_account_id": "************************",
                    "reference_id": "1234"
                },
                {
                    "flat_amount": null,
                    "percent_amount": 5,
                    "currency": "IDR",
                    "destination_account_id": "**********************",
                    "reference_id": "1235"
                }
            ]
          }
        }
    },
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
2. Create a split payment for collecting 100% of money to sub merchant
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Q960kFyYD5UojHxadWgkgHHS0jcoMNTbCMgYprENAUoXqTq4jLp1USKMCbTm1Ile' \
--data-raw '{
    "amount": 651200,
    "currency": "IDR",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "First_Customer",
    "name": "John Doe",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "12",
            "card_exp_year": "27",
            "card_holder_name": "joseph Doe",
            "card_cvc": "124"
        }
    },
    "billing": {
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "split_payments": {
        "xendit_split_payment": {
            "single_split": {
            "for_user_id":"*****************"      
            }  
        }
    }

}'

Response

{
    "payment_id": "pay_mb8NETnhZ56oKBZsdiHO",
    "merchant_id": "postman_merchant_GHAction_fbdab73a-52eb-4b2b-9fe9-9c30e477297b",
    "status": "processing",
    "amount": 651200,
    "net_amount": 651200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "xendit",
    "client_secret": "pay_mb8NETnhZ56oKBZsdiHO_secret_zufE6rSa8n0p0XA8L0Dc",
    "created": "2025-02-05T13:34:08.522Z",
    "currency": "IDR",
    "customer_id": "First_Customer",
    "customer": {
        "id": "First_Customer",
        "name": "John Doe",
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "27",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": null,
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "First_Customer",
        "created_at": 1738762448,
        "expires": 1738766048,
        "secret": "epk_4137716f048e429383a9db8d24149590"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-85106bae-b03a-4544-b277-a3c067b8c344",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "f2299abd-9cd3-4371-a3b7-747711896c2a",
    "payment_link": null,
    "profile_id": "pro_f4YRlcNQAz0yd85vc4VB",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_tYLW9ImvWAE6EJGJjukn",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-05T13:49:08.522Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-02-05T13:34:09.722Z",
    "split_payments": {
        "xendit_split_payment": {
            "single_split": {
            "for_user_id": "*********"
            }
        }
    },
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Psync

curl --location 'http://localhost:8080/payments/pay_mb8NETnhZ56oKBZsdiHO?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_Q960kFyYD5UojHxadWgkgHHS0jcoMNTbCMgYprENAUoXqTq4jLp1USKMCbTm1Ile'

Response

{
    "payment_id": "pay_mb8NETnhZ56oKBZsdiHO",
    "merchant_id": "postman_merchant_GHAction_fbdab73a-52eb-4b2b-9fe9-9c30e477297b",
    "status": "succeeded",
    "amount": 651200,
    "net_amount": 651200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 651200,
    "connector": "xendit",
    "client_secret": "pay_mb8NETnhZ56oKBZsdiHO_secret_zufE6rSa8n0p0XA8L0Dc",
    "created": "2025-02-05T13:34:08.522Z",
    "currency": "IDR",
    "customer_id": "First_Customer",
    "customer": {
        "id": "First_Customer",
        "name": "John Doe",
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "27",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": null,
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": null,
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pr-85106bae-b03a-4544-b277-a3c067b8c344",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "f2299abd-9cd3-4371-a3b7-747711896c2a",
    "payment_link": null,
    "profile_id": "pro_f4YRlcNQAz0yd85vc4VB",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_tYLW9ImvWAE6EJGJjukn",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-05T13:49:08.522Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-02-05T13:34:15.793Z",
    "split_payments": {
        "xendit_split_payment": {
            "single_split": {
            "for_user_id": "*************"
            }
        }
    },
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
3. Split Refund
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Q960kFyYD5UojHxa*******************' \
--data '{
    "payment_id": "pay_mb8NETnhZ56oKBZsdiHO",
    "amount": 200,
    "reason": "Customer returned product",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "split_refunds": {
        "xendit_split_refund": {
            "for_user_id": "*************"
        }
    }
}'

Response

{
    "refund_id": "ref_LpFfOYlTnx1ccezJwlJi",
    "payment_id": "pay_mb8NETnhZ56oKBZsdiHO",
    "amount": 200,
    "currency": "IDR",
    "status": "succeeded",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-02-05T13:39:54.976Z",
    "updated_at": "2025-02-05T13:39:57.171Z",
    "connector": "xendit",
    "profile_id": "pro_f4YRlcNQAz0yd85vc4VB",
    "merchant_connector_id": "mca_tYLW9ImvWAE6EJGJjukn",
    "split_refunds": {
        "xendit_split_refund": {
            "for_user_id": "*****************"
        }
    }
}

When total amount of split is greater than the total payment amount
we throw a IR_10 error, with error message Sum of split amounts should not exceed the total amount

Checklist

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

Chethan-rao
Chethan-rao previously approved these changes Feb 17, 2025
Narayanbhat166
Narayanbhat166 previously approved these changes Feb 17, 2025
swangi-kumari
swangi-kumari previously approved these changes Feb 17, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Feb 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 19, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 20, 2025
Merged via the queue into main with commit 451acba Feb 20, 2025
16 of 20 checks passed
@likhinbopanna likhinbopanna deleted the xendit-platform branch February 20, 2025 15:30
aniketburman014 pushed a commit that referenced this pull request Feb 21, 2025
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
pixincreate added a commit that referenced this pull request Feb 21, 2025
* 'main' of github.com:juspay/hyperswitch:
  fix(connector): [DATATRANS] Fix Force Sync Flow (#7331)
  chore(version): 2025.02.21.0
  fix(connector): [DATATRANS] Add new payment status (#7327)
  feat(router): [Xendit] add support for split payments (#7143)
  fix(payment_methods_v2): update fingerprint implementation in v2 (#7270)
  feat(router): Add Payments - List endpoint for v2 (#7191)
  feat(core): add support for confirmation flow for click to pay (#6982)
  chore(version): 2025.02.20.0
  fix(connector): [SCRIPT] Update template generating script and updated connector doc (#7301)
  ci(cypress): add assertions for `requires_cvv` (#7296)
  refactor(utils): match string for state with SDK's naming convention (#7300)
  feat(core): add hypersense integration api  (#7218)
  chore(version): 2025.02.19.0
  feat(connector): [Moneris] Add payments flow (#7249)
  feat(core): api ,domain and diesel model changes for extended authorization (#6607)
  feat(payments): [Payment links]  Add configs for payment link (#7288)
pixincreate added a commit that referenced this pull request Feb 22, 2025
…tusedPM

* 'main' of github.com:juspay/hyperswitch: (22 commits)
  feat(connector): add Samsung pay mandate support for Cybersource (#7298)
  chore(masking): add peek_mut to PeekInterface (#7281)
  feat(samsung_pay): collect customer address details form Samsung Pay based on business profile config and connector required fields (#7320)
  ci: update creds (#7345)
  feat(router): add `merchant_configuration_id` in netcetera metadata and make other merchant configurations optional (#7347)
  fix(routing): Fixed 5xx error logs in dynamic routing metrics (#7335)
  fix(connector): [DATATRANS] Fix Force Sync Flow (#7331)
  chore(version): 2025.02.21.0
  fix(connector): [DATATRANS] Add new payment status (#7327)
  feat(router): [Xendit] add support for split payments (#7143)
  fix(payment_methods_v2): update fingerprint implementation in v2 (#7270)
  feat(router): Add Payments - List endpoint for v2 (#7191)
  feat(core): add support for confirmation flow for click to pay (#6982)
  chore(version): 2025.02.20.0
  fix(connector): [SCRIPT] Update template generating script and updated connector doc (#7301)
  ci(cypress): add assertions for `requires_cvv` (#7296)
  refactor(utils): match string for state with SDK's naming convention (#7300)
  feat(core): add hypersense integration api  (#7218)
  chore(version): 2025.02.19.0
  feat(connector): [Moneris] Add payments flow (#7249)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants