@juspay-tech/capacitor-hyperswitch
v1.0.0-alpha.1
Published
Hyperswitch SDK bindings for Capacitor Applications
Readme
capacitor-hyperswitch
Hyperswitch SDK bindings for Capacitor Applications
Install
To use npm
npm install capacitor-hyperswitchTo use yarn
yarn add capacitor-hyperswitchSync native files
npx cap syncAPI
init(...)elements(...)createElement(...)updateIntent(...)getCustomerSavedPaymentMethods()getCustomerSavedPaymentMethodData(...)getCustomerDefaultSavedPaymentMethodData(...)getCustomerLastUsedPaymentMethodData(...)confirmWithCustomerDefaultPaymentMethod(...)confirmWithCustomerLastUsedPaymentMethod(...)confirmPayment(...)initPaymentSession(...)presentPaymentSheet(...)elementOn(...)elementCollapse()elementBlur()elementUpdate(...)elementDestroy()elementUnmount()elementMount(...)elementFocus()elementClear()addListener('paymentEvent', ...)- Interfaces
- Type Aliases
init(...)
init(config: HyperConfig) => Promise<void>| Param | Type |
| ------------ | --------------------------------------------------- |
| config | HyperConfig |
elements(...)
elements(options: { elementsOptions: JSONValue; }) => Promise<{ handlerId: string; }>| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options | { elementsOptions: JSONValue; } |
Returns: Promise<{ handlerId: string; }>
createElement(...)
createElement(options: { type: string; createOptions: JSONValue; }) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------------------------------------- |
| options | { type: string; createOptions: JSONValue; } |
updateIntent(...)
updateIntent(options: { sdkAuthorization: string; }) => Promise<UpdateIntentResult>| Param | Type |
| ------------- | ------------------------------------------ |
| options | { sdkAuthorization: string; } |
Returns: Promise<UpdateIntentResult>
getCustomerSavedPaymentMethods()
getCustomerSavedPaymentMethods() => Promise<{ handlerId: string; }>Returns: Promise<{ handlerId: string; }>
getCustomerSavedPaymentMethodData(...)
getCustomerSavedPaymentMethodData(options: { handlerId: string; }) => Promise<JSONValue>| Param | Type |
| ------------- | ----------------------------------- |
| options | { handlerId: string; } |
Returns: Promise<JSONValue>
getCustomerDefaultSavedPaymentMethodData(...)
getCustomerDefaultSavedPaymentMethodData(options: { handlerId: string; }) => Promise<JSONValue>| Param | Type |
| ------------- | ----------------------------------- |
| options | { handlerId: string; } |
Returns: Promise<JSONValue>
getCustomerLastUsedPaymentMethodData(...)
getCustomerLastUsedPaymentMethodData(options: { handlerId: string; }) => Promise<JSONValue>| Param | Type |
| ------------- | ----------------------------------- |
| options | { handlerId: string; } |
Returns: Promise<JSONValue>
confirmWithCustomerDefaultPaymentMethod(...)
confirmWithCustomerDefaultPaymentMethod(options: { handlerId: string; }) => Promise<PaymentResult>| Param | Type |
| ------------- | ----------------------------------- |
| options | { handlerId: string; } |
Returns: Promise<PaymentResult>
confirmWithCustomerLastUsedPaymentMethod(...)
confirmWithCustomerLastUsedPaymentMethod(options: { handlerId: string; }) => Promise<PaymentResult>| Param | Type |
| ------------- | ----------------------------------- |
| options | { handlerId: string; } |
Returns: Promise<PaymentResult>
confirmPayment(...)
confirmPayment(options: { confirmParams: JSONValue; }) => Promise<PaymentResult>| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| options | { confirmParams: JSONValue; } |
Returns: Promise<PaymentResult>
initPaymentSession(...)
initPaymentSession(options: { paymentSessionOptions: JSONValue; }) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | { paymentSessionOptions: JSONValue; } |
presentPaymentSheet(...)
presentPaymentSheet(options: { sheetOptions: JSONValue; }) => Promise<PaymentResult>| Param | Type |
| ------------- | ------------------------------------------------------------------ |
| options | { sheetOptions: JSONValue; } |
Returns: Promise<PaymentResult>
elementOn(...)
elementOn(options: { event: string; }) => Promise<void>| Param | Type |
| ------------- | ------------------------------- |
| options | { event: string; } |
elementCollapse()
elementCollapse() => Promise<void>elementBlur()
elementBlur() => Promise<void>elementUpdate(...)
elementUpdate(options: { updateOptions: JSONValue; }) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| options | { updateOptions: JSONValue; } |
elementDestroy()
elementDestroy() => Promise<void>elementUnmount()
elementUnmount() => Promise<void>elementMount(...)
elementMount(options: { selector: string; }) => Promise<void>| Param | Type |
| ------------- | ---------------------------------- |
| options | { selector: string; } |
elementFocus()
elementFocus() => Promise<void>elementClear()
elementClear() => Promise<void>addListener('paymentEvent', ...)
addListener(event: 'paymentEvent', handler: (data: PaymentEventData) => void) => Promise<{ remove: () => Promise<void>; }>Subscribe to native widget events emitted by PaymentElement or CvcWidget.
The handler receives a PaymentEventData object with type and payload.
Use element.on(eventType, handler) in the JS wrapper layer instead of
calling this directly.
| Param | Type |
| ------------- | -------------------------------------------------------------------------------- |
| event | 'paymentEvent' |
| handler | (data: PaymentEventData) => void |
Returns: Promise<{ remove: () => Promise<void>; }>
Interfaces
HyperConfig
| Prop | Type |
| ---------------------------- | ----------------------------------------------------- |
| publishableKey | string |
| profileId | string |
| platformPublishableKey | string |
| customConfig | CustomConfig |
CustomConfig
| Prop | Type |
| ----------------------------- | ------------------- |
| customEndpoint | string |
| customBackendEndpoint | string |
| customLoggingEndpoint | string |
| customAssetEndpoint | string |
| customSDKConfigEndpoint | string |
| customAirborneEndpoint | string |
UpdateIntentResult
| Prop | Type | Description |
| -------------------- | ------------------- | ----------------------------------------------- |
| type | string | "success" | "totalFailure" | "partialFailure" |
| message | string | |
| failedCount | number | |
| succeededCount | number | |
PaymentResult
| Prop | Type |
| ------------- | -------------------------------------------------- |
| type | 'completed' | 'canceled' | 'failed' |
| message | string |
PaymentEventData
Native event emitted by PaymentElement or CvcWidget.
type values:
PaymentElement: "FORM_STATUS" | "PAYMENT_METHOD_STATUS" |
"PAYMENT_METHOD_INFO_CARD" | "PAYMENT_METHOD_INFO_BILLING_ADDRESS"
CvcWidget: "CVC_STATUS"
payload is the raw key/value data from the SDK (values serialised to strings on Android).
| Prop | Type |
| ------------- | --------------------------------------------------------------- |
| type | string |
| payload | Record<string, string> |
Type Aliases
JSONValue
Record<string, unknown>
Record
Construct a type with a set of properties K of type T
{ [P in K]: T; }
