Skip to content

feat: add per-call endpoint override config with backward compat - #1691

Open
aritro2002 wants to merge 8 commits into
mainfrom
feat/custom-endpoint-config-overrides
Open

feat: add per-call endpoint override config with backward compat#1691
aritro2002 wants to merge 8 commits into
mainfrom
feat/custom-endpoint-config-overrides

Conversation

@aritro2002

@aritro2002 aritro2002 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Type of Change

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

Description

Introduces a structured customConfig endpoint override system, fixing missing wiring for
overrideCustomAssetsEndpoint and overrideCustomConfirmEndpoint, and adding full
parent→child iframe forwarding for all endpoint types. Legacy customBackendUrl continues
to work unchanged.
ref: https://github.com/sh-iv-am/integrations

Files Changed

File Change
src/Utilities/ApiEndpoint.res Added all endpoint refs (backendOverrideEndPoint, confirmOverrideEndPoint, assetsEndPoint, sdkConfigEndPoint, loggingOverrideEndPoint, airborneEndPoint), their setters, and getters with documented priority chains
src/Utilities/S3Utils.res getBaseUrl now calls ApiEndpoint.getAssetsEndPoint() instead of hardcoded GlobalVars.sdkUrl
src/Utilities/APIHelpers/APIUtils.res FetchSdkConfigs now uses getSdkConfigEndPoint() separately from payment API calls
src/Utilities/Utils.res getHeaders injects x-platform-api-key header when platformPublishableKey is set
src/hyper-log-catcher/HyperLogger.res Beacon uses getLoggingEndPoint() instead of hardcoded GlobalVars.logEndpoint
src/hyper-loader/Hyper.res Parses all customConfig fields and platformPublishableKey from init args
src/hyper-loader/Elements.res Computes and forwards confirmEndpoint, loggingEndpoint, assetsEndpoint, platformPublishableKey in parent→child postMessage
src/hyper-loader/PaymentMethodsManagementElements.res Same as Elements.res
src/LoaderController.res Child iframe now receives and applies confirmEndpoint, loggingEndpoint, assetsEndpoint, platformPublishableKey from parent message
src/hyper-loader/UpdateIntentHelpersNew.res Threads platformPublishableKey through to the preMountLoader iframe URL
src/Payments/PreMountLoader.res Accepts and sets platformPublishableKey before eager API calls fire
src/App.res Reads platformPublishableKey from query params and passes to PreMountLoader

Priority Matrix (all combinations)

customBackendUrl customEndpoint overrideCustomBackend overrideCustomConfirm overrideCustomAssets Backend calls Confirm calls Assets / S3 SDK Config
ENV_BACKEND_URL ENV_CONFIRM_URL sdkUrl ENV_BACKEND_URL
customBackendUrl customBackendUrl customBackendUrl customBackendUrl
customEndpoint (wins) customEndpoint customEndpoint customEndpoint
customEndpoint customEndpoint customEndpoint customEndpoint
overrideCustomBackend customEndpoint customEndpoint customEndpoint
customEndpoint overrideCustomConfirm customEndpoint customEndpoint
customEndpoint customEndpoint overrideCustomAssets customEndpoint
overrideCustomBackend overrideCustomConfirm overrideCustomAssets customEndpoint
overrideCustomBackend ENV_CONFIRM_URL sdkUrl ENV_BACKEND_URL
ENV_BACKEND_URL overrideCustomConfirm sdkUrl ENV_BACKEND_URL
ENV_BACKEND_URL ENV_CONFIRM_URL overrideCustomAssets ENV_BACKEND_URL

customEndpoint always beats customBackendUrl — both write to the same apiEndPoint ref.
customConfig is parsed after customBackendUrl in Hyper.res init, so the last write wins
(Hyper.res:229 sets from customBackendUrl, Hyper.res:251 overwrites with customEndpoint).


Endpoint Resolution Reference

Backend (non-confirm) — getApiEndPoint(~isConfirmCall=false)
  1. customConfig.overrideCustomBackendEndpoint
  2. customConfig.customEndpoint
  3. customBackendUrl  [legacy]
  4. Build-time ENV_BACKEND_URL
  5. https://beta.hyperswitch.io/api  (pk_snd_* on prod)

Confirm — getApiEndPoint(~isConfirmCall=true)
  1. customConfig.overrideCustomConfirmEndpoint
  2. customConfig.customEndpoint
  3. customBackendUrl  [legacy]
  4. Build-time ENV_CONFIRM_URL
  5. https://beta.hyperswitch.io/api  (pk_snd_* on prod)

SDK Config fetch — getSdkConfigEndPoint()
  1. customConfig.overrideCustomSDKConfigEndpoint
  2. customConfig.customEndpoint
  3. customBackendUrl  [legacy]
  4. Build-time ENV_BACKEND_URL
  5. https://beta.hyperswitch.io/api  (pk_snd_* on prod)

Assets / S3 — getAssetsEndPoint()
  1. customConfig.overrideCustomAssetsEndpoint
  2. customConfig.customEndpoint
  3. customBackendUrl  [legacy]
  4. Build-time sdkUrl  (empty string on local)

Logging / beacon — getLoggingEndPoint()
  1. customConfig.overrideCustomLoggingEndpoint
  2. Build-time GlobalVars.logEndpoint



How did you test it?

I have tested it locally

window.Hyper(
          {
            publishableKey,
            profileId,
            platformPublishableKey: "pk_platform_xxxx",
            customConfig: {
              customEndpoint: "https://dev.hyperswitch.io/api",
              overrideCustomBackendEndpoint: "https://sandbox.hyperswitch.io",
              // overrideCustomConfirmEndpoint: "https://sandbox.hyperswitch.io", // payment confirm calls
              // overrideCustomSDKConfigEndpoint: "https://config.example.com/api",         // SDK config fetch
              // overrideCustomLoggingEndpoint:   "https://logs.example.com/logs",          // beacon logging
              // overrideCustomAssetsEndpoint:    "https://assets.example.com",             // stored, future use
              // overrideCustomAirborneEndpoint:  "https://airborne.example.com",
            },
          },
          )

Checklist

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

@aritro2002 aritro2002 self-assigned this Jul 15, 2026
@aritro2002 aritro2002 added the Ready for Review PR with label Ready for Review should only be reviewed. label Jul 15, 2026
@semanticdiff-com

semanticdiff-com Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  webpack.common.js  34% smaller
  src/App.res Unsupported file format
  src/LoaderController.res Unsupported file format
  src/Payments/PreMountLoader.res Unsupported file format
  src/Utilities/APIHelpers/APIUtils.res Unsupported file format
  src/Utilities/ApiEndpoint.res Unsupported file format
  src/Utilities/S3Utils.res Unsupported file format
  src/Utilities/Utils.res Unsupported file format
  src/hyper-loader/Elements.res Unsupported file format
  src/hyper-loader/Hyper.res Unsupported file format
  src/hyper-loader/PaymentMethodsManagementElements.res Unsupported file format
  src/hyper-loader/UpdateIntentHelpersNew.res Unsupported file format
  src/hyper-log-catcher/HyperLogger.res Unsupported file format

@github-actions

Copy link
Copy Markdown
Contributor

🚫 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

Copy link
Copy Markdown
Contributor

🚫 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! 🙌

2 similar comments
@github-actions

Copy link
Copy Markdown
Contributor

🚫 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

Copy link
Copy Markdown
Contributor

🚫 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! 🙌

Comment thread src/hyper-loader/Hyper.res Outdated
let overrideCustomAssetsEndpoint = getFieldStr("overrideCustomAssetsEndpoint")
let overrideCustomSDKConfigEndpoint = getFieldStr("overrideCustomSDKConfigEndpoint")
let overrideCustomConfirmEndpoint = getFieldStr("overrideCustomConfirmEndpoint")
let overrideCustomAirborneEndpoint = getFieldStr("overrideCustomAirborneEndpoint")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove airborneEndpoint related logic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove overrideCustomAirborneEndpoint as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@XyneSpaces

Copy link
Copy Markdown

[should-fix] Please clear platformPublishableKey when a new Elements/PMM instance is initialized without one, instead of only setting it on non-empty values. This ref is module-global, so a page that first mounts a platform instance and later mounts a normal instance will keep sending the stale x-platform-api-key header on subsequent API calls.

Comment thread src/Utilities/APIHelpers/APIUtils.res Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🚫 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

Copy link
Copy Markdown
Contributor

🚫 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

Copy link
Copy Markdown
Contributor

🚫 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

Copy link
Copy Markdown
Contributor

🚫 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! 🙌

sakksham7
sakksham7 previously approved these changes Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Review PR with label Ready for Review should only be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add per-call endpoint override config with backward compat

3 participants