Javascript
Create embedded insurance offerings using our JavaScript SDK.
Installation
With NPM
From CDN
Usage
With NPM
With CDN
Configuration
The table below contains the available config
parameters and their descriptions.
PARAMETER | DESCRIPTION | REQUIRED | TYPE | DEFAULT |
---|---|---|---|---|
productId | Mycover.ai insurance product id. If productId is not provided or is an empty array, the SDK will display a list of insurance products for the customer to choose from. You can supply an array of strings, where each string represents an insurance product id, for the user to select from. | No | <string>Array | [] |
publicKey | Your unique Mycover.ai public key | Yes | string | - |
form | Provide form data that your user has already given to ease form filling. The form object and all its properties are optional, you only need to provide this when they are available. However, the property names must match the following format form: { "state": "Nasarawa", "first_name": "Lucian", "last_name": "Bryant", "address": "Rem quae molestias h", "email": "dyzivoga@mailinator.com", "date_of_birth": "2015-05-19", "phone_number": "+2348011111111", } Where the property names do not match the ones we have provided above, such fields will be discarded and ignored. | No | object | {} |
paymentOption | Set to 'wallet' or 'gateway' to define default payment option | Yes | gateway | wallet | gateway |
willInspect | Ignore or set to false if you do not need inspection enabled. Set to true to enable inspection | No | boolean | true |
callback | A function to call after the user has completed a purchase, claim, or inspection | No | function | - |
onClose | A function to call after the user closes without completing a purchase, activation or inspection | No | function | - |
action | Sets what action is to be taken on the initialization of the SDK. | Yes | purchase | inspection | claim | inspectionAsService | claimAsService | purchase |
reference | Supply reference when you want the user to continue to the insurance activation step. This only applies to users who have previously bought insurance using this SDK | No | string | - |
landingUrls | Supply landing page urls if you want your users to be re-routed to your custom web page after completing a purchase or claim. It takes in a maximum of two urls. The first url is called after a purchase. The second url is called after a claim. If you don't specify a url, your users will be redirected to Mycover.ai by default. | No | <string>Array | [] |
Last updated