npm install @mycoverai/mca-vue-sdk
pnpm add @mycoverai/mca-vue-sdk
yarn add @mycoverai/mca-vue-sdk
bun add @mycoverai/mca-vue-sdk
<script src="https://unpkg.com/@mycoverai/mca-vue-sdk/dist/umd.js"></script>
import { createApp } from 'vue';
import mca from "@mycoverai/mca-vue-sdk";
import App from './App.vue';
const app = createApp(App);
app.use(mca);
app.mount('#app');
<template>
<mca
action="purchase"
pk="MCAPUBK_...your_public_key..."
payment-option="gateway"
:pid="['<product-id>']"
:on-close="handleClose"
:callback="handleSuccess"
/>
</template>
<script setup>
function handleClose(close_url) {
console.log("SDK closed", close_url);
}
function handleSuccess(success_url, data) {
console.log("Operation successful", success_url, data);
}
</script>
The table below contains the available config parameters and their descriptions.
| Parameter | Type | Required | Description |
|---|---|---|---|
pk | string | Yes | Your unique Mycover.ai public key. |
action | string | Yes | The action you want to perform. Options: purchase, managePolicy, renewal, claim. |
pid | string | string[] | Yes* | The product ID or an array of product IDs. Required for purchase and claim actions. |
payment_option | string | Yes* | How the customer will pay. Options: gateway or wallet. Required for purchase and renewal actions. |
reference | string | No | A unique payment reference. Required if using the wallet payment option. |
callback | function | No | A function called upon successful operation (Purchase, Claim, Renewal, etc). Receives success_url (string) and data (object). |
onClose | function | No | A function called when the customer cancels or closes the SDK. Receives close_url (string). |
policy_id | string | No | The ID of an existing policy (used for policy management). |
claim_id | string | No | The ID of an existing claim (used to resume/track a claim). |