{"id":28932295,"url":"https://github.com/juspay/hyper-sdk-capacitor","last_synced_at":"2025-07-19T01:05:12.228Z","repository":{"id":172784130,"uuid":"644376591","full_name":"juspay/hyper-sdk-capacitor","owner":"juspay","description":"Capacitor Plugin over Hyper SDK","archived":false,"fork":false,"pushed_at":"2025-04-30T19:20:24.000Z","size":1476,"stargazers_count":3,"open_issues_count":3,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-21T10:05:55.199Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://juspay.in","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juspay.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-23T11:46:06.000Z","updated_at":"2025-04-16T07:34:42.000Z","dependencies_parsed_at":"2024-03-19T16:57:56.066Z","dependency_job_id":"9963a613-3bcc-4da6-8422-4deee4130062","html_url":"https://github.com/juspay/hyper-sdk-capacitor","commit_stats":null,"previous_names":["juspay/hyper-sdk-capacitor"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/juspay/hyper-sdk-capacitor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-sdk-capacitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-sdk-capacitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-sdk-capacitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-sdk-capacitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juspay","download_url":"https://codeload.github.com/juspay/hyper-sdk-capacitor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fhyper-sdk-capacitor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265866310,"owners_count":23840940,"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":[],"created_at":"2025-06-22T16:41:10.158Z","updated_at":"2025-07-19T01:05:12.216Z","avatar_url":"https://github.com/juspay.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HYPER-SDK-CAPACITOR\n\nCapacitor Wrapper over HyperSDK which enables payment orchestration via different dynamic modules. More details available at Juspay Developer Docs for [Express Checkout SDK](juspay.io/in/docs/ec-headless/capacitor) and [Payment Page SDK](https://juspay.io/in/docs/hyper-checkout/capacitor).\n\n## Install\n\n```bash\nnpm install hyper-sdk-capacitor\nnpx cap sync\n```\n\n### Android\n\nAdd following maven url in root build.gradle:\n\n```groovy\nallprojects {\n    repositories {\n        ....\n        ....\n        maven { url \"https://maven.juspay.in/jp-build-packages/hyper-sdk/\" }\n    }\n}\n```\n\n#### **Updating Client ID**\n\nAdd the clientId ext property in root(top) `build.gradle`:\n\n```groovy\nbuildscript {\n    ....\n    ext {\n        ....\n        clientId = \"\u003cclientId shared by Juspay team\u003e\"\n        hyperSDKVersion = \"2.2.2\"\n        ....\n    }\n    ....\n}\n```\n- You can also provide an override for base SDK version present in plugin (the newer version among both would be considered). - Optional\n- Exclude microSDKs provided with HyperSDK for given clientId by adding excludedMicroSDKs - Optional\n\n\n### iOS\n\nPlace the `MerchantConfig.txt` file inside the folder where the Podfile is present. This file doesn't need to be added to the project. The content of the file should be as below\n\n```txt\nclientId = \u003cclientId shared by Juspay Team\u003e\n```\n\nAdd below post_install script in the Podfile\n\n```sh\npost_install do |installer|\n fuse_path = \"./Pods/HyperSDK/Fuse.rb\"\n clean_assets = false # Pass true to re-download all the assets\n if File.exist?(fuse_path)\n   if system(\"ruby\", fuse_path.to_s, clean_assets.to_s)\n   end\n end\nend\n```\n\nRun the following command inside the ios folder of your project:\n\n```sh\npod install\n```\n\n**(Optional)** Add the following property in `package.json` of your project before running pod install if you want to override the base SDK version present in the plugin (the newer version among both would be considered):\n\n```json\n  {\n    ....\n    \"scripts\": {\n      ....\n    },\n    \"dependencies\": {\n      ....\n    },\n    \"devDependencies\": {\n      ....\n    },\n    \"hyperSdkIOSVersion\": \"2.2.2\"\n    ....\n  }\n```\n\n__________________\n\n### Import HyperSDK\n\n```ts\nimport { Plugins } from '@capacitor/core';\nimport 'hyper-sdk-capacitor';\n\nconst { HyperServices } = Plugins;\n```\n\n### Prefetch\n\nTo keep the SDK up to date with the latest changes, it is highly recommended to call preFetch as early as possible. It takes a `JSON Object` as its argument.\n\n```javascript\nawait HyperServices.preFetch(payload);\n```\n\n__________________\n\n### Step-1: Create HyperServices Object\n\nThis method creates an instance of `HyperServices` class in the Capacitor Plugin on which all the `HyperSDK` APIs / methods are triggered. It internally uses the current activity as an argument.\n\n**Note**: This method is mandatory and is required to call any other subsequent methods from `HyperSDK`.\n\n```javascript\nawait HyperServices.createHyperServices();\n```\n\n**Note**: For Web, following parameters should be passed createHyperServices API.\n\n- clientId : \"Client shared by Juspay\"\n- service :\n  - `\"in.juspay.hyperpay\"` (For Payment Page)\n  - `\"in.juspay.hyperapi\"` (For Express Checkout)\n\n```javascript\nawait HyperServices.createHyperServices(clientId, service)\n```\n\n__________________\n\n### Step-2: Initiate\n\nThis method should be called on the render of the host screen. This will boot up the SDK and start the Hyper engine. It takes a `JSON Object` as its argument which will contain the base parameters for the entire session and remains static throughout one SDK instance lifetime.\n\n**Notes**:\n\n1. It is highly recommended to initiate SDK from the order summary page (at least 5 seconds before opening your payment page) for seamless user experience.\n2. `initiate` should be called only once in one session.\n\n```javascript\nawait HyperServices.initiate(initiatePayload);\n```\n\n`Create Initiate payload` - Follow the documentation for [initiatePayload] (https://juspay.io/in/docs/hyper-checkout/capacitor/base-sdk-integration/initiating-sdk)\n\n__________________\n\n### To check if SDK is initialized or not\n\n```javascript\nvar { isInitialised } = await HyperServices.isInitialised();\n```\n\n### Step-3: Process\n\nThis API can be triggered any number of times based on requirements or app flow structure.\nIt should not be called on an HyperSDK instance which has not been initiated (Initiate API should be called before calling process API and make sure SDK is initialized)\n\nThis API should be triggered for all operations required from `HyperSDK`. The operation may be related to:\n\n- Displaying payment options on your payment page\n- Performing a transaction\n- User's payment profile management\n\nThe result of the process call is provided in the `Hyper Event listener`, later discussed in [step-4](#step-4-listen-to-events-from-hypersdk).\n\n```javascript\nawait HyperServices.process(processPayload);\n\n```\n\nFollow the documentation for [Process Payload](https://juspay.io/in/docs/hyper-checkout/capacitor/base-sdk-integration/rendering-the-checkout-screen) :\n\n__________________\n\n### Step-4: Listen to events from HyperSDK\n\n`HyperSDK` Native Module will be emitting all the relevant events to JS via `notifyListeners` and JavaScript modules can then register to receive events by invoking `addListener` on the `HyperServices` Plugin instance with the event name `'HyperEvent'`. The listener will return a `JSON` response.\n\nThe following events should be handled here:\n\n- `show_loader`: To show a loader for the processing state.\n- `hide_loader`: To hide the previously shown loader.\n- `initiate_result`: Result of initiate done in [step-2](#step-2-initiate).\n- `process_result`: Result of the process operation done in [step-3](#step-3-process).\n\n```javascript\n\nHyperServices.addListener('HyperEvent', async (data) =\u003e {\n   var event = data[\"event\"];\n   switch (event) {\n      case \"show_loader\": {\n         // Show a loader\n      }\n      break;\n      case \"hide_loader\": {\n         // Hide Loader\n      }\n      break;\n      case \"initiate_result\": {\n         // Initiate api response\n      }\n      break;\n      case \"process_result\": {\n         // Process result\n      }\n      break;\n      default:\n         let payload = data[\"payload\"];\n         console.log(\"process result: \", payload)\n      break;\n   }\n});\n```\n\n#### WEB\n\nDocumentation : \u003chttps://juspay.io/in/docs/hyper-checkout/web/overview/integration-architecture\u003e\nOnce the payment is complete the user is redirected to the return_url configured by you. Following is the typical destination where the user is taken to:\nPayment Response : \u003chttps://juspay.io/in/docs/hyper-checkout/web/base-sdk-integration/handle-payment-response\u003e\n\n__________________\n\n### Step-5: Android Hardware Back-Press Handling\n\n`HyperSDK` internally uses an android fragment for opening the bank page and will need the control to hardware back press when the bank page is active. This can be done by invoking `addEventListener` on the `backButton` provided by React Capacitor.\n\nIf the blocking asynchronous call `HyperServices.onBackPressed()` returns true, `HyperSDK` will handle the back press, else merchant can handle it.\n\n```javascript\nimport { App } from '@capacitor/app';\n\n.........\n.........\n\nApp.addListener('backButton', async (data) =\u003e {\n  const { onBackPressed } = await HyperServices.onBackPressed();\n  if (!onBackPressed) {\n    window.history.back();\n  }\n});\n```\n\n__________________\n\n### Terminate SDK\n\nThis method shall be triggered when `HyperSDK` is no longer required.\nNote : After calling terminate, initiate has to be called again.\n\n```javascript\nawait HyperServices.terminate();\n```\n\n__________________\n\n### Helper Method: Is Null\n\nThis is a helper method and can be used to check whether the `HyperServices` object is `null` at any particular moment. It is a blocking synchronous method and returns a `boolean` value.\n\n```javascript\nvar { isNull } = await HyperServices.isNull();\n```\n\n## License\n\nhyper-sdk-capacitor is distributed under [AGPL-3.0-only](https://github.com/juspay/hyper-sdk-capacitor/src/main/LICENSE.md) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuspay%2Fhyper-sdk-capacitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuspay%2Fhyper-sdk-capacitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuspay%2Fhyper-sdk-capacitor/lists"}