hyperswitch-web icon indicating copy to clipboard operation
hyperswitch-web copied to clipboard

feat: split payments support

Open aritro2002 opened this issue 1 month ago • 4 comments

Type of Change

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

Description

Implemented Split Payments

API:

check-balance-and-apply-pm-data

request:

curl 'https://integ.hyperswitch.io/api/v2/payments/12345_pay_019aa18100847d00874101ea39b49417/eligibility/check-balance-and-apply-pm-data' \
  -H 'accept: */*' \
  -H 'accept-language: en,en-GB;q=0.9,en-US;q=0.8' \
  -H 'api-key: pk_snd_7f095116f99247d88666eb2e05e9e007' \
  -H 'authorization: publishable-key=pk_snd_7f095116f99247d88666eb2e05e9e007, client-secret=cs_019aa18100a27d50b3548cdf6213b9b7' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'origin: https://dev.hyperswitch.io' \
  -H 'pragma: no-cache' \
  -H 'priority: u=1, i' \
  -H 'referer: https://dev.hyperswitch.io/' \
  -H 'sec-ch-ua: "Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36' \
  -H 'x-browser-name: Chrome' \
  -H 'x-browser-version: 141.0.0' \
  -H 'x-client-platform: web' \
  -H 'x-client-version: 0.127.0' \
  -H 'x-payment-confirm-source: sdk' \
  -H 'x-profile-id: pro_TeOWYTMpdh8LuDMSlY4Q' \
  --data-raw '{"payment_methods":[{"gift_card":{"givex":{"number":"6036280000000000000","cvc":"12345"}}}]}'
  

response:

{
  "balances": [
      {
          "payment_method_data": {
              "gift_card": {
                  "givex": {
                      "number": "6036280000000000000",
                      "cvc": "12345"
                  }
              }
          },
          "eligibility": {
              "success": {
                  "balance": 5000,
                  "applicable_amount": 5000,
                  "currency": "EUR"
              }
          }
      }
  ],
  "remaining_amount": 5000,
  "currency": "EUR",
  "requires_additional_pm_data": true,
  "surcharge_details": null
}

confirm call:

curl 'https://integ.hyperswitch.io/api/v2/payments/12345_pay_019aa18100847d00874101ea39b49417/confirm-intent' \
-H 'accept: */*' \
-H 'accept-language: en,en-GB;q=0.9,en-US;q=0.8' \
-H 'api-key: invalid_key' \
-H 'authorization: publishable-key=pk_snd_7f095116f99247d88666eb2e05e9e007,client-secret=cs_019aa18100a27d50b3548cdf6213b9b7' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'origin: https://dev.hyperswitch.io' \
-H 'pragma: no-cache' \
-H 'priority: u=1, i' \
-H 'referer: https://dev.hyperswitch.io/' \
-H 'sec-ch-ua: "Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-site' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36' \
-H 'x-browser-name: Chrome' \
-H 'x-browser-version: 141.0.0' \
-H 'x-client-platform: web' \
-H 'x-client-version: 0.127.0' \
-H 'x-payment-confirm-source: sdk' \
-H 'x-profile-id: pro_TeOWYTMpdh8LuDMSlY4Q' \
--data-raw '{"payment_method_type":"card","payment_method_subtype":"card","payment_method_data":{"card":{"card_number":"4000620000000007","card_exp_month":"03","card_exp_year":"2030","card_cvc":"737","card_issuer":"","card_network":"Visa"}},"split_payment_method_data":[{"payment_method_type":"gift_card","payment_method_subtype":"givex","payment_method_data":{"gift_card":{"givex":{"number":"6036280000000000000","cvc":"12345"}}}}],"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en","color_depth":24,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"device_model":"Macintosh","os_type":"macOS","os_version":"10.15.7"}}'
{
  "id": "12345_pay_019aa18100847d00874101ea39b49417",
  "status": "succeeded",
  "amount": {
      "order_amount": 10000,
      "currency": "EUR",
      "shipping_cost": null,
      "order_tax_amount": null,
      "external_tax_calculation": "skip",
      "surcharge_calculation": "skip",
      "surcharge_amount": null,
      "tax_on_surcharge": null,
      "net_amount": 10000,
      "amount_to_capture": null,
      "amount_capturable": 0,
      "amount_captured": 10000
  },
  "customer_id": "12345_cus_0199704b4b3871c08ac9fde80cfc42bd",
  "connector": "adyen",
  "created": "2025-11-20T13:42:57.428Z",
  "modified_at": "2025-11-20T13:44:52.320Z",
  "payment_method_data": {
      "billing": null
  },
  "payment_method_type": "card",
  "payment_method_subtype": "card",
  "connector_transaction_id": "R7JPDBPQT2JDCQV5",
  "connector_reference_id": "12345_att_019aa182ba767933ac1fd45f6521e93d",
  "merchant_connector_id": "mca_sCuW2pdMfI2CWyVbfSVb",
  "browser_info": null,
  "error": null,
  "shipping": null,
  "billing": null,
  "attempts": null,
  "connector_token_details": null,
  "payment_method_id": null,
  "next_action": null,
  "return_url": "https://google.com/success",
  "authentication_type": "three_ds",
  "authentication_type_applied": "three_ds",
  "is_iframe_redirection_enabled": null,
  "merchant_reference_id": null,
  "raw_connector_response": null,
  "feature_metadata": null,
  "metadata": null
}

How did you test it?

https://github.com/user-attachments/assets/6032faec-1f99-42fe-b266-7c240141dbbe

Checklist

  • [x] I ran npm run re:build
  • [x] I reviewed submitted code
  • [ ] I added unit tests for my changes where possible

aritro2002 avatar Nov 17 '25 02:11 aritro2002

Review changes with  SemanticDiff

Changed Files
File Status
  public/icons/orca.svg  0% smaller
  src/Components/Accordion.res Unsupported file format
  src/Components/AccordionContainer.res Unsupported file format
  src/Components/AddressPaymentInput.res Unsupported file format
  src/Components/BillingNamePaymentInput.res Unsupported file format
  src/Components/BlikCodePaymentInput.res Unsupported file format
  src/Components/DynamicFields.res Unsupported file format
  src/Components/EmailPaymentInput.res Unsupported file format
  src/Components/FullNamePaymentInput.res Unsupported file format
  src/Components/GiftCardForm.res Unsupported file format
  src/Components/GiftCards.res Unsupported file format
  src/Components/PixPaymentInput.res Unsupported file format
  src/Components/SavedCardItem.res Unsupported file format
  src/Components/VpaIdPaymentInput.res Unsupported file format
  src/Hooks/GiftCardHook.res Unsupported file format
  src/LoaderController.res Unsupported file format
  src/LocaleStrings/ArabicLocale.res Unsupported file format
  src/LocaleStrings/CatalanLocale.res Unsupported file format
  src/LocaleStrings/ChineseLocale.res Unsupported file format
  src/LocaleStrings/DeutschLocale.res Unsupported file format
  src/LocaleStrings/DutchLocale.res Unsupported file format
  src/LocaleStrings/EnglishGBLocale.res Unsupported file format
  src/LocaleStrings/EnglishLocale.res Unsupported file format
  src/LocaleStrings/FrenchBelgiumLocale.res Unsupported file format
  src/LocaleStrings/FrenchLocale.res Unsupported file format
  src/LocaleStrings/HebrewLocale.res Unsupported file format
  src/LocaleStrings/ItalianLocale.res Unsupported file format
  src/LocaleStrings/JapaneseLocale.res Unsupported file format
  src/LocaleStrings/LocaleStringTypes.res Unsupported file format
  src/LocaleStrings/PolishLocale.res Unsupported file format
  src/LocaleStrings/PortugueseLocale.res Unsupported file format
  src/LocaleStrings/RussianLocale.res Unsupported file format
  src/LocaleStrings/SpanishLocale.res Unsupported file format
  src/LocaleStrings/SwedishLocale.res Unsupported file format
  src/LocaleStrings/TraditionalChineseLocale.res Unsupported file format
  src/PaymentElementV2.res Unsupported file format
  src/PaymentOptions.res Unsupported file format
  src/Payments/ACHBankDebit.res Unsupported file format
  src/Payments/ACHBankTransfer.res Unsupported file format
  src/Payments/AddBankDetails.res Unsupported file format
  src/Payments/ApplePay.res Unsupported file format
  src/Payments/BacsBankDebit.res Unsupported file format
  src/Payments/BacsBankTransfer.res Unsupported file format
  src/Payments/BankDebitModal.res Unsupported file format
  src/Payments/BecsBankDebit.res Unsupported file format
  src/Payments/Boleto.res Unsupported file format
  src/Payments/CardIframeContainer.res Unsupported file format
  src/Payments/CardPayment.res Unsupported file format
  src/Payments/DateOfBirth.res Unsupported file format
  src/Payments/GPay.res Unsupported file format
  src/Payments/InstantBankTransfer.res Unsupported file format
  src/Payments/InstantBankTransferFinland.res Unsupported file format
  src/Payments/InstantBankTransferPoland.res Unsupported file format
  src/Payments/KlarnaSDK.res Unsupported file format
  src/Payments/PayPal.res Unsupported file format
  src/Payments/PaymentMethodsRecord.res Unsupported file format
  src/Payments/PaymentMethodsWrapper.res Unsupported file format
  src/Payments/PaypalSDK.res Unsupported file format
  src/Payments/PazeButton.res Unsupported file format
  src/Payments/PreMountLoader.res Unsupported file format
  src/Payments/SamsungPayComponent.res Unsupported file format
  src/Payments/SepaBankDebit.res Unsupported file format
  src/Payments/SepaBankTransfer.res Unsupported file format
  src/TabCard.res Unsupported file format
  src/Types/PaymentModeType.res Unsupported file format
  src/Types/UnifiedPaymentsTypesV2.res Unsupported file format
  src/Utilities/DynamicFieldsUtils.res Unsupported file format
  src/Utilities/PaymentBodyV2.res Unsupported file format
  src/Utilities/PaymentHelpersV2.res Unsupported file format
  src/Utilities/RecoilAtoms.res Unsupported file format
  src/Utilities/RecoilAtomsV2.res Unsupported file format
  src/Utilities/UnifiedHelpersV2.res Unsupported file format
  src/VGSVault/VGSVault.res Unsupported file format
  src/hyper-loader/Elements.res Unsupported file format

semanticdiff-com[bot] avatar Nov 17 '25 02:11 semanticdiff-com[bot]

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues. 🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

github-actions[bot] avatar Nov 17 '25 02:11 github-actions[bot]

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues. 🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

github-actions[bot] avatar Nov 17 '25 03:11 github-actions[bot]

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues. 🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

github-actions[bot] avatar Nov 17 '25 03:11 github-actions[bot]