Using KKiaPay with Nuxt.js

Installation

Please run the following command :

npm install kkiapay@latest

Add kkiapay plugin

// plugins/kkiapay.client.ts

import { defineNuxtPlugin } from "#app";
import * as kkiapayModule from "kkiapay";

export default defineNuxtPlugin(() => {
  return {
    provide: {
      kkiapay: kkiapayModule,
    },
  };
});

Usage

Define a function that will display the KKiaPay Widget :

You can now use this function within your view template to display the payment interface :

You can subscribe to payment transaction events with the addKkiapayListener function and proceed as follows :

In order to avoid memory leaks, we will need to delete the callback when the component is destroyed :

Last updated

Was this helpful?