{"id":28932303,"url":"https://github.com/juspay/hyper-js","last_synced_at":"2026-01-20T17:55:07.965Z","repository":{"id":281798035,"uuid":"914726937","full_name":"juspay/hyper-js","owner":"juspay","description":"A rescript-based JavaScript library for dynamic script loading and HyperLoader initialization.","archived":false,"fork":false,"pushed_at":"2025-06-17T10:20:40.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-17T10:36:00.626Z","etag":null,"topics":["hyper-js","javascript","rescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@juspay-tech/hyper-js","language":"ReScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juspay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-10T07:21:57.000Z","updated_at":"2025-06-17T10:19:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"98501e0d-a12a-46e1-949b-861c85a6379f","html_url":"https://github.com/juspay/hyper-js","commit_stats":null,"previous_names":["juspay/hyper-js"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/juspay/hyper-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juspay","download_url":"https://codeload.github.com/juspay/hyper-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260792430,"owners_count":23064008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hyper-js","javascript","rescript"],"created_at":"2025-06-22T16:41:15.130Z","updated_at":"2026-01-20T17:55:07.929Z","avatar_url":"https://github.com/juspay.png","language":"ReScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @juspay-tech/hyper-js\n\nThe `@juspay-tech/hyper-js` package provides seamless integration of HyperSwitch's secure checkout features into your web application. It dynamically loads the required scripts, and initializes the HyperSwitch SDK.\n\n## Installation\n\nInstall the package via npm or yarn:\n\n```bash\nnpm install @juspay-tech/hyper-js\n```\n\nor\n\n```bash\nyarn add @juspay-tech/hyper-js\n```\n\n## Usage\n\n### Importing the Library\n\n```js\nimport { loadHyper } from \"@juspay-tech/hyper-js\";\n```\n\n### Loading HyperSwitch\n\nThe main function, `loadHyper`, dynamically loads the HyperSwitch SDK and initializes it with analytics metadata.\n\n#### Syntax\n\n```js\nconst hyperPromise = loadHyper(\"YOUR_PUBLISHABLE_KEY\", {\n  customBackendUrl: \"YOUR_BACKEND_URL\",\n  // You can configure this as an endpoint for all the api calls such as session, payments, confirm call.\n});\n```\n\n- **`str`**: A string representing your public key.\n- **`option`**: Optional configuration object (`option\u003cJSON.t\u003e`).\n\n#### Example\n\n```js\nloadHyper(\"YOUR_PUBLISHABLE_KEY\", None)\n-\u003ethen(instance =\u003e {\n  // Use the instance for further operations\n})\n-\u003ecatch(err =\u003e {\n  console.error(\"Failed to load Hyper:\", err)\n})\n```\n\n### Deprecated Function: `loadStripe`\n\nThe function `loadStripe` is deprecated and will be removed in future versions. It is a wrapper around `loadHyper` with a warning. Please use `loadHyper` instead.\n\n#### Example\n\n```js\nloadStripe(\"YOUR_PUBLISHABLE_KEY\", None);\n```\n\n**Warning:** This function will log a deprecation message in the console.\n\n## Features\n\n- Dynamically loads the HyperSwitch SDK based on the environment (Sandbox or Production).\n- Ensures that only a single script instance is added to the page.\n- Provides an easy-to-use promise-based API.\n\n## Script URLs\n\nThe script URL is determined based on your environment and key:\n\n- **Sandbox:** `https://beta.hyperswitch.io/v1/HyperLoader.js`\n- **Production:** `https://checkout.hyperswitch.io/v0/HyperLoader.js`\n- **Fallback:** Determines based on the prefix of the provided key (`pk_prd_`).\n\n## Integration Warnings\n\nThe `loadHyper` function ensures that the `HyperLoader.js` script is added only once to the page. Adding multiple script tags may lead to unexpected behavior. If a script is already present, the function will issue a warning and use the existing script.\n\n## Development and Contributions\n\nContributions are welcome! Please ensure that your changes align with the existing code style and add appropriate documentation.\n\n## License\n\nThis project is licensed under the Apache License. See the [LICENSE](./LICENSE) file for details.\n\n## Support\n\nFor further assistance, please contact [Support](https://github.com/juspay/hyperswitch-web/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuspay%2Fhyper-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuspay%2Fhyper-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuspay%2Fhyper-js/lists"}