build
(species:
string
): Promise
Description: This method is used to create an instance of PhonePe. This method runs asynchronously and it is very fast. This instance is used for any calls to PhonePe’s bridges.
<rdme-callout theme=”warn” icon=”🚧” title=”Older build() call is deprecated” value=”Starting JS SDK version 0.3.6 and above, the operatingSystem parameter is not needed. On SDK version
Older build() call is deprecated
Starting JS SDK version 0.3.6 and above, the operatingSystem parameter is not needed. On SDK version < 0.3.6, operatingSystem is necessary and can be either PhonePe.Constants.OS.ios
or PhonePe.Constants.OS.android
. Please use the latest SDK version.
Parameter Name | Type | Description |
---|---|---|
species | string | Describes if the merchant is using the sdk for web or react native. Can be either PhonePe.Constants.Species.native or PhonePe.Constants.Species.web |
Promise<PhonePe>
Usage:
ExamplePhonePe.PhonePe.build(PhonePe.Constants.Species.web)
.then((sdk) => { //Get the instance of the sdk })
OR
let sdk = await PhonePe.PhonePe.build(PhonePe.Constants.Species.web)
isMethodSupported
(methodName:
string
): boolean
Description: Call this method to check if the method that you’re trying to call is supported. This is a synchronous call and returns the result immediately. Methods might be added/removed and it’s important to know if a method is supported by the current PhonePe app that merchant’s web app is running on. Case in point, if a method gets added to the SDK, older PhonePe apps might not support the method.
For the current version of PhonePe’s SDK, merchants won’t need to call this.
Parameter Name | Type | Description |
---|---|---|
methodName | string | Name of the method that you’d be calling |
boolean
Usage:
Example//When invoking method named setItem
if (sdk.isMethodSupported(setItem)) { sdk.setItem('app', 'key', 'value') }